[cig-commits] r21880 - in short/3D/PyLith/trunk: libsrc/pylith/meshio unittests/libtests/meshio

brad at geodynamics.org brad at geodynamics.org
Wed Apr 17 08:07:45 PDT 2013


Author: brad
Date: 2013-04-17 08:07:45 -0700 (Wed, 17 Apr 2013)
New Revision: 21880

Modified:
   short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5Ext.cc
   short/3D/PyLith/trunk/unittests/libtests/meshio/Makefile.am
   short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5BCMesh.cc
   short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5BCMeshCases.cc
   short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtBCMesh.cc
   short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtBCMeshCases.cc
   short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtFaultMesh.cc
   short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtMatMeshCases.cc
   short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtMesh.cc
   short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtMeshCases.cc
   short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtSubMesh.cc
   short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtSubMeshCases.cc
   short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5FaultMesh.cc
   short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5FaultMeshCases.cc
Log:
Code cleanup.

Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5Ext.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5Ext.cc	2013-04-17 15:07:28 UTC (rev 21879)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5Ext.cc	2013-04-17 15:07:45 UTC (rev 21880)
@@ -50,6 +50,8 @@
 void
 pylith::meshio::DataWriterHDF5Ext<mesh_type,field_type>::deallocate(void)
 { // deallocate
+  PYLITH_METHOD_BEGIN;
+
   DataWriter<mesh_type, field_type>::deallocate();
 
   PetscErrorCode err = 0;
@@ -59,6 +61,8 @@
        ++d_iter) {
     err = PetscViewerDestroy(&d_iter->second.viewer);CHECK_PETSC_ERROR(err);
   } // for
+
+  PYLITH_METHOD_END;
 } // deallocate
   
 // ----------------------------------------------------------------------
@@ -83,11 +87,6 @@
 { // open
   PYLITH_METHOD_BEGIN;
 
-  typedef typename mesh_type::SieveMesh SieveMesh;
-  typedef typename mesh_type::SieveMesh::label_sequence label_sequence;
-  typedef typename mesh_type::SieveMesh::numbering_type numbering_type;
-  typedef typename mesh_type::SieveMesh::sieve_type sieve_type;
-
   assert(_h5);
   _datasets.clear();
 
@@ -95,10 +94,9 @@
     DataWriter<mesh_type, field_type>::open(mesh, numTimeSteps, label, labelId);
     const char* context = DataWriter<mesh_type, field_type>::_context.c_str();
 
-    DM dmMesh = mesh.dmMesh();
-    assert(dmMesh);
-    MPI_Comm       comm;
-    PetscMPIInt    commRank;
+    PetscDM dmMesh = mesh.dmMesh();assert(dmMesh);
+    MPI_Comm comm;
+    PetscMPIInt commRank;
     PetscErrorCode err = PetscObjectGetComm((PetscObject) dmMesh, &comm);CHECK_PETSC_ERROR(err);
 
     err = MPI_Comm_rank(comm, &commRank);CHECK_PETSC_ERROR(err);
@@ -113,90 +111,59 @@
 
     PetscViewer binaryViewer;
     
-    const hid_t scalartype = (sizeof(double) == sizeof(PylithScalar)) ? 
-      H5T_IEEE_F64BE : H5T_IEEE_F32BE;
+    const hid_t scalartype = (sizeof(double) == sizeof(PylithScalar)) ? H5T_IEEE_F64BE : H5T_IEEE_F32BE;
 
     // Write vertex coordinates
-    const spatialdata::geocoords::CoordSys* cs = mesh.coordsys();
-    assert(cs);
-#if 0
-    const ALE::Obj<typename mesh_type::RealSection>& coordinatesSection = 
-      sieveMesh->hasRealSection("coordinates_dimensioned") ?
-      sieveMesh->getRealSection("coordinates_dimensioned") :
-      sieveMesh->getRealSection("coordinates");
-    assert(!coordinatesSection.isNull());
-    topology::FieldBase::Metadata metadata;
-    // :KLUDGE: We would like to use field_type for the coordinates
-    // field. However, the mesh coordinates are Field<mesh_type> and
-    // field_type can be Field<Mesh> (e.g., displacement field over a
-    // SubMesh).
-    topology::Field<mesh_type> coordinates(mesh, coordinatesSection, metadata);
-    coordinates.label("vertices");
-    ALE::Obj<numbering_type> vNumbering = 
-      sieveMesh->hasLabel("censored depth") ?
-      sieveMesh->getFactory()->getNumbering(sieveMesh, "censored depth", 0) :
-      sieveMesh->getFactory()->getNumbering(sieveMesh, 0);
-    assert(!vNumbering.isNull());
-    coordinates.createScatterWithBC(mesh, vNumbering, context);
-    coordinates.scatterSectionToVector(context);
-    PetscVec coordinatesVector = coordinates.vector(context);
-    assert(coordinatesVector);
-#else
-    PetscSection coordSection;
-    Vec          coordinates, coordinatesVector;
-    PetscReal    lengthScale;
-    PetscInt     vStart, vEnd, vMax, verticesSize, globalSize, dim, dimLocal = 0;
+    const spatialdata::geocoords::CoordSys* cs = mesh.coordsys();assert(cs);
 
+    PetscSection coordSection = NULL;
+    PetscVec coordinates = NULL;
+    PetscReal lengthScale;
+    PetscInt vStart, vEnd, vMax, verticesSize, globalSize, dim, dimLocal = 0;
+
     /* TODO Get rid of this and use the createScatterWithBC(numbering) code */
     err = DMPlexGetScale(dmMesh, PETSC_UNIT_LENGTH, &lengthScale);CHECK_PETSC_ERROR(err);
     err = DMPlexGetCoordinateSection(dmMesh, &coordSection);CHECK_PETSC_ERROR(err);
     err = DMGetCoordinatesLocal(dmMesh, &coordinates);CHECK_PETSC_ERROR(err);
     err = DMPlexGetDepthStratum(dmMesh, 0, &vStart, &vEnd);CHECK_PETSC_ERROR(err);
     err = DMPlexGetHybridBounds(dmMesh, PETSC_NULL, PETSC_NULL, PETSC_NULL, &vMax);CHECK_PETSC_ERROR(err);
-    if (vMax >= 0) {vEnd = PetscMin(vEnd, vMax);}
+    if (vMax >= 0) {
+      vEnd = PetscMin(vEnd, vMax);
+    } // if
     for(PetscInt vertex = vStart; vertex < vEnd; ++vertex) {
       err = PetscSectionGetDof(coordSection, vertex, &dimLocal);CHECK_PETSC_ERROR(err);
       if (dimLocal) break;
-    }
+    } // for
     err = MPI_Allreduce(&dimLocal, &dim, 1, MPIU_INT, MPI_MAX, comm);CHECK_PETSC_ERROR(err);
     verticesSize = vEnd - vStart;
 
-    PetscVec     coordVec;
-    PetscScalar *coords, *c;
+    PetscVec coordVec = NULL;
+    PetscScalar *coordsArray = NULL, *cArray = NULL;
 
     err = VecCreate(comm, &coordVec);CHECK_PETSC_ERROR(err);
     err = VecSetSizes(coordVec, verticesSize*dim, PETSC_DETERMINE);CHECK_PETSC_ERROR(err);
     err = VecSetBlockSize(coordVec, dim);CHECK_PETSC_ERROR(err);
     err = VecSetFromOptions(coordVec);CHECK_PETSC_ERROR(err);
-    err = VecGetArray(coordVec, &coords);CHECK_PETSC_ERROR(err);
-    err = VecGetArray(coordinates, &c);CHECK_PETSC_ERROR(err);
+    err = VecGetArray(coordVec, &coordsArray);CHECK_PETSC_ERROR(err);
+    err = VecGetArray(coordinates, &cArray);CHECK_PETSC_ERROR(err);
     for(PetscInt v = 0; v < vEnd - vStart; ++v) {
       for(PetscInt d = 0; d < dim; ++d) {
-          coords[v*dim+d] = c[v*dim+d];
-      }
-    }
-    err = VecRestoreArray(coordVec, &coords);CHECK_PETSC_ERROR(err);
-    err = VecRestoreArray(coordinates, &c);CHECK_PETSC_ERROR(err);
+          coordsArray[v*dim+d] = cArray[v*dim+d];
+      } // for
+    } // for
+    err = VecRestoreArray(coordVec, &coordsArray);CHECK_PETSC_ERROR(err);
+    err = VecRestoreArray(coordinates, &cArray);CHECK_PETSC_ERROR(err);
     err = VecScale(coordVec, lengthScale);CHECK_PETSC_ERROR(err);
     err = PetscObjectSetName((PetscObject) coordVec, "vertices");CHECK_PETSC_ERROR(err);
     err = VecGetSize(coordVec, &globalSize);CHECK_PETSC_ERROR(err);
     globalSize /= cs->spaceDim();
-    coordinatesVector = coordVec;
-#endif
 
     const std::string& filenameVertices = _datasetFilename("vertices");
-    err = PetscViewerBinaryOpen(comm, filenameVertices.c_str(),
-				FILE_MODE_WRITE,
-				&binaryViewer);
-    CHECK_PETSC_ERROR(err);
-    err = PetscViewerBinarySetSkipHeader(binaryViewer, PETSC_TRUE);
-    CHECK_PETSC_ERROR(err);
-    err = VecView(coordinatesVector, binaryViewer); CHECK_PETSC_ERROR(err);
+    err = PetscViewerBinaryOpen(comm, filenameVertices.c_str(), FILE_MODE_WRITE, &binaryViewer);CHECK_PETSC_ERROR(err);
+    err = PetscViewerBinarySetSkipHeader(binaryViewer, PETSC_TRUE);CHECK_PETSC_ERROR(err);
+    err = VecView(coordVec, binaryViewer); CHECK_PETSC_ERROR(err);
     err = PetscViewerDestroy(&binaryViewer); CHECK_PETSC_ERROR(err);
