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

brad at geodynamics.org brad at geodynamics.org
Tue May 28 16:47:10 PDT 2013


Author: brad
Date: 2013-05-28 16:47:10 -0700 (Tue, 28 May 2013)
New Revision: 22157

Modified:
   short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterVTK.cc
Log:
Adjust clearing of label.

Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterVTK.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterVTK.cc	2013-05-28 23:22:55 UTC (rev 22156)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterVTK.cc	2013-05-28 23:47:10 UTC (rev 22157)
@@ -232,19 +232,26 @@
 { // closeTimeStep
   PYLITH_METHOD_BEGIN;
 
-  // Account for possibility that no fields were written, so viewer doesn't have handle to DM.
-  if (_isOpenTimeStep && !_wroteVertexHeader && !_wroteCellHeader) {
-    // No fields written, so must manually dereference the mesh DM.
+  PetscErrorCode err = 0;
+
+  // Remove label
+  if (_isOpenTimeStep) {
+    assert(_dm);
     PetscBool hasLabel = PETSC_FALSE;
-    PetscErrorCode err = DMPlexHasLabel(_dm, "vtk", &hasLabel);PYLITH_CHECK_ERROR(err);
+    err = DMPlexHasLabel(_dm, "vtk", &hasLabel);PYLITH_CHECK_ERROR(err);
     if (hasLabel) {
       err = DMPlexClearLabelStratum(_dm, "vtk", 1);PYLITH_CHECK_ERROR(err);
       err = DMPlexClearLabelStratum(_dm, "vtk", 2);PYLITH_CHECK_ERROR(err);
     } // if
+  } // if
+  
+  // Account for possibility that no fields were written, so viewer doesn't have handle to DM.
+  if (_isOpenTimeStep && !_wroteVertexHeader && !_wroteCellHeader) {
+    // No fields written, so must manually dereference the mesh DM.
     err = PetscObjectDereference((PetscObject) _dm);PYLITH_CHECK_ERROR(err);
   } // if
   
-  PetscErrorCode err = PetscViewerDestroy(&_viewer);PYLITH_CHECK_ERROR(err);
+  err = PetscViewerDestroy(&_viewer);PYLITH_CHECK_ERROR(err);
   _isOpenTimeStep = false;
   _wroteVertexHeader = false;
   _wroteCellHeader = false;



More information about the CIG-COMMITS mailing list