[cig-commits] r19074 - in short/3D/PyLith/branches/v1.6-stable: libsrc/pylith/meshio modulesrc/meshio pylith/meshio unittests/libtests/meshio unittests/pytests/meshio

brad at geodynamics.org brad at geodynamics.org
Fri Oct 14 12:39:12 PDT 2011


Author: brad
Date: 2011-10-14 12:39:12 -0700 (Fri, 14 Oct 2011)
New Revision: 19074

Added:
   short/3D/PyLith/branches/v1.6-stable/unittests/pytests/meshio/TestDataWriterHDF5Ext.py
Modified:
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/DataWriter.cc
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/DataWriter.hh
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/DataWriterHDF5.cc
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/DataWriterHDF5Ext.cc
   short/3D/PyLith/branches/v1.6-stable/modulesrc/meshio/DataWriter.i
   short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterHDF5.py
   short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterHDF5ExtMesh.py
   short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterHDF5ExtSubMesh.py
   short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterHDF5ExtSubSubMesh.py
   short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterHDF5Mesh.py
   short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterHDF5SubMesh.py
   short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterHDF5SubSubMesh.py
   short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterVTK.py
   short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterVTKMesh.py
   short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterVTKSubMesh.py
   short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterVTKSubSubMesh.py
   short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5BCMesh.cc
   short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5ExtBCMesh.cc
   short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5ExtFaultMesh.cc
   short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5ExtMesh.cc
   short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5ExtSubMesh.cc
   short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5FaultMesh.cc
   short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5Mesh.cc
   short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5SubMesh.cc
   short/3D/PyLith/branches/v1.6-stable/unittests/pytests/meshio/testhdf5.py
Log:
Fixed bug in HDF5 output. Time dataset not dimensioned. Updated unit tests to include check.

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/DataWriter.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/DataWriter.cc	2011-10-14 18:27:24 UTC (rev 19073)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/DataWriter.cc	2011-10-14 19:39:12 UTC (rev 19074)
@@ -22,6 +22,7 @@
 // Constructor
 template<typename mesh_type, typename field_type>
 pylith::meshio::DataWriter<mesh_type, field_type>::DataWriter(void) :