-
-#if 1
-    err = VecDestroy(&coordinatesVector);CHECK_PETSC_ERROR(err);
-#endif
+    err = VecDestroy(&coordVec);CHECK_PETSC_ERROR(err);
     
     // Create external dataset for coordinates    
     if (!commRank) {
@@ -204,98 +171,33 @@
       hsize_t dims[ndims];
       dims[0] = globalSize;
       dims[1] = cs->spaceDim();
-      _h5->createDatasetRawExternal("/geometry", "vertices", 
-				    filenameVertices.c_str(),
-				    dims, ndims, scalartype);
+      _h5->createDatasetRawExternal("/geometry", "vertices", filenameVertices.c_str(), dims, ndims, scalartype);
     } // if
     
     // Write cells
 
     // Account for censored cells
-#if 0
-    int cellDepthLocal = (sieveMesh->depth() == -1) ? -1 : 1;
-    int cellDepth = 0;
-    err = MPI_Allreduce(&cellDepthLocal, &cellDepth, 1, MPI_INT, MPI_MAX, comm);CHECK_PETSC_ERROR(err);
-    const int depth = (0 == label) ? cellDepth : labelId;
-    const std::string labelName = (0 == label) ?
-      ((sieveMesh->hasLabel("censored depth")) ?
-       "censored depth" : "depth") : label;
-    assert(!sieveMesh->getFactory().isNull());
-    const ALE::Obj<numbering_type>& cNumbering = 
-      sieveMesh->getFactory()->getNumbering(sieveMesh, labelName, depth);
-    assert(!cNumbering.isNull());
-    const ALE::Obj<label_sequence>& cells =
-      sieveMesh->getLabelStratum(labelName, depth);
-    assert(!cells.isNull());
-    int numCornersLocal = 0;
-    if (cells->size() > 0)
-      numCornersLocal = sieveMesh->getNumCellCorners(*cells->begin());
-    int numCorners = numCornersLocal;
-    err = MPI_Allreduce(&numCornersLocal, &numCorners, 1, MPI_INT, MPI_MAX, comm); CHECK_PETSC_ERROR(err);
-
-    PylithScalar* tmpVertices = 0;
-    const int ncells = cNumbering->getLocalSize();
-    const int conesSize = ncells*numCorners;
-    err = PetscMalloc(sizeof(PylithScalar)*conesSize, &tmpVertices);
-    CHECK_PETSC_ERROR(err);
-
-    const Obj<sieve_type>& sieve = sieveMesh->getSieve();
-    assert(!sieve.isNull());
-    const int closureSize = 
-      int(pow(sieve->getMaxConeSize(), sieveMesh->depth()));
-    assert(closureSize >= 0);
-    ALE::ISieveVisitor::NConeRetriever<sieve_type> ncV(*sieve, closureSize);
-    
-    int k = 0;
-    const typename label_sequence::const_iterator cellsEnd = cells->end();
-    for (typename label_sequence::iterator c_iter=cells->begin();
-         c_iter != cellsEnd;
-         ++c_iter) {
-      if (cNumbering->isLocal(*c_iter)) {
-        ncV.clear();
-        ALE::ISieveTraversal<sieve_type>::orientedClosure(*sieve, *c_iter, ncV);
-        const typename ALE::ISieveVisitor::NConeRetriever<sieve_type>::oriented_point_type* cone =
-          ncV.getOrientedPoints();
-        const int coneSize = ncV.getOrientedSize();
-        if (coneSize != numCorners) {
-          const char *name;
-          std::ostringstream msg;
-          err = PetscObjectGetName((PetscObject) dmMesh, &name);CHECK_PETSC_ERROR(err);
-          msg << "Inconsistency in topology found for mesh '" << name << "' during output.\n"
-              << "Number of vertices (" << coneSize << ") in cell '" << c
-              << "' does not expected number of vertices (" << numCorners << ").";
-          throw std::runtime_error(msg.str());
-        } // if
-        for(PetscInt c=0; c < coneSize; ++c)
-          tmpVertices[k++] = vNumbering->getIndex(cone[c].first);
-      } // if
-    }
-    PetscVec elemVec;
-
-    err = VecCreateMPIWithArray(comm, numCorners, conesSize, PETSC_DETERMINE,
-                                tmpVertices, &elemVec); CHECK_PETSC_ERROR(err);
-    err = PetscObjectSetName((PetscObject) elemVec, "cells");CHECK_PETSC_ERROR(err);
-#else
     PetscInt cStart, cEnd, cMax, dof, conesSize, numCells, numCorners, numCornersLocal = 0;
-
     err = DMPlexGetDepthStratum(dmMesh, 0, &vStart, &vEnd);CHECK_PETSC_ERROR(err);
     err = DMPlexGetHeightStratum(dmMesh, 0, &cStart, &cEnd);CHECK_PETSC_ERROR(err);
     err = DMPlexGetHybridBounds(dmMesh, &cMax, PETSC_NULL, PETSC_NULL, PETSC_NULL);CHECK_PETSC_ERROR(err);
-    if (cMax >= 0) {cEnd = PetscMin(cEnd, cMax);}
+    if (cMax >= 0) {
+      cEnd = PetscMin(cEnd, cMax);
+    } // if
     for(PetscInt cell = cStart; cell < cEnd; ++cell) {
-      PetscInt *closure = PETSC_NULL;
-      PetscInt  closureSize, v;
+      PetscInt *closure = NULL;
+      PetscInt closureSize, v;
 
       err = DMPlexGetTransitiveClosure(dmMesh, cell, PETSC_TRUE, &closureSize, &closure);CHECK_PETSC_ERROR(err);
       numCornersLocal = 0;
       for (v = 0; v < closureSize*2; v += 2) {
         if ((closure[v] >= vStart) && (closure[v] < vEnd)) {
           ++numCornersLocal;
-        }
-      }
+        } // if
+      } // for
       err = DMPlexRestoreTransitiveClosure(dmMesh, cell, PETSC_TRUE, &closureSize, &closure);CHECK_PETSC_ERROR(err);
       if (numCornersLocal) break;
-    }
+    } // for
     err = MPI_Allreduce(&numCornersLocal, &numCorners, 1, MPIU_INT, MPI_MAX, comm);CHECK_PETSC_ERROR(err);
     if (label) {
       conesSize = 0;
@@ -304,17 +206,17 @@
 
         err = DMPlexGetLabelValue(dmMesh, label, cell, &value);CHECK_PETSC_ERROR(err);
         if (value == labelId) ++conesSize;
-      }
+      } // for
       conesSize *= numCorners;
     } else {
       conesSize = (cEnd - cStart)*numCorners;
-    }
+    } // if/else
     CHKMEMA;
 
-    IS              globalVertexNumbers;
-    const PetscInt *gvertex = PETSC_NULL;
-    PetscVec        cellVec, elemVec;
-    PetscScalar    *vertices;
+    PetscIS globalVertexNumbers = NULL;
+    const PetscInt *gvertex = NULL;
+    PetscVec cellVec = NULL;
+    PetscScalar *vertices = NULL;
 
     err = DMPlexGetVertexNumbering(dmMesh, &globalVertexNumbers);CHECK_PETSC_ERROR(err);
     err = ISGetIndices(globalVertexNumbers, &gvertex);CHECK_PETSC_ERROR(err);
@@ -325,41 +227,37 @@
     err = PetscObjectSetName((PetscObject) cellVec, "cells");CHECK_PETSC_ERROR(err);
     err = VecGetArray(cellVec, &vertices);CHECK_PETSC_ERROR(err);
     for(PetscInt cell = cStart, v = 0; cell < cEnd; ++cell) {
-      PetscInt *closure = PETSC_NULL;
-      PetscInt  closureSize, p;
+      PetscInt *closure = NULL;
+      PetscInt closureSize, p;
 
       if (label) {
         PetscInt value;
 
         err = DMPlexGetLabelValue(dmMesh, label, cell, &value);CHECK_PETSC_ERROR(err);
-        if (value != labelId) continue;
-      }
+        if (value != labelId)
+	  continue;
+      } // if
       err = DMPlexGetTransitiveClosure(dmMesh, cell, PETSC_TRUE, &closureSize, &closure);CHECK_PETSC_ERROR(err);
       for(p = 0; p < closureSize*2; p += 2) {
         if ((closure[p] >= vStart) && (closure[p] < vEnd)) {
           const PetscInt gv = gvertex[closure[p] - vStart];
           vertices[v++] = gv < 0 ? -(gv+1) : gv;
-        }
-      }
+        } // if
+      } // for
       err = DMPlexRestoreTransitiveClosure(dmMesh, cell, PETSC_TRUE, &closureSize, &closure);CHECK_PETSC_ERROR(err);
       //assert(v == (cell-cStart+1)*numCorners);
-    }
+    } // for
     CHKMEMA;
+    err = ISRestoreIndices(globalVertexNumbers, &gvertex);CHECK_PETSC_ERROR(err);
     err = VecRestoreArray(cellVec, &vertices);CHECK_PETSC_ERROR(err);
     err = VecGetSize(cellVec, &numCells);CHECK_PETSC_ERROR(err);
     numCells /= numCorners;
-    elemVec = cellVec;
-#endif
 
     const std::string& filenameCells = _datasetFilename("cells");
-    err = PetscViewerBinaryOpen(comm, filenameCells.c_str(),
-                                FILE_MODE_WRITE, &binaryViewer);CHECK_PETSC_ERROR(err);
+    err = PetscViewerBinaryOpen(comm, filenameCells.c_str(), FILE_MODE_WRITE, &binaryViewer);CHECK_PETSC_ERROR(err);
     err = PetscViewerBinarySetSkipHeader(binaryViewer, PETSC_TRUE);CHECK_PETSC_ERROR(err);
