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

brad at geodynamics.org brad at geodynamics.org
Tue May 28 16:59:51 PDT 2013


Author: brad
Date: 2013-05-28 16:59:51 -0700 (Tue, 28 May 2013)
New Revision: 22158

Modified:
   short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterVTK.cc
Log:
Fixed order of operations in DataWriterVTK::closeTimeStep().

Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterVTK.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterVTK.cc	2013-05-28 23:47:10 UTC (rev 22157)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterVTK.cc	2013-05-28 23:59:51 UTC (rev 22158)
@@ -199,7 +199,7 @@
     
   const std::string& filename = _vtkFilename(t);
 
-  // Create VTK label in DM: Cleared in close().
+  // Create VTK label in DM: Cleared in closeTimeStep().
   if (label) {
     topology::StratumIS cellsIS(_dm, label, labelId);
     const PetscInt ncells = cellsIS.size();
@@ -234,6 +234,15 @@
 
   PetscErrorCode err = 0;
 
+  // Destroy the viewer (which also writes the file).
+  err = PetscViewerDestroy(&_viewer);PYLITH_CHECK_ERROR(err);
+
+  // 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
+  
   // Remove label
   if (_isOpenTimeStep) {
     assert(_dm);
@@ -244,14 +253,7 @@
       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
-  
-  err = PetscViewerDestroy(&_viewer);PYLITH_CHECK_ERROR(err);
+
   _isOpenTimeStep = false;
   _wroteVertexHeader = false;
   _wroteCellHeader = false;



More information about the CIG-COMMITS mailing list