[cig-commits] r22197 - short/3D/PyLith/trunk/libsrc/pylith/meshio
knepley at geodynamics.org
knepley at geodynamics.org
Sun Jun 9 13:15:32 PDT 2013
Author: knepley
Date: 2013-06-09 13:15:32 -0700 (Sun, 09 Jun 2013)
New Revision: 22197
Modified:
short/3D/PyLith/trunk/libsrc/pylith/meshio/CellFilterAvg.cc
Log:
Fix parallel bug in CellFilterAvg, may be present other places
Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/CellFilterAvg.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/CellFilterAvg.cc 2013-06-09 19:47:09 UTC (rev 22196)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/CellFilterAvg.cc 2013-06-09 20:15:32 UTC (rev 22197)
@@ -122,15 +122,15 @@
PetscInt totalFiberDim = (numCells > 0) ? fieldInVisitor.sectionDof(cStart) : 0;
const int fiberDim = totalFiberDim / numQuadPts;
assert(fiberDim * numQuadPts == totalFiberDim);
- // Allocate field if necessary
- if (!_fieldAvg) {
- _fieldAvg = new topology::Field(fieldIn.mesh());assert(_fieldAvg);
+ // The decision to reallocate a field must be collective
+ PetscInt reallocate = ((!_fieldAvg) || (_fieldAvg->sectionSize() != numCells*fiberDim)), reallocateGlobal;
+
+ err = MPI_Allreduce(&reallocate, &reallocateGlobal, 1, MPIU_INT, MPI_LOR, fieldIn.mesh().comm());PYLITH_CHECK_ERROR(err);
+ if (reallocateGlobal) {
+ if (!_fieldAvg) _fieldAvg = new topology::Field(fieldIn.mesh());assert(_fieldAvg);
_fieldAvg->newSection(fieldIn, fiberDim);
_fieldAvg->allocate();
- } else if (_fieldAvg->sectionSize() != numCells*fiberDim) {
- _fieldAvg->newSection(fieldIn, fiberDim);
- _fieldAvg->allocate();
- } // else
+ } // if
assert(_fieldAvg);
switch (fieldIn.vectorFieldType())
More information about the CIG-COMMITS
mailing list