+  _timeScale(1.0),
   _numTimeSteps(0),
   _context("")
 { // constructor
@@ -43,7 +44,23 @@
 { // deallocate
 } // deallocate
   
+
 // ----------------------------------------------------------------------
+// Set time scale for simulation time.
+template<typename mesh_type, typename field_type>
+void
+pylith::meshio::DataWriter<mesh_type, field_type>::timeScale(const double value)
+{ // timeScale
+  if (value <= 0.0) {
+    std::ostringstream msg;
+    msg << "Time scale for simulation time (" << value << " must be positive.";
+    throw std::runtime_error(msg.str());
+  } // if
+  
+  _timeScale = value;
+} // timeScale
+  
+// ----------------------------------------------------------------------
 // Prepare for writing files.
 template<typename mesh_type, typename field_type>
 void

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/DataWriter.hh
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/DataWriter.hh	2011-10-14 18:27:24 UTC (rev 19073)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/DataWriter.hh	2011-10-14 19:39:12 UTC (rev 19074)
@@ -58,6 +58,12 @@
   virtual
   void deallocate(void);
   
+  /** Set time scale for simulation time.
+   *
+   * @param value Time scale
+   */
+  void timeScale(const double value);
+
   /** Prepare for writing files.
    *
    * @param mesh Finite-element mesh. 
@@ -136,6 +142,7 @@
 // PROTECTED MEMBERS ////////////////////////////////////////////////////
 protected :
 
+  double _timeScale; ///< Time scale for dimensioning time in output.
   int _numTimeSteps; ///< Expected number of time steps for fields.
   std::string _context; ///< Context of scatters for DataWriter.
 

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/DataWriterHDF5.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/DataWriterHDF5.cc	2011-10-14 18:27:24 UTC (rev 19073)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/DataWriterHDF5.cc	2011-10-14 19:39:12 UTC (rev 19074)
@@ -471,7 +471,8 @@
   PetscErrorCode err = 0;
 
   if (0 == rank) {
-    err = VecSetValue(_tstamp, 0, t, INSERT_VALUES); CHECK_PETSC_ERROR(err);
+    const double tDim = t * DataWriter<mesh_type, field_type>::_timeScale;
+    err = VecSetValue(_tstamp, 0, tDim, INSERT_VALUES); CHECK_PETSC_ERROR(err);
   } // if
   err = VecAssemblyBegin(_tstamp); CHECK_PETSC_ERROR(err);
   err = VecAssemblyEnd(_tstamp); CHECK_PETSC_ERROR(err);

Modified: short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/DataWriterHDF5Ext.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/DataWriterHDF5Ext.cc	2011-10-14 18:27:24 UTC (rev 19073)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/DataWriterHDF5Ext.cc	2011-10-14 19:39:12 UTC (rev 19074)
@@ -615,7 +615,8 @@
   dims[0] = _tstampIndex+1;
   dims[1] = 1;
   dims[2] = 1;
-  _h5->writeDatasetChunk("/", "time", &t, dims, dimsChunk, ndims, 
+  const double tDim = t * DataWriter<mesh_type, field_type>::_timeScale;
+  _h5->writeDatasetChunk("/", "time", &tDim, dims, dimsChunk, ndims, 
 			 _tstampIndex, H5T_NATIVE_DOUBLE);
   
   _tstampIndex++;

Modified: short/3D/PyLith/branches/v1.6-stable/modulesrc/meshio/DataWriter.i
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/modulesrc/meshio/DataWriter.i	2011-10-14 18:27:24 UTC (rev 19073)
+++ short/3D/PyLith/branches/v1.6-stable/modulesrc/meshio/DataWriter.i	2011-10-14 19:39:12 UTC (rev 19074)
@@ -50,6 +50,12 @@
       virtual
       void deallocate(void);
   
+      /** Set time scale for simulation time.
+       *
+       * @param value Time scale
+       */
+      void timeScale(const double value);
+
       /** Prepare for writing files.
        *
        * @param mesh Finite-element mesh. 

Modified: short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterHDF5.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterHDF5.py	2011-10-14 18:27:24 UTC (rev 19073)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterHDF5.py	2011-10-14 19:39:12 UTC (rev 19074)
@@ -53,12 +53,4 @@
     return
 
 
-  def initialize(self, normalizer):
-    """
-    Initialize writer.
-    """
-    DataWriter.initialize(self, normalizer)
-    return
-
-
 # End of file 

Modified: short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterHDF5ExtMesh.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterHDF5ExtMesh.py	2011-10-14 18:27:24 UTC (rev 19073)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterHDF5ExtMesh.py	2011-10-14 19:39:12 UTC (rev 19074)
@@ -50,7 +50,10 @@
     """
     DataWriterHDF5Ext.initialize(self, normalizer)
     
+    timeScale = normalizer.timeScale()
+
     ModuleDataWriterHDF5Ext.filename(self, self.filename)
+    ModuleDataWriterHDF5Ext.timeScale(self, timeScale.value)
     return
   
 

Modified: short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterHDF5ExtSubMesh.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterHDF5ExtSubMesh.py	2011-10-14 18:27:24 UTC (rev 19073)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterHDF5ExtSubMesh.py	2011-10-14 19:39:12 UTC (rev 19074)
@@ -50,7 +50,10 @@
     """
     DataWriterHDF5Ext.initialize(self, normalizer)
 
+    timeScale = normalizer.timeScale()
+
     ModuleDataWriterHDF5Ext.filename(self, self.filename)
+    ModuleDataWriterHDF5Ext.timeScale(self, timeScale.value)
     return
   
 

Modified: short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterHDF5ExtSubSubMesh.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterHDF5ExtSubSubMesh.py	2011-10-14 18:27:24 UTC (rev 19073)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterHDF5ExtSubSubMesh.py	2011-10-14 19:39:12 UTC (rev 19074)
@@ -50,7 +50,10 @@
     """
     DataWriterHDF5Ext.initialize(self, normalizer)
 
+    timeScale = normalizer.timeScale()
+
     ModuleDataWriterHDF5Ext.filename(self, self.filename)
+    ModuleDataWriterHDF5Ext.timeScale(self, timeScale.value)
     return
   
 

Modified: short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterHDF5Mesh.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterHDF5Mesh.py	2011-10-14 18:27:24 UTC (rev 19073)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterHDF5Mesh.py	2011-10-14 19:39:12 UTC (rev 19074)
@@ -49,8 +49,11 @@
     Initialize writer.
     """
     DataWriterHDF5.initialize(self, normalizer)
+
+    timeScale = normalizer.timeScale()
     
     ModuleDataWriterHDF5.filename(self, self.filename)
+    ModuleDataWriterHDF5.timeScale(self, timeScale.value)
     return
   
 

Modified: short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterHDF5SubMesh.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterHDF5SubMesh.py	2011-10-14 18:27:24 UTC (rev 19073)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterHDF5SubMesh.py	2011-10-14 19:39:12 UTC (rev 19074)
@@ -50,7 +50,10 @@
     """
     DataWriterHDF5.initialize(self, normalizer)
 
+    timeScale = normalizer.timeScale()
+    
     ModuleDataWriterHDF5.filename(self, self.filename)
+    ModuleDataWriterHDF5.timeScale(self, timeScale.value)
     return
   
 

Modified: short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterHDF5SubSubMesh.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterHDF5SubSubMesh.py	2011-10-14 18:27:24 UTC (rev 19073)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterHDF5SubSubMesh.py	2011-10-14 19:39:12 UTC (rev 19074)
@@ -50,7 +50,10 @@
     """
     DataWriterHDF5.initialize(self, normalizer)
 
+    timeScale = normalizer.timeScale()
+    
     ModuleDataWriterHDF5.filename(self, self.filename)
+    ModuleDataWriterHDF5.timeScale(self, timeScale.value)
     return
   
 

Modified: short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterVTK.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterVTK.py	2011-10-14 18:27:24 UTC (rev 19073)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterVTK.py	2011-10-14 19:39:12 UTC (rev 19074)
@@ -69,19 +69,6 @@
     return
 
 
-  def initialize(self, normalizer):
-    """
-    Initialize writer.
-    """
-    DataWriter.initialize(self, normalizer)
-
-    # Nondimensionalize
-    timeScale = normalizer.timeScale()
-    self.timeConstantN = normalizer.nondimensionalize(self.timeConstant,
-                                                timeScale)
-    return
-
-
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):

Modified: short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterVTKMesh.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterVTKMesh.py	2011-10-14 18:27:24 UTC (rev 19073)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterVTKMesh.py	2011-10-14 19:39:12 UTC (rev 19074)
@@ -50,9 +50,14 @@
     """
     DataWriterVTK.initialize(self, normalizer)
     
+    timeScale = normalizer.timeScale()
+    timeConstantN = normalizer.nondimensionalize(self.timeConstant,
+                                                 timeScale)
+
     ModuleDataWriterVTK.filename(self, self.filename)
+    ModuleDataWriterVTK.timeScale(self, timeScale.value)
     ModuleDataWriterVTK.timeFormat(self, self.timeFormat)
-    ModuleDataWriterVTK.timeConstant(self, self.timeConstantN)
+    ModuleDataWriterVTK.timeConstant(self, timeConstantN)
     ModuleDataWriterVTK.precision(self, self.precision)
     return
   

Modified: short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterVTKSubMesh.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterVTKSubMesh.py	2011-10-14 18:27:24 UTC (rev 19073)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterVTKSubMesh.py	2011-10-14 19:39:12 UTC (rev 19074)
@@ -50,9 +50,14 @@
     """
     DataWriterVTK.initialize(self, normalizer)
 
+    timeScale = normalizer.timeScale()
+    timeConstantN = normalizer.nondimensionalize(self.timeConstant,
+                                                 timeScale)
+
     ModuleDataWriterVTK.filename(self, self.filename)
+    ModuleDataWriterVTK.timeScale(self, timeScale.value)
     ModuleDataWriterVTK.timeFormat(self, self.timeFormat)
-    ModuleDataWriterVTK.timeConstant(self, self.timeConstantN)
+    ModuleDataWriterVTK.timeConstant(self, timeConstantN)
     ModuleDataWriterVTK.precision(self, self.precision)
     return
   

Modified: short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterVTKSubSubMesh.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterVTKSubSubMesh.py	2011-10-14 18:27:24 UTC (rev 19073)
+++ short/3D/PyLith/branches/v1.6-stable/pylith/meshio/DataWriterVTKSubSubMesh.py	2011-10-14 19:39:12 UTC (rev 19074)
@@ -50,9 +50,14 @@
     """
     DataWriterVTK.initialize(self, normalizer)
 
+    timeScale = normalizer.timeScale()
+    timeConstantN = normalizer.nondimensionalize(self.timeConstant,
+                                                 timeScale)
+
     ModuleDataWriterVTK.filename(self, self.filename)
+    ModuleDataWriterVTK.timeScale(self, timeScale.value)
     ModuleDataWriterVTK.timeFormat(self, self.timeFormat)
-    ModuleDataWriterVTK.timeConstant(self, self.timeConstantN)
+    ModuleDataWriterVTK.timeConstant(self, timeConstantN)
     ModuleDataWriterVTK.precision(self, self.precision)
     return
   

Modified: short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5BCMesh.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5BCMesh.cc	2011-10-14 18:27:24 UTC (rev 19073)
+++ short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5BCMesh.cc	2011-10-14 19:39:12 UTC (rev 19074)
@@ -106,9 +106,11 @@
 
   writer.filename(_data->vertexFilename);
 
+  const double timeScale = 4.0;
+  writer.timeScale(timeScale);
+  const double t = _data->time / timeScale;
+
   const int nfields = _data->numVertexFields;
-
-  const double t = _data->time;
   const int numTimeSteps = 1;
   if (0 == _data->cellsLabel) {
     writer.open(*_submesh, numTimeSteps);
@@ -144,9 +146,11 @@
 
   writer.filename(_data->cellFilename);
 
+  const double timeScale = 4.0;
+  writer.timeScale(timeScale);
+  const double t = _data->time / timeScale;
+
   const int nfields = _data->numCellFields;
-
-  const double t = _data->time;
   const int numTimeSteps = 1;
   if (0 == _data->cellsLabel) {
     writer.open(*_submesh, numTimeSteps);

Modified: short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5ExtBCMesh.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5ExtBCMesh.cc	2011-10-14 18:27:24 UTC (rev 19073)
+++ short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5ExtBCMesh.cc	2011-10-14 19:39:12 UTC (rev 19074)
@@ -104,9 +104,11 @@
 
   writer.filename(_data->vertexFilename);
 
+  const double timeScale = 4.0;
+  writer.timeScale(timeScale);
+  const double t = _data->time / timeScale;
+
   const int nfields = _data->numVertexFields;
-
-  const double t = _data->time;
   const int numTimeSteps = 1;
   if (0 == _data->cellsLabel) {
     writer.open(*_submesh, numTimeSteps);
@@ -142,9 +144,11 @@
 
   writer.filename(_data->cellFilename);
 
+  const double timeScale = 4.0;
+  writer.timeScale(timeScale);
+  const double t = _data->time / timeScale;
+
   const int nfields = _data->numCellFields;
-
-  const double t = _data->time;
   const int numTimeSteps = 1;
   if (0 == _data->cellsLabel) {
     writer.open(*_submesh, numTimeSteps);

Modified: short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5ExtFaultMesh.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5ExtFaultMesh.cc	2011-10-14 18:27:24 UTC (rev 19073)
+++ short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5ExtFaultMesh.cc	2011-10-14 19:39:12 UTC (rev 19074)
@@ -107,9 +107,11 @@
 
   writer.filename(_data->vertexFilename);
 
+  const double timeScale = 4.0;
+  writer.timeScale(timeScale);
+  const double t = _data->time / timeScale;
+
   const int nfields = _data->numVertexFields;
-
-  const double t = _data->time;
   const int numTimeSteps = 1;
   if (0 == _data->cellsLabel) {
     writer.open(*_faultMesh, numTimeSteps);
@@ -145,9 +147,11 @@
 
   writer.filename(_data->cellFilename);
 
+  const double timeScale = 4.0;
+  writer.timeScale(timeScale);
+  const double t = _data->time / timeScale;
+
   const int nfields = _data->numCellFields;
-
-  const double t = _data->time;
   const int numTimeSteps = 1;
   if (0 == _data->cellsLabel) {
     writer.open(*_faultMesh, numTimeSteps);

Modified: short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5ExtMesh.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5ExtMesh.cc	2011-10-14 18:27:24 UTC (rev 19073)
+++ short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5ExtMesh.cc	2011-10-14 19:39:12 UTC (rev 19074)
@@ -113,9 +113,11 @@
 
   writer.filename(_data->vertexFilename);
 
+  const double timeScale = 4.0;
+  writer.timeScale(timeScale);
+  const double t = _data->time / timeScale;
+
   const int nfields = _data->numVertexFields;
-
-  const double t = _data->time;
   const int numTimeSteps = 1;
   if (0 == _data->cellsLabel) {
     writer.open(*_mesh, numTimeSteps);
@@ -151,9 +153,11 @@
 
   writer.filename(_data->cellFilename);
 
+  const double timeScale = 4.0;
+  writer.timeScale(timeScale);
+  const double t = _data->time / timeScale;
+
   const int nfields = _data->numCellFields;
-
-  const double t = _data->time;
   const int numTimeSteps = 1;
   if (0 == _data->cellsLabel) {
     writer.open(*_mesh, numTimeSteps);

Modified: short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5ExtSubMesh.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5ExtSubMesh.cc	2011-10-14 18:27:24 UTC (rev 19073)
+++ short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5ExtSubMesh.cc	2011-10-14 19:39:12 UTC (rev 19074)
@@ -102,9 +102,11 @@
 
   writer.filename(_data->vertexFilename);
 
+  const double timeScale = 4.0;
+  writer.timeScale(timeScale);
+  const double t = _data->time / timeScale;
+
   const int nfields = _data->numVertexFields;
-
-  const double t = _data->time;
   const int numTimeSteps = 1;
   if (0 == _data->cellsLabel) {
     writer.open(*_submesh, numTimeSteps);
@@ -140,9 +142,11 @@
 
   writer.filename(_data->cellFilename);
 
+  const double timeScale = 4.0;
+  writer.timeScale(timeScale);
+  const double t = _data->time / timeScale;
+
   const int nfields = _data->numCellFields;
-
-  const double t = _data->time;
   const int numTimeSteps = 1;
   if (0 == _data->cellsLabel) {
     writer.open(*_submesh, numTimeSteps);

Modified: short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5FaultMesh.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5FaultMesh.cc	2011-10-14 18:27:24 UTC (rev 19073)
+++ short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5FaultMesh.cc	2011-10-14 19:39:12 UTC (rev 19074)
@@ -109,9 +109,11 @@
 
   writer.filename(_data->vertexFilename);
 
+  const double timeScale = 4.0;
+  writer.timeScale(timeScale);
+  const double t = _data->time / timeScale;
+
   const int nfields = _data->numVertexFields;
-
-  const double t = _data->time;
   const int numTimeSteps = 1;
   if (0 == _data->cellsLabel) {
     writer.open(*_faultMesh, numTimeSteps);
@@ -147,9 +149,11 @@
 
   writer.filename(_data->cellFilename);
 
+  const double timeScale = 4.0;
+  writer.timeScale(timeScale);
+  const double t = _data->time / timeScale;
+
   const int nfields = _data->numCellFields;
-
-  const double t = _data->time;
   const int numTimeSteps = 1;
   if (0 == _data->cellsLabel) {
     writer.open(*_faultMesh, numTimeSteps);

Modified: short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5Mesh.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5Mesh.cc	2011-10-14 18:27:24 UTC (rev 19073)
+++ short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5Mesh.cc	2011-10-14 19:39:12 UTC (rev 19074)
@@ -113,9 +113,11 @@
 
   writer.filename(_data->vertexFilename);
 
+  const double timeScale = 4.0;
+  writer.timeScale(timeScale);
+  const double t = _data->time / timeScale;
+
   const int nfields = _data->numVertexFields;
-
-  const double t = _data->time;
   const int numTimeSteps = 1;
   if (0 == _data->cellsLabel) {
     writer.open(*_mesh, numTimeSteps);
@@ -151,9 +153,11 @@
 
   writer.filename(_data->cellFilename);
 
+  const double timeScale = 4.0;
+  writer.timeScale(timeScale);
+  const double t = _data->time / timeScale;
+
   const int nfields = _data->numCellFields;
-
-  const double t = _data->time;
   const int numTimeSteps = 1;
   if (0 == _data->cellsLabel) {
     writer.open(*_mesh, numTimeSteps);

Modified: short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5SubMesh.cc
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5SubMesh.cc	2011-10-14 18:27:24 UTC (rev 19073)
+++ short/3D/PyLith/branches/v1.6-stable/unittests/libtests/meshio/TestDataWriterHDF5SubMesh.cc	2011-10-14 19:39:12 UTC (rev 19074)
@@ -104,9 +104,11 @@
 
   writer.filename(_data->vertexFilename);
 
+  const double timeScale = 4.0;
+  writer.timeScale(timeScale);
+  const double t = _data->time / timeScale;
+
   const int nfields = _data->numVertexFields;
-
-  const double t = _data->time;
   const int numTimeSteps = 1;
   if (0 == _data->cellsLabel) {
     writer.open(*_submesh, numTimeSteps);
@@ -142,9 +144,11 @@
 
   writer.filename(_data->cellFilename);
 
+  const double timeScale = 4.0;
+  writer.timeScale(timeScale);
+  const double t = _data->time / timeScale;
+
   const int nfields = _data->numCellFields;
-
-  const double t = _data->time;
   const int numTimeSteps = 1;
   if (0 == _data->cellsLabel) {
     writer.open(*_submesh, numTimeSteps);

Added: short/3D/PyLith/branches/v1.6-stable/unittests/pytests/meshio/TestDataWriterHDF5Ext.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/unittests/pytests/meshio/TestDataWriterHDF5Ext.py	                        (rev 0)
+++ short/3D/PyLith/branches/v1.6-stable/unittests/pytests/meshio/TestDataWriterHDF5Ext.py	2011-10-14 19:39:12 UTC (rev 19074)
@@ -0,0 +1,140 @@
+#!/usr/bin/env python
+#
+# ======================================================================
+#
+# Brad T. Aagaard, U.S. Geological Survey
+# Charles A. Williams, GNS Science
+# Matthew G. Knepley, University of Chicago
+#
+# This code was developed as part of the Computational Infrastructure
+# for Geodynamics (http://geodynamics.org).
+#
+# Copyright (c) 2010-2011 University of California, Davis
+#
+# See COPYING for license information.
+#
+# ======================================================================
+#
+
+## @file unittests/pytests/meshio/TestDataWriterHDF5Ext.py
+
+## @brief Unit testing of Python DataWriterHDF5Ext object.
+
+import unittest
+
+from pylith.meshio.DataWriterHDF5ExtMesh import DataWriterHDF5ExtMesh
+from pylith.meshio.DataWriterHDF5ExtSubMesh import DataWriterHDF5ExtSubMesh
+from pylith.meshio.DataWriterHDF5ExtSubSubMesh import DataWriterHDF5ExtSubSubMesh
+
+# ----------------------------------------------------------------------
+class TestDataWriterHDF5ExtMesh(unittest.TestCase):
+  """
+  Unit testing of Python DataWriterHDF5ExtMesh object.
+  """
+
+  def test_constructor(self):
+    """
+    Test constructor.
+    """
+    filter = DataWriterHDF5ExtMesh()
+    filter._configure()
+    return
+
+
+  def test_initialize(self):
+    """
+    Test constructor.
+    """
+    filter = DataWriterHDF5ExtMesh()
+    filter._configure()
+
+    from spatialdata.units.Nondimensional import Nondimensional
+    normalizer = Nondimensional()
+    filter.initialize(normalizer)
+    return
+
+
+  def test_factory(self):
+    """
+    Test factory method.
+    """
+    from pylith.meshio.DataWriterHDF5ExtMesh import data_writer
+    filter = data_writer()
+    return
+
+
+# ----------------------------------------------------------------------
+class TestDataWriterHDF5ExtSubMesh(unittest.TestCase):
+  """
+  Unit testing of Python DataWriterHDF5Ext object.
+  """
+
+  def test_constructor(self):
+    """
+    Test constructor.
+    """
+    filter = DataWriterHDF5ExtSubMesh()
+    filter._configure()
+    return
+
+
+  def test_initialize(self):
+    """
+    Test constructor.
+    """
+    filter = DataWriterHDF5ExtSubMesh()
+    filter._configure()
+
+    from spatialdata.units.Nondimensional import Nondimensional
+    normalizer = Nondimensional()
+    filter.initialize(normalizer)
+    return
+
+
+  def test_factory(self):
+    """
+    Test factory method.
+    """
+    from pylith.meshio.DataWriterHDF5ExtSubMesh import data_writer
+    filter = data_writer()
+    return
+
+
+# ----------------------------------------------------------------------
+class TestDataWriterHDF5ExtSubSubMesh(unittest.TestCase):
+  """
+  Unit testing of Python DataWriterHDF5Ext object.
+  """
+
+  def test_constructor(self):
+    """
+    Test constructor.
+    """
+    filter = DataWriterHDF5ExtSubSubMesh()
+    filter._configure()
+    return
+
+
+  def test_initialize(self):
+    """
+    Test constructor.
+    """
+    filter = DataWriterHDF5ExtSubSubMesh()
+    filter._configure()
+
+    from spatialdata.units.Nondimensional import Nondimensional
+    normalizer = Nondimensional()
+    filter.initialize(normalizer)
+    return
+
+
+  def test_factory(self):
+    """
+    Test factory method.
+    """
+    from pylith.meshio.DataWriterHDF5ExtSubSubMesh import data_writer
+    filter = data_writer()
+    return
+
+
+# End of file 

Modified: short/3D/PyLith/branches/v1.6-stable/unittests/pytests/meshio/testhdf5.py
===================================================================
--- short/3D/PyLith/branches/v1.6-stable/unittests/pytests/meshio/testhdf5.py	2011-10-14 18:27:24 UTC (rev 19073)
+++ short/3D/PyLith/branches/v1.6-stable/unittests/pytests/meshio/testhdf5.py	2011-10-14 19:39:12 UTC (rev 19074)
@@ -69,6 +69,15 @@
     from TestDataWriterHDF5 import TestDataWriterHDF5SubSubMesh
     suite.addTest(unittest.makeSuite(TestDataWriterHDF5SubSubMesh))
 
+    from TestDataWriterHDF5Ext import TestDataWriterHDF5ExtMesh
+    suite.addTest(unittest.makeSuite(TestDataWriterHDF5ExtMesh))
+
+    from TestDataWriterHDF5Ext import TestDataWriterHDF5ExtSubMesh
+    suite.addTest(unittest.makeSuite(TestDataWriterHDF5ExtSubMesh))
+
+    from TestDataWriterHDF5Ext import TestDataWriterHDF5ExtSubSubMesh
+    suite.addTest(unittest.makeSuite(TestDataWriterHDF5ExtSubSubMesh))
+
     from TestXdmf import TestXdmf
     suite.addTest(unittest.makeSuite(TestXdmf))
 



More information about the CIG-COMMITS mailing list