-    err = VecView(elemVec, binaryViewer);CHECK_PETSC_ERROR(err);
-    err = VecDestroy(&elemVec);CHECK_PETSC_ERROR(err);
-#if 0
-    err = PetscFree(tmpVertices);CHECK_PETSC_ERROR(err);
-#endif
+    err = VecView(cellVec, binaryViewer);CHECK_PETSC_ERROR(err);
+    err = VecDestroy(&cellVec);CHECK_PETSC_ERROR(err);
     err = PetscViewerDestroy(&binaryViewer);CHECK_PETSC_ERROR(err);
 
     // Create external dataset for cells
@@ -382,6 +280,8 @@
     msg << "Unknown error while opening HDF5 file " << _filename << ".\n";
     throw std::runtime_error(msg.str());
   } // try/catch
+
+  PYLITH_METHOD_END;
 } // open
 
 // ----------------------------------------------------------------------
@@ -390,6 +290,8 @@
 void
 pylith::meshio::DataWriterHDF5Ext<mesh_type,field_type>::close(void)
 { // close
+  PYLITH_METHOD_BEGIN;
+
   DataWriter<mesh_type, field_type>::_context = "";
 
   if (_h5->isOpen()) {
@@ -407,51 +309,45 @@
     std::string xdmfFilename = std::string(hdf5filename, 0, indexExt) + ".xmf";
     metafile.write(xdmfFilename.c_str(), _hdf5Filename().c_str());
   } // if
+
+  PYLITH_METHOD_END;
 } // close
 
 // ----------------------------------------------------------------------
 // Write field over vertices to file.
 template<typename mesh_type, typename field_type>
 void
-pylith::meshio::DataWriterHDF5Ext<mesh_type,field_type>::writeVertexField(
-				            const PylithScalar t,
-					    field_type& field,
-					    const mesh_type& mesh)
+pylith::meshio::DataWriterHDF5Ext<mesh_type,field_type>::writeVertexField(const PylithScalar t,
+									  field_type& field,
+									  const mesh_type& mesh)
 { // writeVertexField
-  typedef typename mesh_type::SieveMesh::numbering_type numbering_type;
-
+  PYLITH_METHOD_BEGIN;
+  
   assert(_h5);
 
   try {
     const char* context = DataWriter<mesh_type, field_type>::_context.c_str();
 
-    DM             dmMesh = mesh.dmMesh();
-    MPI_Comm       comm;
-    PetscMPIInt    commRank;
+    PetscDM dmMesh = mesh.dmMesh();assert(dmMesh);
+    MPI_Comm comm;
+    PetscMPIInt commRank;
     PetscErrorCode err;
 
-    assert(dmMesh);
     err = PetscObjectGetComm((PetscObject) dmMesh, &comm);CHECK_PETSC_ERROR(err);
     err = MPI_Comm_rank(comm, &commRank);CHECK_PETSC_ERROR(err);
     field.createScatterWithBC(mesh, "", 0, context);
     field.scatterSectionToVector(context);
-    PetscVec vector = field.vector(context);
-    assert(vector);
 
     PetscViewer binaryViewer;
 
-    const hid_t scalartype = (sizeof(double) == sizeof(PylithScalar)) ? 
-      H5T_IEEE_F64BE : H5T_IEEE_F32BE;
+    const hid_t scalartype = (sizeof(double) == sizeof(PylithScalar)) ? H5T_IEEE_F64BE : H5T_IEEE_F32BE;
 
     // Create external dataset if necessary
     bool createdExternalDataset = false;
     if (_datasets.find(field.label()) != _datasets.end()) {
       binaryViewer = _datasets[field.label()].viewer;
     } else {
-      err = PetscViewerBinaryOpen(comm, 
-                                  _datasetFilename(field.label()).c_str(),
-                                  FILE_MODE_WRITE, &binaryViewer);
-      CHECK_PETSC_ERROR(err);
+      err = PetscViewerBinaryOpen(comm, _datasetFilename(field.label()).c_str(), FILE_MODE_WRITE, &binaryViewer);CHECK_PETSC_ERROR(err);
       err = PetscViewerBinarySetSkipHeader(binaryViewer, PETSC_TRUE);CHECK_PETSC_ERROR(err);
       ExternalDataset dataset;
       dataset.numTimeSteps = 0;
@@ -462,30 +358,30 @@
     } // else
     assert(binaryViewer);
 
+    PetscVec vector = field.vector(context);assert(vector);
     err = VecView(vector, binaryViewer);CHECK_PETSC_ERROR(err);
     ++_datasets[field.label()].numTimeSteps;
 
-    DM           dm;
-    PetscSection section;// = field.petscSection();
-    PetscInt     dof     = 0, n, numLocalVertices = 0, numVertices, vStart;
-    IS           globalVertexNumbers;
+    PetscDM dm = NULL;
+    PetscSection section = NULL;
+    PetscInt dof = 0, n, numLocalVertices = 0, numVertices, vStart;
+    PetscIS globalVertexNumbers = NULL;
 
     err = VecGetDM(vector, &dm);CHECK_PETSC_ERROR(err);
-    err = DMGetDefaultSection(dm, &section);CHECK_PETSC_ERROR(err);
-    assert(section);
+    err = DMGetDefaultSection(dm, &section);CHECK_PETSC_ERROR(err);assert(section);
 
     err = DMPlexGetDepthStratum(dmMesh, 0, &vStart, PETSC_NULL);CHECK_PETSC_ERROR(err);
     err = DMPlexGetVertexNumbering(dmMesh, &globalVertexNumbers);CHECK_PETSC_ERROR(err);
     err = ISGetSize(globalVertexNumbers, &n);CHECK_PETSC_ERROR(err);
     if (n > 0) {
-      const PetscInt *indices;
+      const PetscInt *indices = NULL;
       err = ISGetIndices(globalVertexNumbers, &indices);CHECK_PETSC_ERROR(err);
       err = PetscSectionGetDof(section, vStart, &dof);CHECK_PETSC_ERROR(err);
       for(PetscInt v = 0; v < n; ++v) {
         if (indices[v] >= 0) ++numLocalVertices;
-      }
+      } // for
       err = ISRestoreIndices(globalVertexNumbers, &indices);CHECK_PETSC_ERROR(err);
-    }
+    } // for
     int fiberDimLocal = dof;
     int fiberDim = 0;
     err = MPI_Allreduce(&fiberDimLocal, &fiberDim, 1, MPI_INT, MPI_MAX, comm);CHECK_PETSC_ERROR(err);
@@ -510,12 +406,9 @@
         if (!_h5->hasGroup("/vertex_fields"))
           _h5->createGroup("/vertex_fields");
 	
-        _h5->createDatasetRawExternal("/vertex_fields", field.label(),
-                                      _datasetFilename(field.label()).c_str(),
-                                      maxDims, ndims, scalartype);
+        _h5->createDatasetRawExternal("/vertex_fields", field.label(), _datasetFilename(field.label()).c_str(), maxDims, ndims, scalartype);
         std::string fullName = std::string("/vertex_fields/") + field.label();
-        _h5->writeAttribute(fullName.c_str(), "vector_field_type",
-                            topology::FieldBase::vectorFieldString(field.vectorFieldType()));
+        _h5->writeAttribute(fullName.c_str(), "vector_field_type", topology::FieldBase::vectorFieldString(field.vectorFieldType()));
       } else {
         // Update number of time steps in external dataset info in HDF5 file.
         const int totalNumTimeSteps = 
@@ -528,8 +421,7 @@
         dims[0] = numTimeSteps; // update to current value
         dims[1] = numVertices;
         dims[2] = fiberDim;
-        _h5->extendDatasetRawExternal("/vertex_fields", field.label(),
-                                      dims, ndims);
+        _h5->extendDatasetRawExternal("/vertex_fields", field.label(), dims, ndims);
       } // if/else
       // Update time stamp in "/time, if necessary.
       if (_tstampIndex+1 == _datasets[field.label()].numTimeSteps)
@@ -547,52 +439,46 @@
 	<< t << " for HDF5 file '" << _filename << "'.\n";
     throw std::runtime_error(msg.str());
   } // try/catch
+
+  PYLITH_METHOD_END;
 } // writeVertexField
 
 // ----------------------------------------------------------------------
 // Write field over cells to file.
 template<typename mesh_type, typename field_type>
 void
