Skip to content

Commit 623eb01

Browse files
committed
FIX: Account for processes without cells in initial condition patch when verifying configuration.
1 parent 9769ce9 commit 623eb01

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

libsrc/pylith/problems/InitialConditionPatch.cc

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,13 @@ pylith::problems::InitialConditionPatch::verifyConfiguration(const pylith::topol
125125

126126
PetscDMLabel dmLabel = NULL;
127127
err = DMGetLabel(solution.getDM(), _labelName.c_str(), &dmLabel);PYLITH_CHECK_ERROR(err);assert(dmLabel);
128-
PetscBool hasValue = PETSC_FALSE;
129-
err = DMLabelHasValue(dmLabel, _labelValue, &hasValue);PYLITH_CHECK_ERROR(err);
130-
if (!hasValue) {
128+
PetscBool hasLabelValue = PETSC_FALSE;
129+
err = DMLabelHasValue(dmLabel, _labelValue, &hasLabelValue);PYLITH_CHECK_ERROR(err);
130+
int hasLabelValueIntLocal = int(hasLabelValue);
131+
int hasLabelValueInt = 0;
132+
err = MPI_Allreduce(&hasLabelValueIntLocal, &hasLabelValueInt, 1, MPI_INT, MPI_MAX,
133+
PetscObjectComm((PetscObject) dmSoln));PYLITH_CHECK_ERROR(err);
134+
if (!hasLabelValueInt) {
131135
std::ostringstream msg;
132136
msg << "Label '" << _labelName << "' missing value '" << _labelValue << "' for initial condition '"
133137
<< PyreComponent::getIdentifier() << "'.";

0 commit comments

Comments
 (0)