[cig-commits] r13326 - in short/3D/PyLith/trunk: libsrc/topology pylith/materials

brad at geodynamics.org brad at geodynamics.org
Mon Nov 17 22:02:17 PST 2008


Author: brad
Date: 2008-11-17 22:02:17 -0800 (Mon, 17 Nov 2008)
New Revision: 13326

Modified:
   short/3D/PyLith/trunk/libsrc/topology/MeshOps.cc
   short/3D/PyLith/trunk/pylith/materials/Material.py
Log:
Fixed bug in reporting error in mismatch between cell material-ids and materials.

Modified: short/3D/PyLith/trunk/libsrc/topology/MeshOps.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/topology/MeshOps.cc	2008-11-18 03:00:11 UTC (rev 13325)
+++ short/3D/PyLith/trunk/libsrc/topology/MeshOps.cc	2008-11-18 06:02:17 UTC (rev 13326)
@@ -71,10 +71,13 @@
   int_array matCellCountsAll(matCellCounts.size());
   MPI_Allreduce(&matCellCounts[0], &matCellCountsAll[0],
 		matCellCounts.size(), MPI_INT, MPI_SUM, mesh->comm());
-  for (int i=0; i < numMaterials; ++i)
-    if (matCellCountsAll[i] <= 0) {
+  for (int i=0; i < numMaterials; ++i) {
+    const int matId = materialIds[i];
+    const int matIndex = materialIndex[matId];
+    assert(0 <= matIndex && matIndex < numMaterials);
+    if (matCellCountsAll[matIndex] <= 0) {
       std::ostringstream msg;
-      msg << "No cells associated with material with id '" << materialIds[i]
+      msg << "No cells associated with material with id '" << matId
 	  << "'.";
       throw std::runtime_error(msg.str());
     } // if

Modified: short/3D/PyLith/trunk/pylith/materials/Material.py
===================================================================
--- short/3D/PyLith/trunk/pylith/materials/Material.py	2008-11-18 03:00:11 UTC (rev 13325)
+++ short/3D/PyLith/trunk/pylith/materials/Material.py	2008-11-18 06:02:17 UTC (rev 13326)
@@ -123,10 +123,6 @@
               "Dimension for material '%s': %d" % \
               (self.quadrature.spaceDim, self.label, self.dimension)
     
-    # :TODO: Make sure mesh contains material (need to account for the
-    # fact that any given processor may only have a subset of the
-    # materials)
-
     self._logger.eventEnd(logEvent)
     return
   



More information about the CIG-COMMITS mailing list