-pylith::meshio::DataWriterHDF5Ext<mesh_type,field_type>::writeCellField(
-				       const PylithScalar t,
-				       field_type& field,
-				       const char* label,
-				       const int labelId)
+pylith::meshio::DataWriterHDF5Ext<mesh_type,field_type>::writeCellField(const PylithScalar t,
+									field_type& field,
+									const char* label,
+									const int labelId)
 { // writeCellField
-  typedef typename mesh_type::SieveMesh::numbering_type numbering_type;
+  PYLITH_METHOD_BEGIN;
 
   assert(_h5);
 
   try {
     const char* context = DataWriter<mesh_type, field_type>::_context.c_str();
 
-    DM             dmMesh = field.mesh().dmMesh();
-    MPI_Comm       comm;
-    PetscMPIInt    commRank;
+    PetscDM dmMesh = field.mesh().dmMesh();assert(dmMesh);
+    MPI_Comm comm;
+    PetscMPIInt commRank;
     PetscErrorCode err;
 
-    assert(dmMesh);
     err = PetscObjectGetComm((PetscObject) dmMesh, &comm);CHECK_PETSC_ERROR(err);
     err = MPI_Comm_rank(comm, &commRank);CHECK_PETSC_ERROR(err);
     field.createScatterWithBC(field.mesh(), label ? label : "", labelId, context);
     field.scatterSectionToVector(context);
-    PetscVec vector = field.vector(context);
-    assert(vector);
 
     PetscViewer binaryViewer;
 
-    const hid_t scalartype = (sizeof(double) == sizeof(PylithScalar)) ? 
-      H5T_IEEE_F64BE : H5T_IEEE_F32BE;
+    const hid_t scalartype = (sizeof(double) == sizeof(PylithScalar)) ? H5T_IEEE_F64BE : H5T_IEEE_F32BE;
 
     // Create external dataset if necessary
     bool createdExternalDataset = false;
     if (_datasets.find(field.label()) != _datasets.end()) {
       binaryViewer = _datasets[field.label()].viewer;
     } else {
-      err = PetscViewerBinaryOpen(comm,
-                                  _datasetFilename(field.label()).c_str(),
-                                  FILE_MODE_WRITE, &binaryViewer);
-      CHECK_PETSC_ERROR(err);
+      err = PetscViewerBinaryOpen(comm, _datasetFilename(field.label()).c_str(), FILE_MODE_WRITE, &binaryViewer);CHECK_PETSC_ERROR(err);
       err = PetscViewerBinarySetSkipHeader(binaryViewer, PETSC_TRUE);CHECK_PETSC_ERROR(err);
       ExternalDataset dataset;
       dataset.numTimeSteps = 0;
@@ -603,18 +489,18 @@
     } // else
     assert(binaryViewer);
 
+    PetscVec vector = field.vector(context);assert(vector);
     err = VecView(vector, binaryViewer);CHECK_PETSC_ERROR(err);
     ++_datasets[field.label()].numTimeSteps;
 
-    PetscSection section = field.petscSection();
-    PetscInt     dof     = 0, n, numLocalCells = 0, numCells, cellHeight, cStart, cEnd;
-    IS           globalCellNumbers;
+    PetscSection section = field.petscSection();assert(section);
+    PetscInt dof = 0, n, numLocalCells = 0, numCells, cellHeight, cStart, cEnd;
+    PetscIS globalCellNumbers;
 
-    assert(section);
     err = DMPlexGetVTKCellHeight(dmMesh, &cellHeight);CHECK_PETSC_ERROR(err);
     err = DMPlexGetHeightStratum(dmMesh, cellHeight, &cStart, &cEnd);CHECK_PETSC_ERROR(err);
     if (label) {
-      IS pointIS;
+      PetscIS pointIS;
 
       DMPlexGetStratumIS(dmMesh, label, labelId, &pointIS);CHECK_PETSC_ERROR(err);
       err = ISGetLocalSize(pointIS, &n);CHECK_PETSC_ERROR(err);
@@ -625,24 +511,24 @@
           if ((indices[c] >= cStart) && (indices[c] < cEnd)) {
             err = PetscSectionGetDof(section, indices[0], &dof);CHECK_PETSC_ERROR(err);
             ++numLocalCells;
-          }
-        }
+          } // if
+        } // for
         err = ISRestoreIndices(pointIS, &indices);CHECK_PETSC_ERROR(err);
-      }
+      } // if
       err = ISDestroy(&pointIS);CHECK_PETSC_ERROR(err);
     } else {
       err = DMPlexGetCellNumbering(dmMesh, &globalCellNumbers);CHECK_PETSC_ERROR(err);
       err = ISGetLocalSize(globalCellNumbers, &n);CHECK_PETSC_ERROR(err);
       if (n > 0) {
-        const PetscInt *indices;
+        const PetscInt *indices = NULL;
         err = ISGetIndices(globalCellNumbers, &indices);CHECK_PETSC_ERROR(err);
         err = PetscSectionGetDof(section, cStart, &dof);CHECK_PETSC_ERROR(err);
         for(PetscInt v = 0; v < n; ++v) {
           if (indices[v] >= 0) ++numLocalCells;
-        }
+        } // for
         err = ISRestoreIndices(globalCellNumbers, &indices);CHECK_PETSC_ERROR(err);
-      }
-    }
+      } // if
+    } // if/else
     int fiberDimLocal = dof;
     int fiberDim = 0;
     MPI_Allreduce(&fiberDimLocal, &fiberDim, 1, MPI_INT, MPI_MAX, comm);
@@ -669,9 +555,7 @@
         if (!_h5->hasGroup("/cell_fields"))
           _h5->createGroup("/cell_fields");
 	
-        _h5->createDatasetRawExternal("/cell_fields", field.label(),
-                                      _datasetFilename(field.label()).c_str(),
-                                      maxDims, ndims, scalartype);
+        _h5->createDatasetRawExternal("/cell_fields", field.label(), _datasetFilename(field.label()).c_str(), maxDims, ndims, scalartype);
         std::string fullName = std::string("/cell_fields/") + field.label();
         _h5->writeAttribute(fullName.c_str(), "vector_field_type",
                             topology::FieldBase::vectorFieldString(field.vectorFieldType()));
@@ -705,6 +589,8 @@
 	<< t << " for HDF5 file '" << _filename << "'.\n";
     throw std::runtime_error(msg.str());
   } // try/catch
+
+  PYLITH_METHOD_END;
 } // writeCellField
 
 // ----------------------------------------------------------------------
@@ -713,6 +599,8 @@
 std::string
 pylith::meshio::DataWriterHDF5Ext<mesh_type,field_type>::_hdf5Filename(void) const
 { // _hdf5Filename
+  PYLITH_METHOD_BEGIN;
+
   std::ostringstream filename;
   const int indexExt = _filename.find(".h5");
   const int numTimeSteps = DataWriter<mesh_type, field_type>::_numTimeSteps;
@@ -722,7 +610,7 @@
     filename << _filename;
   } // if/else
 
-  return std::string(filename.str());
+  PYLITH_METHOD_RETURN(std::string(filename.str()));
 } // _hdf5Filename
 
 // ----------------------------------------------------------------------
@@ -731,12 +619,14 @@
 std::string
 pylith::meshio::DataWriterHDF5Ext<mesh_type,field_type>::_datasetFilename(const char* field) const
 { // _datasetFilename
+  PYLITH_METHOD_BEGIN;
+
   std::ostringstream filenameS;
   std::string filenameH5 = _hdf5Filename();
   const int indexExt = filenameH5.find(".h5");
   filenameS << std::string(filenameH5, 0, indexExt) << "_" << field << ".dat";
 
-  return std::string(filenameS.str());
+  PYLITH_METHOD_RETURN(std::string(filenameS.str()));
 } // _datasetFilename
 
 // ----------------------------------------------------------------------
@@ -746,11 +636,12 @@
 pylith::meshio::DataWriterHDF5Ext<mesh_type,field_type>::_writeTimeStamp(
 						  const PylithScalar t)
 { // _writeTimeStamp
+  PYLITH_METHOD_BEGIN;
+
   assert(_h5);
 
   const int ndims = 3;
-  const hid_t scalartype = (sizeof(double) == sizeof(PylithScalar)) ? 
-    H5T_NATIVE_DOUBLE : H5T_NATIVE_FLOAT;
+  const hid_t scalartype = (sizeof(double) == sizeof(PylithScalar)) ? H5T_NATIVE_DOUBLE : H5T_NATIVE_FLOAT;
 
   // Each time stamp has a size of 1.
   hsize_t dimsChunk[3]; // Use 3 dims for compatibility with PETSc viewer
@@ -765,8 +656,7 @@
     dims[0] = H5S_UNLIMITED;
     dims[1] = 1;
     dims[2] = 1;
-    _h5->createDataset("/", "time", dims, dimsChunk, ndims, 
-		       scalartype);
+    _h5->createDataset("/", "time", dims, dimsChunk, ndims, scalartype);
   } // if
   
   // Write time stamp as chunk to HDF5 file.
@@ -776,12 +666,12 @@
   dims[1] = 1;
   dims[2] = 1;
   const PylithScalar tDim = t * DataWriter<mesh_type, field_type>::_timeScale;
-  _h5->writeDatasetChunk("/", "time", &tDim, dims, dimsChunk, ndims, 
-			 _tstampIndex, scalartype);
+  _h5->writeDatasetChunk("/", "time", &tDim, dims, dimsChunk, ndims, _tstampIndex, scalartype);
   
   _tstampIndex++;
+
+  PYLITH_METHOD_END;
 } // _writeTimeStamp
 
 
-
 // End of file 

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/Makefile.am	2013-04-17 15:07:28 UTC (rev 21879)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/Makefile.am	2013-04-17 15:07:45 UTC (rev 21880)
@@ -35,26 +35,27 @@
 	TestDataWriterMesh.cc \
 	TestDataWriterSubMesh.cc \
 	TestDataWriterBCMesh.cc \
-	TestDataWriterFaultMesh.cc \
 	TestDataWriterVTK.cc \
 	TestDataWriterVTKMesh.cc \
 	TestDataWriterVTKMeshCases.cc \
 	TestDataWriterVTKMatMeshCases.cc \
+	TestDataWriterVTKSubMesh.cc \
+	TestDataWriterVTKSubMeshCases.cc \
 	TestDataWriterVTKBCMesh.cc \
 	TestDataWriterVTKBCMeshCases.cc \
-	TestDataWriterVTKSubMesh.cc \
-	TestDataWriterVTKSubMeshCases.cc \
+	TestDataWriterPoints.cc \
+	TestDataWriterVTKPoints.cc \
+	TestDataWriterVTKPointsCases.cc \
+	TestDataWriterFaultMesh.cc \
+	TestDataWriterVTKFaultMesh.cc \
+	TestDataWriterVTKFaultMeshCases.cc \
 	TestOutputManager.cc \
 	TestOutputSolnSubset.cc \
 	TestOutputSolnPoints.cc \
