[cig-commits] r22199 - short/3D/PyLith/trunk/libsrc/pylith/meshio

brad at geodynamics.org brad at geodynamics.org
Sun Jun 9 14:04:06 PDT 2013


Author: brad
Date: 2013-06-09 14:04:06 -0700 (Sun, 09 Jun 2013)
New Revision: 22199

Modified:
   short/3D/PyLith/trunk/libsrc/pylith/meshio/CellFilterAvg.cc
   short/3D/PyLith/trunk/libsrc/pylith/meshio/OutputSolnPoints.cc
Log:
Fix another bug with using Field::allocate() in noncollective manner in OutputSolnPoints.

Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/CellFilterAvg.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/CellFilterAvg.cc	2013-06-09 20:34:25 UTC (rev 22198)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/CellFilterAvg.cc	2013-06-09 21:04:06 UTC (rev 22199)
@@ -123,11 +123,13 @@
   const int fiberDim = totalFiberDim / numQuadPts;
   assert(fiberDim * numQuadPts == totalFiberDim);
   // The decision to reallocate a field must be collective
-  PetscInt reallocate = ((!_fieldAvg) || (_fieldAvg->sectionSize() != numCells*fiberDim)), reallocateGlobal;
-
+  PetscInt reallocate = ((!_fieldAvg) || (_fieldAvg->sectionSize() != numCells*fiberDim));
+  PetscInt reallocateGlobal = 0;
   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);
+    if (!_fieldAvg) {
+      _fieldAvg = new topology::Field(fieldIn.mesh());assert(_fieldAvg);
+    } // if
     _fieldAvg->newSection(fieldIn, fiberDim);
     _fieldAvg->allocate();
   } // if

Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/OutputSolnPoints.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/OutputSolnPoints.cc	2013-06-09 20:34:25 UTC (rev 22198)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/OutputSolnPoints.cc	2013-06-09 21:04:06 UTC (rev 22199)
@@ -246,7 +246,11 @@
   } // if
 
   topology::Field& fieldInterp = _fields->get(fieldName.c_str());
-  if (numVertices*fiberDim != fieldInterp.sectionSize()) {
+  // The decision to reallocate a field must be collective
+  PetscInt reallocate = numVertices*fiberDim != fieldInterp.sectionSize();
+  PetscInt reallocateGlobal = 0;
+  err = MPI_Allreduce(&reallocate, &reallocateGlobal, 1, MPIU_INT, MPI_LOR, fieldInterp.mesh().comm());PYLITH_CHECK_ERROR(err);
+  if (reallocateGlobal) {
     fieldInterp.newSection(topology::FieldBase::VERTICES_FIELD, fiberDim);
     fieldInterp.allocate();
   } // if



More information about the CIG-COMMITS mailing list