Commits

Stefano Zampini committed 68457ee

PCBDDC: MPIAIJ setup of coarse matrix when coarse_size == 0 when performing the first setup of PCBDDC

Comments (0)

Files changed (2)

src/ksp/pc/impls/bddc/bddc.c

   pcbddc->n_constraints              = 0;
   pcbddc->primal_indices_local_idxs  = 0;
   pcbddc->recompute_topography       = PETSC_FALSE;
-  pcbddc->coarse_size                = 0;
+  pcbddc->coarse_size                = -1;
   pcbddc->new_primal_space           = PETSC_FALSE;
   pcbddc->new_primal_space_local     = PETSC_FALSE;
   pcbddc->global_primal_indices      = 0;

src/ksp/pc/impls/bddc/bddcprivate.c

   PetscInt               void_procs,ncoarse_ml,ncoarse_ds,ncoarse;
   PetscMPIInt            all_procs;
   PetscBool              csin_ml,csin_ds,csin,csin_type_simple;
+  PetscBool              compute_vecs = PETSC_FALSE;
   PetscErrorCode         ierr;
 
   PetscFunctionBegin;
   /* Assign global numbering to coarse dofs */
-  if (pcbddc->new_primal_space) { /* a new primal space is present, so recompute global numbering */
+  if (pcbddc->new_primal_space || pcbddc->coarse_size == -1) { /* a new primal space is present or it is the first initialization, so recompute global numbering */
+    compute_vecs = PETSC_TRUE;
     PetscInt ocoarse_size;
     ocoarse_size = pcbddc->coarse_size;
     ierr = PetscFree(pcbddc->global_primal_indices);CHKERRQ(ierr);
   }
 
   /* create local to global scatters for coarse problem */
-  if (pcbddc->new_primal_space) {
+  if (compute_vecs) {
     PetscInt lrows;
     ierr = VecDestroy(&pcbddc->coarse_vec);CHKERRQ(ierr);
     if (coarse_mat_is) {