-	TestDataWriterVTKFaultMesh.cc \
-	TestDataWriterVTKFaultMeshCases.cc \
-	TestDataWriterPoints.cc \
-	TestDataWriterVTKPoints.cc \
-	TestDataWriterVTKPointsCases.cc \
 	test_meshio.cc
 
 
+
 noinst_HEADERS = \
 	TestMeshIO.hh \
 	TestMeshIOAscii.hh \
@@ -277,7 +278,6 @@
 	TestDataWriterHDF5ExtFaultMeshCases.cc \
 	TestXdmf.cc
 
-
   noinst_HEADERS += \
 	TestHDF5.hh \
 	TestDataWriterHDF5.hh \

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5BCMesh.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5BCMesh.cc	2013-04-17 15:07:28 UTC (rev 21879)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5BCMesh.cc	2013-04-17 15:07:45 UTC (rev 21880)
@@ -40,7 +40,11 @@
 void
 pylith::meshio::TestDataWriterHDF5BCMesh::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterBCMesh::setUp();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 // ----------------------------------------------------------------------
@@ -48,7 +52,11 @@
 void
 pylith::meshio::TestDataWriterHDF5BCMesh::tearDown(void)
 { // tearDown
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterBCMesh::tearDown();
+
+  PYLITH_METHOD_END;
 } // tearDown
 
 // ----------------------------------------------------------------------
@@ -56,9 +64,13 @@
 void
 pylith::meshio::TestDataWriterHDF5BCMesh::testConstructor(void)
 { // testConstructor
+  PYLITH_METHOD_BEGIN;
+
   DataWriterHDF5<topology::SubMesh, SubMeshField> writer;
 
-  CPPUNIT_ASSERT(0 == writer._viewer);
+  CPPUNIT_ASSERT(!writer._viewer);
+
+  PYLITH_METHOD_END;
 } // testConstructor
 
 // ----------------------------------------------------------------------
