[cig-commits] r22335 - short/3D/PyLith/trunk/libsrc/pylith/topology

knepley at geodynamics.org knepley at geodynamics.org
Mon Jun 17 05:43:25 PDT 2013


Author: knepley
Date: 2013-06-17 05:43:25 -0700 (Mon, 17 Jun 2013)
New Revision: 22335

Modified:
   short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.icc
Log:
Fix check for empty mesh

Modified: short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.icc	2013-06-17 04:40:57 UTC (rev 22334)
+++ short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.icc	2013-06-17 12:43:25 UTC (rev 22335)
@@ -126,15 +126,17 @@
 
   PetscInt numCorners = 0;
   if (_dmMesh) {
-    PetscInt cStart, vStart, vEnd, closureSize, *closure = NULL;
+    PetscInt cStart, cEnd, vStart, vEnd, closureSize, *closure = NULL;
     PetscErrorCode err;
-    err = DMPlexGetHeightStratum(_dmMesh, 0, &cStart, NULL);PYLITH_CHECK_ERROR(err);
+    err = DMPlexGetHeightStratum(_dmMesh, 0, &cStart, &cEnd);PYLITH_CHECK_ERROR(err);
     err = DMPlexGetDepthStratum(_dmMesh, 0, &vStart, &vEnd);PYLITH_CHECK_ERROR(err);
-    err = DMPlexGetTransitiveClosure(_dmMesh, cStart, PETSC_TRUE, &closureSize, &closure);PYLITH_CHECK_ERROR(err);
-    for (PetscInt c = 0; c < closureSize*2; c += 2) {
-      if ((closure[c] >= vStart) && (closure[c] < vEnd)) ++numCorners;
+    if (cEnd > cStart) {
+      err = DMPlexGetTransitiveClosure(_dmMesh, cStart, PETSC_TRUE, &closureSize, &closure);PYLITH_CHECK_ERROR(err);
+      for (PetscInt c = 0; c < closureSize*2; c += 2) {
+        if ((closure[c] >= vStart) && (closure[c] < vEnd)) ++numCorners;
+      }
+      err = DMPlexRestoreTransitiveClosure(_dmMesh, cStart, PETSC_TRUE, &closureSize, &closure);PYLITH_CHECK_ERROR(err);
     }
-    err = DMPlexRestoreTransitiveClosure(_dmMesh, cStart, PETSC_TRUE, &closureSize, &closure);PYLITH_CHECK_ERROR(err);
   } // if
 
   PYLITH_METHOD_RETURN(numCorners);



More information about the CIG-COMMITS mailing list