Commits

Matt Knepley committed 6bf20b6

DM: Handle empty vectors correctly for blocksize determination

  • Participants
  • Parent commits 947d2aa

Comments (0)

Files changed (1)

File src/dm/interface/dmi.c

       break;
     }
   }
-  if (blockSize < 0) blockSize = 1;
+  if (blockSize < 0) blockSize = PETSC_MAX_INT;
   ierr = MPI_Allreduce(&blockSize, &bs, 1, MPIU_INT, MPI_MIN, PetscObjectComm((PetscObject)dm));CHKERRQ(ierr);
+  if (blockSize == PETSC_MAX_INT) blockSize = 1; /* Everyone was empty */
   ierr = PetscSectionGetConstrainedStorageSize(gSection, &localSize);CHKERRQ(ierr);
   if (localSize%blockSize) SETERRQ2(PetscObjectComm((PetscObject)dm), PETSC_ERR_ARG_WRONG, "Mismatch between blocksize %d and local storage size %d", blockSize, localSize);
   ierr = VecCreate(PetscObjectComm((PetscObject)dm), vec);CHKERRQ(ierr);