@@ -66,16 +78,18 @@
 void
 pylith::meshio::TestDataWriterHDF5BCMesh::testOpenClose(void)
 { // testOpenClose
-  CPPUNIT_ASSERT(0 != _mesh);
-  CPPUNIT_ASSERT(0 != _data);
+  PYLITH_METHOD_BEGIN;
 
+  CPPUNIT_ASSERT(_mesh);
+  CPPUNIT_ASSERT(_data);
+
   DataWriterHDF5<topology::SubMesh, SubMeshField> writer;
 
   writer.filename(_data->timestepFilename);
 
   const PylithScalar t = _data->time;
   const int numTimeSteps = 1;
-  if (0 == _data->cellsLabel) {
+  if (!_data->cellsLabel) {
     writer.open(*_submesh, numTimeSteps);
     writer.openTimeStep(t, *_submesh);
   } else {
@@ -89,6 +103,8 @@
   writer.close();
 
   checkFile(_data->timestepFilename);
+
+  PYLITH_METHOD_END;
 } // testOpenClose
 
 // ----------------------------------------------------------------------
@@ -96,9 +112,11 @@
 void
 pylith::meshio::TestDataWriterHDF5BCMesh::testWriteVertexField(void)
 { // testWriteVertexField
-  CPPUNIT_ASSERT(0 != _mesh);
-  CPPUNIT_ASSERT(0 != _data);
+  PYLITH_METHOD_BEGIN;
 
+  CPPUNIT_ASSERT(_mesh);
+  CPPUNIT_ASSERT(_data);
+
   DataWriterHDF5<topology::SubMesh, SubMeshField> writer;
 
   topology::Fields<SubMeshField> vertexFields(*_submesh);
@@ -112,7 +130,7 @@
 
   const int nfields = _data->numVertexFields;
   const int numTimeSteps = 1;
-  if (0 == _data->cellsLabel) {
+  if (!_data->cellsLabel) {
     writer.open(*_submesh, numTimeSteps);
     writer.openTimeStep(t, *_submesh);
   } else {
@@ -129,6 +147,8 @@
   writer.close();
   
   checkFile(_data->vertexFilename);
+
+  PYLITH_METHOD_END;
 } // testWriteVertexField
 
 // ----------------------------------------------------------------------
@@ -136,9 +156,11 @@
 void
 pylith::meshio::TestDataWriterHDF5BCMesh::testWriteCellField(void)
 { // testWriteCellField
-  CPPUNIT_ASSERT(0 != _mesh);
-  CPPUNIT_ASSERT(0 != _data);
+  PYLITH_METHOD_BEGIN;
 
+  CPPUNIT_ASSERT(_mesh);
+  CPPUNIT_ASSERT(_data);
+
   DataWriterHDF5<topology::SubMesh, SubMeshField> writer;
 
   topology::Fields<SubMeshField> cellFields(*_submesh);
@@ -152,7 +174,7 @@
 
   const int nfields = _data->numCellFields;
   const int numTimeSteps = 1;
-  if (0 == _data->cellsLabel) {
+  if (!_data->cellsLabel) {
     writer.open(*_submesh, numTimeSteps);
     writer.openTimeStep(t, *_submesh);
     for (int i=0; i < nfields; ++i) {
@@ -173,6 +195,8 @@
   writer.close();
   
   checkFile(_data->cellFilename);
+
+  PYLITH_METHOD_END;
 } // testWriteCellField
 
 

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5BCMeshCases.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5BCMeshCases.cc	2013-04-17 15:07:28 UTC (rev 21879)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5BCMeshCases.cc	2013-04-17 15:07:45 UTC (rev 21880)
@@ -25,6 +25,7 @@
 #include "data/DataWriterHDF5DataBCMeshTet4.hh"
 #include "data/DataWriterHDF5DataBCMeshHex8.hh"
 
+#include "pylith/utils/petscerror.h" // USES PYLITH_METHOD_BEGIN/END
 
 // ----------------------------------------------------------------------
 CPPUNIT_TEST_SUITE_REGISTRATION( pylith::meshio::TestDataWriterHDF5BCMeshTri3 );
@@ -38,10 +39,14 @@
 void
 pylith::meshio::TestDataWriterHDF5BCMeshTri3::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterHDF5BCMesh::setUp();
   _data = new DataWriterHDF5DataBCMeshTri3;
   _flipFault = true;
   _initialize();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 
@@ -50,10 +55,14 @@
 void
 pylith::meshio::TestDataWriterHDF5BCMeshQuad4::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterHDF5BCMesh::setUp();
   _data = new DataWriterHDF5DataBCMeshQuad4;
   _flipFault = false;
   _initialize();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 
@@ -62,10 +71,14 @@
 void
 pylith::meshio::TestDataWriterHDF5BCMeshTet4::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterHDF5BCMesh::setUp();
   _data = new DataWriterHDF5DataBCMeshTet4;
   _flipFault = false;
   _initialize();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 
@@ -74,10 +87,14 @@
 void
 pylith::meshio::TestDataWriterHDF5BCMeshHex8::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterHDF5BCMesh::setUp();
   _data = new DataWriterHDF5DataBCMeshHex8;
   _flipFault = true;
   _initialize();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtBCMesh.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtBCMesh.cc	2013-04-17 15:07:28 UTC (rev 21879)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtBCMesh.cc	2013-04-17 15:07:45 UTC (rev 21880)
@@ -40,7 +40,11 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtBCMesh::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterBCMesh::setUp();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 // ----------------------------------------------------------------------
@@ -48,7 +52,11 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtBCMesh::tearDown(void)
 { // tearDown
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterBCMesh::tearDown();
+
+  PYLITH_METHOD_END;
 } // tearDown
 
 // ----------------------------------------------------------------------
@@ -56,7 +64,11 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtBCMesh::testConstructor(void)
 { // testConstructor
+  PYLITH_METHOD_BEGIN;
+
   DataWriterHDF5Ext<topology::SubMesh, SubMeshField> writer;
+
+  PYLITH_METHOD_END;
 } // testConstructor
 
 // ----------------------------------------------------------------------
@@ -64,16 +76,18 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtBCMesh::testOpenClose(void)
 { // testOpenClose
-  CPPUNIT_ASSERT(0 != _mesh);
-  CPPUNIT_ASSERT(0 != _data);
+  PYLITH_METHOD_BEGIN;
 
+  CPPUNIT_ASSERT(_mesh);
+  CPPUNIT_ASSERT(_data);
+
   DataWriterHDF5Ext<topology::SubMesh, SubMeshField> writer;
 
   writer.filename(_data->timestepFilename);
 
   const PylithScalar t = _data->time;
   const int numTimeSteps = 1;
-  if (0 == _data->cellsLabel) {
+  if (!_data->cellsLabel) {
     writer.open(*_submesh, numTimeSteps);
     writer.openTimeStep(t, *_submesh);
   } else {
@@ -87,6 +101,8 @@
   writer.close();
 
   checkFile(_data->timestepFilename);
+
+  PYLITH_METHOD_END;
 } // testOpenClose
 
 // ----------------------------------------------------------------------
@@ -94,9 +110,11 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtBCMesh::testWriteVertexField(void)
 { // testWriteVertexField
-  CPPUNIT_ASSERT(0 != _mesh);
-  CPPUNIT_ASSERT(0 != _data);
+  PYLITH_METHOD_BEGIN;
 
+  CPPUNIT_ASSERT(_mesh);
+  CPPUNIT_ASSERT(_data);
+
   DataWriterHDF5Ext<topology::SubMesh, SubMeshField> writer;
 
   topology::Fields<SubMeshField> vertexFields(*_submesh);
@@ -110,7 +128,7 @@
 
   const int nfields = _data->numVertexFields;
   const int numTimeSteps = 1;
-  if (0 == _data->cellsLabel) {
+  if (!_data->cellsLabel) {
     writer.open(*_submesh, numTimeSteps);
     writer.openTimeStep(t, *_submesh);
   } else {
@@ -127,6 +145,8 @@
   writer.close();
   
   checkFile(_data->vertexFilename);
+
+  PYLITH_METHOD_END;
 } // testWriteVertexField
 
 // ----------------------------------------------------------------------
@@ -134,9 +154,11 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtBCMesh::testWriteCellField(void)
 { // testWriteCellField
-  CPPUNIT_ASSERT(0 != _mesh);
-  CPPUNIT_ASSERT(0 != _data);
+  PYLITH_METHOD_BEGIN;
 
+  CPPUNIT_ASSERT(_mesh);
+  CPPUNIT_ASSERT(_data);
+
   DataWriterHDF5Ext<topology::SubMesh, SubMeshField> writer;
 
   topology::Fields<SubMeshField> cellFields(*_submesh);
@@ -150,7 +172,7 @@
 
   const int nfields = _data->numCellFields;
   const int numTimeSteps = 1;
-  if (0 == _data->cellsLabel) {
+  if (!_data->cellsLabel) {
     writer.open(*_submesh, numTimeSteps);
     writer.openTimeStep(t, *_submesh);
     for (int i=0; i < nfields; ++i) {
@@ -171,6 +193,8 @@
   writer.close();
   
   checkFile(_data->cellFilename);
+
+  PYLITH_METHOD_END;
 } // testWriteCellField
 
 

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtBCMeshCases.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtBCMeshCases.cc	2013-04-17 15:07:28 UTC (rev 21879)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtBCMeshCases.cc	2013-04-17 15:07:45 UTC (rev 21880)
@@ -25,6 +25,7 @@
 #include "data/DataWriterHDF5DataBCMeshTet4.hh"
 #include "data/DataWriterHDF5DataBCMeshHex8.hh"
 
+#include "pylith/utils/petscerror.h" // USES PYLITH_METHOD_BEGIN/END
 
 // ----------------------------------------------------------------------
 CPPUNIT_TEST_SUITE_REGISTRATION( pylith::meshio::TestDataWriterHDF5ExtBCMeshTri3 );
@@ -38,10 +39,14 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtBCMeshTri3::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterHDF5ExtBCMesh::setUp();
   _data = new DataWriterHDF5DataBCMeshTri3;
   _flipFault = true;
   _initialize();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 
@@ -50,10 +55,14 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtBCMeshQuad4::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterHDF5ExtBCMesh::setUp();
   _data = new DataWriterHDF5DataBCMeshQuad4;
   _flipFault = false;
   _initialize();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 
@@ -62,10 +71,14 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtBCMeshTet4::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterHDF5ExtBCMesh::setUp();
   _data = new DataWriterHDF5DataBCMeshTet4;
   _flipFault = false;
   _initialize();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 
@@ -74,10 +87,14 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtBCMeshHex8::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterHDF5ExtBCMesh::setUp();
   _data = new DataWriterHDF5DataBCMeshHex8;
   _flipFault = true;
   _initialize();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtFaultMesh.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtFaultMesh.cc	2013-04-17 15:07:28 UTC (rev 21879)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtFaultMesh.cc	2013-04-17 15:07:45 UTC (rev 21880)
@@ -43,7 +43,11 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtFaultMesh::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterFaultMesh::setUp();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 // ----------------------------------------------------------------------
@@ -51,7 +55,11 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtFaultMesh::tearDown(void)
 { // tearDown
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterFaultMesh::tearDown();
+
+  PYLITH_METHOD_END;
 } // tearDown
 
 // ----------------------------------------------------------------------
@@ -59,7 +67,11 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtFaultMesh::testConstructor(void)
 { // testConstructor
+  PYLITH_METHOD_BEGIN;
+
   DataWriterHDF5Ext<topology::SubMesh, MeshField> writer;
+
+  PYLITH_METHOD_END;
 } // testConstructor
 
 // ----------------------------------------------------------------------
@@ -67,16 +79,18 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtFaultMesh::testOpenClose(void)
 { // testOpenClose
-  CPPUNIT_ASSERT(0 != _mesh);
-  CPPUNIT_ASSERT(0 != _data);
+  PYLITH_METHOD_BEGIN;
 
+  CPPUNIT_ASSERT(_mesh);
+  CPPUNIT_ASSERT(_data);
+
   DataWriterHDF5Ext<topology::SubMesh, MeshField> writer;
 
   writer.filename(_data->timestepFilename);
 
   const PylithScalar t = _data->time;
   const int numTimeSteps = 1;
-  if (0 == _data->cellsLabel) {
+  if (!_data->cellsLabel) {
     writer.open(*_faultMesh, numTimeSteps);
     writer.openTimeStep(t, *_faultMesh);
   } else {
@@ -90,6 +104,8 @@
   writer.close();
 
   checkFile(_data->timestepFilename);
+
+  PYLITH_METHOD_END;
 } // testOpenClose
 
 // ----------------------------------------------------------------------
@@ -97,9 +113,11 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtFaultMesh::testWriteVertexField(void)
 { // testWriteVertexField
-  CPPUNIT_ASSERT(0 != _mesh);
-  CPPUNIT_ASSERT(0 != _data);
+  PYLITH_METHOD_BEGIN;
 
+  CPPUNIT_ASSERT(_mesh);
+  CPPUNIT_ASSERT(_data);
+
   DataWriterHDF5Ext<topology::SubMesh, MeshField> writer;
 
   topology::Fields<MeshField> vertexFields(*_faultMesh);
@@ -113,7 +131,7 @@
 
   const int nfields = _data->numVertexFields;
   const int numTimeSteps = 1;
-  if (0 == _data->cellsLabel) {
+  if (!_data->cellsLabel) {
     writer.open(*_faultMesh, numTimeSteps);
     writer.openTimeStep(t, *_faultMesh);
   } else {
@@ -130,6 +148,8 @@
   writer.close();
   
   checkFile(_data->vertexFilename);
+
+  PYLITH_METHOD_END;
 } // testWriteVertexField
 
 // ----------------------------------------------------------------------
@@ -137,9 +157,11 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtFaultMesh::testWriteCellField(void)
 { // testWriteCellField
-  CPPUNIT_ASSERT(0 != _mesh);
-  CPPUNIT_ASSERT(0 != _data);
+  PYLITH_METHOD_BEGIN;
 
+  CPPUNIT_ASSERT(_mesh);
+  CPPUNIT_ASSERT(_data);
+
   DataWriterHDF5Ext<topology::SubMesh, MeshField> writer;
 
   topology::Fields<MeshField> cellFields(*_faultMesh);
@@ -153,7 +175,7 @@
 
   const int nfields = _data->numCellFields;
   const int numTimeSteps = 1;
-  if (0 == _data->cellsLabel) {
+  if (!_data->cellsLabel) {
     writer.open(*_faultMesh, numTimeSteps);
     writer.openTimeStep(t, *_faultMesh);
     for (int i=0; i < nfields; ++i) {
@@ -174,6 +196,8 @@
   writer.close();
   
   checkFile(_data->cellFilename);
+
+  PYLITH_METHOD_END;
 } // testWriteCellField
 
 

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtMatMeshCases.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtMatMeshCases.cc	2013-04-17 15:07:28 UTC (rev 21879)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtMatMeshCases.cc	2013-04-17 15:07:45 UTC (rev 21880)
@@ -26,6 +26,7 @@
 #include "data/DataWriterHDF5DataMatMeshTet4.hh"
 #include "data/DataWriterHDF5DataMatMeshHex8.hh"
 
+#include "pylith/utils/petscerror.h" // USES PYLITH_METHOD_BEGIN/END
 
 // ----------------------------------------------------------------------
 CPPUNIT_TEST_SUITE_REGISTRATION( pylith::meshio::TestDataWriterHDF5ExtMatMeshLine2 );
@@ -40,10 +41,14 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtMatMeshLine2::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterHDF5ExtMesh::setUp();
   _data = new DataWriterHDF5DataMatMeshLine2;
   _flipFault = false;
   _initialize();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 
@@ -52,10 +57,14 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtMatMeshTri3::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterHDF5ExtMesh::setUp();
   _data = new DataWriterHDF5DataMatMeshTri3;
   _flipFault = true;
   _initialize();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 
@@ -64,10 +73,14 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtMatMeshQuad4::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterHDF5ExtMesh::setUp();
   _data = new DataWriterHDF5DataMatMeshQuad4;
   _flipFault = false;
   _initialize();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 
@@ -76,10 +89,14 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtMatMeshTet4::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterHDF5ExtMesh::setUp();
   _data = new DataWriterHDF5DataMatMeshTet4;
   _flipFault = false;
   _initialize();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 
@@ -88,10 +105,14 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtMatMeshHex8::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterHDF5ExtMesh::setUp();
   _data = new DataWriterHDF5DataMatMeshHex8;
   _flipFault = true;
   _initialize();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtMesh.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtMesh.cc	2013-04-17 15:07:28 UTC (rev 21879)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtMesh.cc	2013-04-17 15:07:45 UTC (rev 21880)
@@ -40,7 +40,11 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtMesh::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterMesh::setUp();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 // ----------------------------------------------------------------------
@@ -48,7 +52,11 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtMesh::tearDown(void)
 { // tearDown
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterMesh::tearDown();
+
+  PYLITH_METHOD_END;
 } // tearDown
 
 // ----------------------------------------------------------------------
@@ -56,9 +64,13 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtMesh::testConstructor(void)
 { // testConstructor
+  PYLITH_METHOD_BEGIN;
+
   DataWriterHDF5Ext<topology::Mesh, MeshField> writer;
 
   CPPUNIT_ASSERT(writer._h5);
+
+  PYLITH_METHOD_END;
 } // testConstructor
 
 // ----------------------------------------------------------------------
@@ -66,11 +78,15 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtMesh::testFilename(void)
 { // testDebug
+  PYLITH_METHOD_BEGIN;
+
   DataWriterHDF5Ext<topology::Mesh, MeshField> writer;
 
   const char* filename = "data.h5";
   writer.filename(filename);
   CPPUNIT_ASSERT_EQUAL(std::string(filename), writer._filename);
+
+  PYLITH_METHOD_END;
 } // testFilename
 
 // ----------------------------------------------------------------------
@@ -78,16 +94,18 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtMesh::testOpenClose(void)
 { // testOpenClose
-  CPPUNIT_ASSERT(0 != _mesh);
-  CPPUNIT_ASSERT(0 != _data);
+  PYLITH_METHOD_BEGIN;
 
+  CPPUNIT_ASSERT(_mesh);
+  CPPUNIT_ASSERT(_data);
+
   DataWriterHDF5Ext<topology::Mesh, MeshField> writer;
 
   writer.filename(_data->timestepFilename);
 
   const PylithScalar t = _data->time;
   const int numTimeSteps = 1;
-  if (0 == _data->cellsLabel) {
+  if (!_data->cellsLabel) {
     writer.open(*_mesh, numTimeSteps);
   } else {
     const char* label = _data->cellsLabel;
@@ -98,6 +116,8 @@
   writer.close();
 
   checkFile(_data->timestepFilename);
+
+  PYLITH_METHOD_END;
 } // testOpenClose
 
 // ----------------------------------------------------------------------
@@ -105,9 +125,11 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtMesh::testWriteVertexField(void)
 { // testWriteVertexField
-  CPPUNIT_ASSERT(0 != _mesh);
-  CPPUNIT_ASSERT(0 != _data);
+  PYLITH_METHOD_BEGIN;
 
+  CPPUNIT_ASSERT(_mesh);
+  CPPUNIT_ASSERT(_data);
+
   DataWriterHDF5Ext<topology::Mesh, MeshField> writer;
 
   topology::Fields<MeshField> vertexFields(*_mesh);
@@ -121,7 +143,7 @@
 
   const int nfields = _data->numVertexFields;
   const int numTimeSteps = 1;
-  if (0 == _data->cellsLabel) {
+  if (!_data->cellsLabel) {
     writer.open(*_mesh, numTimeSteps);
     writer.openTimeStep(t, *_mesh);
   } else {
@@ -138,6 +160,8 @@
   writer.close();
   
   checkFile(_data->vertexFilename);
+
+  PYLITH_METHOD_END;
 } // testWriteVertexField
 
 // ----------------------------------------------------------------------
@@ -145,9 +169,11 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtMesh::testWriteCellField(void)
 { // testWriteCellField
-  CPPUNIT_ASSERT(0 != _mesh);
-  CPPUNIT_ASSERT(0 != _data);
+  PYLITH_METHOD_BEGIN;
 
+  CPPUNIT_ASSERT(_mesh);
+  CPPUNIT_ASSERT(_data);
+
   DataWriterHDF5Ext<topology::Mesh, MeshField> writer;
 
   topology::Fields<MeshField> cellFields(*_mesh);
@@ -161,7 +187,7 @@
 
   const int nfields = _data->numCellFields;
   const int numTimeSteps = 1;
-  if (0 == _data->cellsLabel) {
+  if (!_data->cellsLabel) {
     writer.open(*_mesh, numTimeSteps);
     writer.openTimeStep(t, *_mesh);
     for (int i=0; i < nfields; ++i) {
@@ -182,12 +208,16 @@
   writer.close();
   
   checkFile(_data->cellFilename);
+
+  PYLITH_METHOD_END;
 } // testWriteCellField
 
 // ----------------------------------------------------------------------
 // Test _hdf5Filename().
 void pylith::meshio::TestDataWriterHDF5ExtMesh::testHdf5Filename(void)
 { // testHdf5Filename
+  PYLITH_METHOD_BEGIN;
+
   DataWriterHDF5Ext<topology::Mesh, MeshField> writer;
 
   // Append info to filename if number of time steps is 0.
@@ -204,12 +234,16 @@
   writer._filename = "output_abcd.h5";
   CPPUNIT_ASSERT_EQUAL(std::string("output_abcd.h5"), 
 		       writer._hdf5Filename());
+
+  PYLITH_METHOD_END;
 } // testHdf5Filename
 
 // ----------------------------------------------------------------------
 // Test _datasetFilename().
 void pylith::meshio::TestDataWriterHDF5ExtMesh::testDatasetFilename(void)
 { // testDatasetFilename
+  PYLITH_METHOD_BEGIN;
+
   DataWriterHDF5Ext<topology::Mesh, MeshField> writer;
 
   // Append info to filename if number of time steps is 0.
@@ -227,6 +261,8 @@
   writer._filename = "output_abcd.h5";
   CPPUNIT_ASSERT_EQUAL(std::string("output_abcd_field2.dat"), 
 		       writer._datasetFilename("field2"));
+
+  PYLITH_METHOD_END;
 } // testDatasetFilename
 
 

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtMeshCases.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtMeshCases.cc	2013-04-17 15:07:28 UTC (rev 21879)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtMeshCases.cc	2013-04-17 15:07:45 UTC (rev 21880)
@@ -26,6 +26,7 @@
 #include "data/DataWriterHDF5DataMeshTet4.hh"
 #include "data/DataWriterHDF5DataMeshHex8.hh"
 
+#include "pylith/utils/petscerror.h" // USES PYLITH_METHOD_BEGIN/END
 
 // ----------------------------------------------------------------------
 CPPUNIT_TEST_SUITE_REGISTRATION( pylith::meshio::TestDataWriterHDF5ExtMeshLine2 );
@@ -40,10 +41,14 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtMeshLine2::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterHDF5ExtMesh::setUp();
   _data = new DataWriterHDF5DataMeshLine2;
   _flipFault = false;
   _initialize();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 
@@ -52,10 +57,14 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtMeshTri3::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterHDF5ExtMesh::setUp();
   _data = new DataWriterHDF5DataMeshTri3;
   _flipFault = true;
   _initialize();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 
@@ -64,10 +73,14 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtMeshQuad4::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterHDF5ExtMesh::setUp();
   _data = new DataWriterHDF5DataMeshQuad4;
   _flipFault = false;
   _initialize();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 
@@ -76,10 +89,14 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtMeshTet4::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterHDF5ExtMesh::setUp();
   _data = new DataWriterHDF5DataMeshTet4;
   _flipFault = false;
   _initialize();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 
@@ -88,11 +105,14 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtMeshHex8::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterHDF5ExtMesh::setUp();
   _data = new DataWriterHDF5DataMeshHex8;
   _flipFault = true;
+  _initialize();
 
-  _initialize();
+  PYLITH_METHOD_END;
 } // setUp
 
 

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtSubMesh.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtSubMesh.cc	2013-04-17 15:07:28 UTC (rev 21879)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtSubMesh.cc	2013-04-17 15:07:45 UTC (rev 21880)
@@ -41,7 +41,11 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtSubMesh::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterSubMesh::setUp();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 // ----------------------------------------------------------------------
@@ -49,7 +53,11 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtSubMesh::tearDown(void)
 { // tearDown
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterSubMesh::tearDown();
+
+  PYLITH_METHOD_END;
 } // tearDown
 
 // ----------------------------------------------------------------------
@@ -57,7 +65,11 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtSubMesh::testConstructor(void)
 { // testConstructor
+  PYLITH_METHOD_BEGIN;
+
   DataWriterHDF5Ext<topology::SubMesh, SubMeshField> writer;
+
+  PYLITH_METHOD_END;
 } // testConstructor
 
 // ----------------------------------------------------------------------
@@ -65,16 +77,18 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtSubMesh::testOpenClose(void)
 { // testOpenClose
-  CPPUNIT_ASSERT(0 != _mesh);
-  CPPUNIT_ASSERT(0 != _data);
+  PYLITH_METHOD_BEGIN;
 
+  CPPUNIT_ASSERT(_mesh);
+  CPPUNIT_ASSERT(_data);
+
   DataWriterHDF5Ext<topology::SubMesh, SubMeshField> writer;
 
   writer.filename(_data->timestepFilename);
 
   const PylithScalar t = _data->time;
   const int numTimeSteps = 1;
-  if (0 == _data->cellsLabel) {
+  if (!_data->cellsLabel) {
     writer.open(*_submesh, numTimeSteps);
   } else {
     const char* label = _data->cellsLabel;
@@ -85,6 +99,8 @@
   writer.close();
 
   checkFile(_data->timestepFilename);
+
+  PYLITH_METHOD_END;
 } // testOpenClose
 
 // ----------------------------------------------------------------------
@@ -92,9 +108,11 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtSubMesh::testWriteVertexField(void)
 { // testWriteVertexField
-  CPPUNIT_ASSERT(0 != _mesh);
-  CPPUNIT_ASSERT(0 != _data);
+  PYLITH_METHOD_BEGIN;
 
+  CPPUNIT_ASSERT(_mesh);
+  CPPUNIT_ASSERT(_data);
+
   DataWriterHDF5Ext<topology::SubMesh, MeshField> writer;
 
   topology::Fields<MeshField> vertexFields(*_mesh);
@@ -108,7 +126,7 @@
 
   const int nfields = _data->numVertexFields;
   const int numTimeSteps = 1;
-  if (0 == _data->cellsLabel) {
+  if (!_data->cellsLabel) {
     writer.open(*_submesh, numTimeSteps);
     writer.openTimeStep(t, *_submesh);
   } else {
@@ -125,6 +143,8 @@
   writer.close();
   
   checkFile(_data->vertexFilename);
+
+  PYLITH_METHOD_END;
 } // testWriteVertexField
 
 // ----------------------------------------------------------------------
@@ -132,9 +152,11 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtSubMesh::testWriteCellField(void)
 { // testWriteCellField
-  CPPUNIT_ASSERT(0 != _mesh);
-  CPPUNIT_ASSERT(0 != _data);
+  PYLITH_METHOD_BEGIN;
 
+  CPPUNIT_ASSERT(_mesh);
+  CPPUNIT_ASSERT(_data);
+
   DataWriterHDF5Ext<topology::SubMesh, SubMeshField> writer;
 
   topology::Fields<SubMeshField> cellFields(*_submesh);
@@ -148,7 +170,7 @@
 
   const int nfields = _data->numCellFields;
   const int numTimeSteps = 1;
-  if (0 == _data->cellsLabel) {
+  if (!_data->cellsLabel) {
     writer.open(*_submesh, numTimeSteps);
     writer.openTimeStep(t, *_submesh);
     for (int i=0; i < nfields; ++i) {
@@ -169,6 +191,8 @@
   writer.close();
   
   checkFile(_data->cellFilename);
+
+  PYLITH_METHOD_END;
 } // testWriteCellField
 
 

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtSubMeshCases.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtSubMeshCases.cc	2013-04-17 15:07:28 UTC (rev 21879)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5ExtSubMeshCases.cc	2013-04-17 15:07:45 UTC (rev 21880)
@@ -26,6 +26,7 @@
 #include "data/DataWriterHDF5DataSubMeshTet4.hh"
 #include "data/DataWriterHDF5DataSubMeshHex8.hh"
 
+#include "pylith/utils/petscerror.h" // USES PYLITH_METHOD_BEGIN/END
 
 // ----------------------------------------------------------------------
 CPPUNIT_TEST_SUITE_REGISTRATION( pylith::meshio::TestDataWriterHDF5ExtSubMeshLine2 );
@@ -40,10 +41,14 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtSubMeshLine2::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterHDF5ExtSubMesh::setUp();
   _data = new DataWriterHDF5DataSubMeshLine2;
   _flipFault = false;
   _initialize();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 
@@ -52,10 +57,14 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtSubMeshTri3::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterHDF5ExtSubMesh::setUp();
   _data = new DataWriterHDF5DataSubMeshTri3;
   _flipFault = true;
   _initialize();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 
@@ -64,10 +73,14 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtSubMeshQuad4::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterHDF5ExtSubMesh::setUp();
   _data = new DataWriterHDF5DataSubMeshQuad4;
   _flipFault = false;
   _initialize();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 
@@ -76,10 +89,14 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtSubMeshTet4::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterHDF5ExtSubMesh::setUp();
   _data = new DataWriterHDF5DataSubMeshTet4;
   _flipFault = false;
   _initialize();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 
@@ -88,10 +105,14 @@
 void
 pylith::meshio::TestDataWriterHDF5ExtSubMeshHex8::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterHDF5ExtSubMesh::setUp();
   _data = new DataWriterHDF5DataSubMeshHex8;
   _flipFault = true;
   _initialize();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5FaultMesh.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5FaultMesh.cc	2013-04-17 15:07:28 UTC (rev 21879)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5FaultMesh.cc	2013-04-17 15:07:45 UTC (rev 21880)
@@ -43,7 +43,11 @@
 void
 pylith::meshio::TestDataWriterHDF5FaultMesh::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterFaultMesh::setUp();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 // ----------------------------------------------------------------------
@@ -51,7 +55,11 @@
 void
 pylith::meshio::TestDataWriterHDF5FaultMesh::tearDown(void)
 { // tearDown
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterFaultMesh::tearDown();
+
+  PYLITH_METHOD_END;
 } // tearDown
 
 // ----------------------------------------------------------------------
@@ -59,9 +67,13 @@
 void
 pylith::meshio::TestDataWriterHDF5FaultMesh::testConstructor(void)
 { // testConstructor
+  PYLITH_METHOD_BEGIN;
+
   DataWriterHDF5<topology::SubMesh, MeshField> writer;
 
-  CPPUNIT_ASSERT(0 == writer._viewer);
+  CPPUNIT_ASSERT(!writer._viewer);
+
+  PYLITH_METHOD_END;
 } // testConstructor
 
 // ----------------------------------------------------------------------
@@ -69,16 +81,18 @@
 void
 pylith::meshio::TestDataWriterHDF5FaultMesh::testOpenClose(void)
 { // testOpenClose
-  CPPUNIT_ASSERT(0 != _mesh);
-  CPPUNIT_ASSERT(0 != _data);
+  PYLITH_METHOD_BEGIN;
 
+  CPPUNIT_ASSERT(_mesh);
+  CPPUNIT_ASSERT(_data);
+
   DataWriterHDF5<topology::SubMesh, MeshField> writer;
 
   writer.filename(_data->timestepFilename);
 
   const PylithScalar t = _data->time;
   const int numTimeSteps = 1;
-  if (0 == _data->cellsLabel) {
+  if (!_data->cellsLabel) {
     writer.open(*_faultMesh, numTimeSteps);
     writer.openTimeStep(t, *_faultMesh);
   } else {
@@ -92,6 +106,8 @@
   writer.close();
 
   checkFile(_data->timestepFilename);
+
+  PYLITH_METHOD_END;
 } // testOpenClose
 
 // ----------------------------------------------------------------------
@@ -99,9 +115,11 @@
 void
 pylith::meshio::TestDataWriterHDF5FaultMesh::testWriteVertexField(void)
 { // testWriteVertexField
-  CPPUNIT_ASSERT(0 != _mesh);
-  CPPUNIT_ASSERT(0 != _data);
+  PYLITH_METHOD_BEGIN;
 
+  CPPUNIT_ASSERT(_mesh);
+  CPPUNIT_ASSERT(_data);
+
   DataWriterHDF5<topology::SubMesh, MeshField> writer;
 
   topology::Fields<MeshField> vertexFields(*_faultMesh);
@@ -115,7 +133,7 @@
 
   const int nfields = _data->numVertexFields;
   const int numTimeSteps = 1;
-  if (0 == _data->cellsLabel) {
+  if (!_data->cellsLabel) {
     writer.open(*_faultMesh, numTimeSteps);
     writer.openTimeStep(t, *_faultMesh);
   } else {
@@ -132,6 +150,8 @@
   writer.close();
   
   checkFile(_data->vertexFilename);
+
+  PYLITH_METHOD_END;
 } // testWriteVertexField
 
 // ----------------------------------------------------------------------
@@ -139,9 +159,11 @@
 void
 pylith::meshio::TestDataWriterHDF5FaultMesh::testWriteCellField(void)
 { // testWriteCellField
-  CPPUNIT_ASSERT(0 != _mesh);
-  CPPUNIT_ASSERT(0 != _data);
+  PYLITH_METHOD_BEGIN;
 
+  CPPUNIT_ASSERT(_mesh);
+  CPPUNIT_ASSERT(_data);
+
   DataWriterHDF5<topology::SubMesh, MeshField> writer;
 
   topology::Fields<MeshField> cellFields(*_faultMesh);
@@ -155,7 +177,7 @@
 
   const int nfields = _data->numCellFields;
   const int numTimeSteps = 1;
-  if (0 == _data->cellsLabel) {
+  if (!_data->cellsLabel) {
     writer.open(*_faultMesh, numTimeSteps);
     writer.openTimeStep(t, *_faultMesh);
     for (int i=0; i < nfields; ++i) {
@@ -176,6 +198,8 @@
   writer.close();
   
   checkFile(_data->cellFilename);
+
+  PYLITH_METHOD_END;
 } // testWriteCellField
 
 

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5FaultMeshCases.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5FaultMeshCases.cc	2013-04-17 15:07:28 UTC (rev 21879)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestDataWriterHDF5FaultMeshCases.cc	2013-04-17 15:07:45 UTC (rev 21880)
@@ -25,6 +25,7 @@
 #include "data/DataWriterHDF5DataFaultMeshTet4.hh"
 #include "data/DataWriterHDF5DataFaultMeshHex8.hh"
 
+#include "pylith/utils/petscerror.h" // USES PYLITH_METHOD_BEGIN/END
 
 // ----------------------------------------------------------------------
 CPPUNIT_TEST_SUITE_REGISTRATION( pylith::meshio::TestDataWriterHDF5FaultMeshTri3 );
@@ -38,11 +39,15 @@
 void
 pylith::meshio::TestDataWriterHDF5FaultMeshTri3::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterHDF5FaultMesh::setUp();
   _data = new DataWriterHDF5DataFaultMeshTri3;
   _flipFault = true;
 
   _initialize();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 
@@ -51,11 +56,15 @@
 void
 pylith::meshio::TestDataWriterHDF5FaultMeshQuad4::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterHDF5FaultMesh::setUp();
   _data = new DataWriterHDF5DataFaultMeshQuad4;
   _flipFault = true;
 
   _initialize();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 
@@ -64,11 +73,15 @@
 void
 pylith::meshio::TestDataWriterHDF5FaultMeshTet4::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterHDF5FaultMesh::setUp();
   _data = new DataWriterHDF5DataFaultMeshTet4;
   _flipFault = false;
 
   _initialize();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 
@@ -77,11 +90,15 @@
 void
 pylith::meshio::TestDataWriterHDF5FaultMeshHex8::setUp(void)
 { // setUp
+  PYLITH_METHOD_BEGIN;
+
   TestDataWriterHDF5FaultMesh::setUp();
   _data = new DataWriterHDF5DataFaultMeshHex8;
   _flipFault = true;
 
   _initialize();
+
+  PYLITH_METHOD_END;
 } // setUp
 
 



More information about the CIG-COMMITS mailing list