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

brad at geodynamics.org brad at geodynamics.org
Thu May 26 17:01:39 PDT 2011


Author: brad
Date: 2011-05-26 17:01:39 -0700 (Thu, 26 May 2011)
New Revision: 18472

Modified:
   short/3D/PyLith/trunk/TODO
   short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5.cc
   short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5.hh
   short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5Ext.cc
   short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5Ext.hh
   short/3D/PyLith/trunk/libsrc/pylith/meshio/HDF5.cc
   short/3D/PyLith/trunk/libsrc/pylith/meshio/HDF5.hh
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_bc.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_bc_cell.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_bc_vertex.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_cell.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_fault.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_fault_cell.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_fault_vertex.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_mat.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_mat_cell.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_mat_vertex.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_surf.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_surf_cell.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_surf_vertex.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_vertex.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_cell.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_mat.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_mat_cell.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_mat_vertex.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_surf.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_surf_cell.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_surf_vertex.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_vertex.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_bc.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_bc_cell.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_bc_vertex.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_cell.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_fault.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_fault_cell.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_fault_vertex.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_mat.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_mat_cell.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_mat_vertex.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_surf.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_surf_cell.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_surf_vertex.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_vertex.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_bc.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_bc_cell.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_bc_vertex.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_cell.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_fault.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_fault_cell.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_fault_vertex.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_mat.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_mat_cell.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_mat_vertex.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_surf.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_surf_cell.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_surf_vertex.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_vertex.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_bc.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_bc_cell.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_bc_vertex.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_cell.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_fault.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_fault_cell.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_fault_vertex.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_mat.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_mat_cell.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_mat_vertex.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_surf.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_surf_cell.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_surf_vertex.h5
   short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_vertex.h5
Log:
Added time array to HDF5 output.

Modified: short/3D/PyLith/trunk/TODO
===================================================================
--- short/3D/PyLith/trunk/TODO	2011-05-27 00:00:05 UTC (rev 18471)
+++ short/3D/PyLith/trunk/TODO	2011-05-27 00:01:39 UTC (rev 18472)
@@ -14,6 +14,10 @@
   rate and state friction - sliding test
   predictor/corrector scheme?
 
+* CUBIT 12.2 versus 13.0 file format
+
+  Get coordinates from coord_x, coord_y, and coord_z rather than coord in 13.0
+
 * Unform global refinement
 
     Check refinement in parallel thoroughly.
@@ -34,8 +38,6 @@
 
 * Output to HDF5 files. [BRAD]
 
-  (1) Add time dataset to vertex_fields and cell_fields.
-
   (2) Add creation of .xmf metadata file for ParaView/Visit.
 
 * Field split.

Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5.cc	2011-05-27 00:00:05 UTC (rev 18471)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5.cc	2011-05-27 00:01:39 UTC (rev 18472)
@@ -27,7 +27,9 @@
 template<typename mesh_type, typename field_type>
 pylith::meshio::DataWriterHDF5<mesh_type,field_type>::DataWriterHDF5(void) :
   _filename("output.h5"),
-  _viewer(0)
+  _viewer(0),
+  _tstamp(0),
+  _tstampIndex(0)
 { // constructor
 } // constructor
 
@@ -45,10 +47,10 @@
 void
 pylith::meshio::DataWriterHDF5<mesh_type, field_type>::deallocate(void)
 { // deallocate
-  if (_viewer) {
-    PetscErrorCode err = PetscViewerDestroy(&_viewer); CHECK_PETSC_ERROR(err);
-  } // if
-  _viewer = 0;
+  PetscErrorCode err = 0;
+
+  err = PetscViewerDestroy(&_viewer); CHECK_PETSC_ERROR(err);
+  err = VecDestroy(&_tstamp); CHECK_PETSC_ERROR(err);
 } // deallocate
   
 // ----------------------------------------------------------------------
@@ -57,7 +59,9 @@
 pylith::meshio::DataWriterHDF5<mesh_type,field_type>::DataWriterHDF5(const DataWriterHDF5<mesh_type, field_type>& w) :
   DataWriter<mesh_type, field_type>(w),
   _filename(w._filename),
-  _viewer(0)
+  _viewer(0),
+  _tstamp(0),
+  _tstampIndex(0)
 { // copy constructor
 } // copy constructor
 
@@ -82,14 +86,22 @@
     
     const std::string& filename = _hdf5Filename();
 
+    const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
+    assert(!sieveMesh.isNull());
+
     _timesteps.clear();
+    _tstampIndex = 0;
+    const int rank = sieveMesh->commRank();
+    const int localSize = (!rank) ? 1 : 0;
+    err = VecCreateMPI(mesh.comm(), localSize, PETSC_DETERMINE, &_tstamp);
+    CHECK_PETSC_ERROR(err);
+    err = VecSetBlockSize(_tstamp, 1); CHECK_PETSC_ERROR(err);
+    err = PetscObjectSetName((PetscObject) _tstamp, "time");
 
     err = PetscViewerHDF5Open(mesh.comm(), filename.c_str(), FILE_MODE_WRITE,
 			      &_viewer);
     CHECK_PETSC_ERROR(err);
 
-    const ALE::Obj<SieveMesh>& sieveMesh = mesh.sieveMesh();
-    assert(!sieveMesh.isNull());
     const ALE::Obj<typename mesh_type::RealSection>& coordinatesSection = 
       sieveMesh->hasRealSection("coordinates_dimensioned") ?
       sieveMesh->getRealSection("coordinates_dimensioned") :
@@ -202,11 +214,12 @@
 void
 pylith::meshio::DataWriterHDF5<mesh_type,field_type>::close(void)
 { // close
-  if (_viewer) {
-    PetscViewerDestroy(&_viewer);
-  } // if
-  _viewer = 0;
+  PetscErrorCode err = 0;
+  err = PetscViewerDestroy(&_viewer); CHECK_PETSC_ERROR(err);
+  err = VecDestroy(&_tstamp); CHECK_PETSC_ERROR(err);
+
   _timesteps.clear();
+  _tstampIndex = 0;
 
 #if 0
   Xdmf metafile;
@@ -264,6 +277,9 @@
     else
       _timesteps[field.label()] += 1;
     const int istep = _timesteps[field.label()];
+    // Add time stamp to "/vertex_fields/time" if necessary.
+    if (_tstampIndex == istep)
+      _writeTimeStamp(t, "/vertex_fields", sieveMesh->commRank());
 
 #if 0 // debugging
     field.view("writeVertexField");
@@ -346,6 +362,9 @@
     else
       _timesteps[field.label()] += 1;
     const int istep = _timesteps[field.label()];
+    // Add time stamp to "/cell_fields/time" if necessary.
+    if (_tstampIndex == istep)
+      _writeTimeStamp(t, "/cell_fields", sieveMesh->commRank());
 
     // Set temporary block size that matches fiber dimension for output.
     int blockSize = 0;
@@ -390,4 +409,29 @@
 } // _hdf5Filename
 
 
+// ----------------------------------------------------------------------
+// Write time stamp to file.
+template<typename mesh_type, typename field_type>
+void
+pylith::meshio::DataWriterHDF5<mesh_type,field_type>::_writeTimeStamp(const double t,
+								      const char* group,
+								      const int rank)
+{ // _writeTimeStamp
+  PetscErrorCode err = 0;
+
+  if (!rank) {
+    err = VecSetValue(_tstamp, 0, t, INSERT_VALUES); CHECK_PETSC_ERROR(err);
+  } // if
+  err = VecAssemblyBegin(_tstamp); CHECK_PETSC_ERROR(err);
+  err = VecAssemblyEnd(_tstamp); CHECK_PETSC_ERROR(err);
+  
+  err = PetscViewerHDF5PushGroup(_viewer, group); CHECK_PETSC_ERROR(err);
+  err = PetscViewerHDF5SetTimestep(_viewer, _tstampIndex); CHECK_PETSC_ERROR(err);
+  err = VecView(_tstamp, _viewer); CHECK_PETSC_ERROR(err);
+  err = PetscViewerHDF5PopGroup(_viewer); CHECK_PETSC_ERROR(err);
+
+  _tstampIndex++;
+} // _writeTimeStamp
+
+
 // End of file 

Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5.hh	2011-05-27 00:00:05 UTC (rev 18471)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5.hh	2011-05-27 00:01:39 UTC (rev 18472)
@@ -132,6 +132,16 @@
   /// Generate filename for HDF5 file.
   std::string _hdf5Filename(void) const;
 
+  /** Write time stamp to file.
+   *
+   * @param t Time in seconds.
+   * @param group Name of group ['/vertex_fields' or '/cell_fields']
+   * @param rank Processor rank in MPI communicator.
+   */
+  void _writeTimeStamp(const double t,
+		       const char* group,
+		       const int rank);
+
 // NOT IMPLEMENTED //////////////////////////////////////////////////////
 private :
 
@@ -141,9 +151,11 @@
 private :
 
   std::string _filename; ///< Name of HDF5 file.
-  PetscViewer _viewer; ///< Output file
+  PetscViewer _viewer; ///< Output file.
+  PetscVec _tstamp; ///< Single value vector holding time stemp.
 
   std::map<std::string, int> _timesteps; ///< # of time steps written per field.
+  int _tstampIndex; ///< Index of last time stamp written.
 
 }; // DataWriterHDF5
 

Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5Ext.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5Ext.cc	2011-05-27 00:00:05 UTC (rev 18471)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5Ext.cc	2011-05-27 00:01:39 UTC (rev 18472)
@@ -29,7 +29,8 @@
 template<typename mesh_type, typename field_type>
 pylith::meshio::DataWriterHDF5Ext<mesh_type,field_type>::DataWriterHDF5Ext(void) :
   _filename("output.h5"),
-  _h5(new HDF5)
+  _h5(new HDF5),
+  _tstampIndex(0)
 { // constructor
 } // constructor
 
@@ -53,8 +54,8 @@
        d_iter != dEnd;
        ++d_iter)
     if (d_iter->second.viewer) {
-      PetscViewerDestroy(&d_iter->second.viewer);
-      d_iter->second.viewer = 0;
+      PetscErrorCode err = PetscViewerDestroy(&d_iter->second.viewer);
+      CHECK_PETSC_ERROR(err);
     } // if
 } // deallocate
   
@@ -64,7 +65,8 @@
 pylith::meshio::DataWriterHDF5Ext<mesh_type,field_type>::DataWriterHDF5Ext(const DataWriterHDF5Ext<mesh_type, field_type>& w) :
   DataWriter<mesh_type, field_type>(w),
   _filename(w._filename),
-  _h5(new HDF5)
+  _h5(new HDF5),
+  _tstampIndex(0)
 { // copy constructor
 } // copy constructor
 
@@ -100,6 +102,7 @@
       _h5->createGroup("/topology");
       _h5->createGroup("/geometry");
     } // if
+    _tstampIndex = 0;
 
     PetscViewer binaryViewer;
     PetscErrorCode err = 0;
@@ -258,6 +261,7 @@
   if (_h5->isOpen()) {
     _h5->close();
   } // if
+  _tstampIndex = 0;
   deallocate();
 } // close
 
@@ -372,6 +376,8 @@
 	_h5->extendDatasetRawExternal("/vertex_fields", field.label(),
 				      dims, ndims);
       } // if/else
+      if (_tstampIndex+1 == _datasets[field.label()].numTimeSteps)
+	_writeTimeStamp(t, "/vertex_fields");
     } // if
 
   } catch (const std::exception& err) {
@@ -452,33 +458,23 @@
     CHECK_PETSC_ERROR(err);
     ++_datasets[field.label()].numTimeSteps;
 
-    if (createdExternalDataset) {
-      // Add new external dataset to HDF5 file.
-      const ALE::Obj<typename mesh_type::SieveMesh>& sieveMesh = 
-	field.mesh().sieveMesh();
-      assert(!sieveMesh.isNull());
-      const int cellDepth = (sieveMesh->depth() == -1) ? -1 : 1;
-      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<typename mesh_type::SieveMesh::numbering_type>& numbering = 
-	sieveMesh->getFactory()->getNumbering(sieveMesh, labelName, depth);
-      assert(!numbering.isNull());
-      assert(!sieveMesh->getLabelStratum(labelName, depth).isNull());
-      const ALE::Obj<typename mesh_type::RealSection>& section = field.section();
-      assert(!section.isNull());
+    assert(!sieveMesh->getLabelStratum(labelName, depth).isNull());
+    const ALE::Obj<typename mesh_type::RealSection>& section = field.section();
+    assert(!section.isNull());
       
-      int fiberDimLocal = 
-	(sieveMesh->getLabelStratum(labelName, depth)->size() > 0) ? 
-	section->getFiberDimension(*sieveMesh->getLabelStratum(labelName, depth)->begin()) : 0;
-      int fiberDim = 0;
-      MPI_Allreduce(&fiberDimLocal, &fiberDim, 1, MPI_INT, MPI_MAX,
-		    field.mesh().comm());
-      assert(fiberDim > 0);
+    int fiberDimLocal = 
+      (sieveMesh->getLabelStratum(labelName, depth)->size() > 0) ? 
+      section->getFiberDimension(*sieveMesh->getLabelStratum(labelName, depth)->begin()) : 0;
+    int fiberDim = 0;
+    MPI_Allreduce(&fiberDimLocal, &fiberDim, 1, MPI_INT, MPI_MAX,
+		  field.mesh().comm());
+    assert(fiberDim > 0);
 
-      if (!rank) {
+
+    if (!rank) {
+      if (createdExternalDataset) {
+      // Add new external dataset to HDF5 file.
+
 	const int numTimeSteps =
 	  DataWriter<mesh_type, field_type>::_numTimeSteps;
 	const hsize_t ndims = (numTimeSteps > 0) ? 3 : 2;
@@ -498,7 +494,24 @@
 	_h5->createDatasetRawExternal("/cell_fields", field.label(),
 				      _datasetFilename(field.label()).c_str(),
 				      dims, ndims, H5T_IEEE_F64BE);
-      } // else
+      } else {
+	// Update number of time steps in external dataset info in HDF5 file.
+	const int totalNumTimeSteps = 
+	  DataWriter<mesh_type, field_type>::_numTimeSteps;
+	assert(totalNumTimeSteps > 0);
+	const int numTimeSteps = _datasets[field.label()].numTimeSteps;
+	
+	const hsize_t ndims = 3;
+	hsize_t dims[3];
+	dims[0] = numTimeSteps; // update to current value
+	dims[1] = numbering->getGlobalSize();
+	dims[2] = fiberDim;
+	_h5->extendDatasetRawExternal("/cell_fields", field.label(),
+				      dims, ndims);
+      } // if/else
+      // Update time stamp in "/cell_fields/time, if necessary.
+      if (_tstampIndex+1 == _datasets[field.label()].numTimeSteps)
+	_writeTimeStamp(t, "/cell_fields");
     } // if
 
   } catch (const std::exception& err) {
@@ -546,5 +559,46 @@
   return std::string(filenameS.str());
 } // _datasetFilename
 
+// ----------------------------------------------------------------------
+// Write time stamp to file.
+template<typename mesh_type, typename field_type>
+void
+pylith::meshio::DataWriterHDF5Ext<mesh_type,field_type>::_writeTimeStamp(
+						  const double t,
+						  const char* group)
+{ // _writeTimeStamp
+  assert(_h5);
 
+  assert(_h5->hasGroup(group));
+  std::string datasetFullName = std::string(group) + "/time";
+
+  const int ndims = 1;
+
+  // Each time stamp has a size of 1.
+  hsize_t dimsChunk[1];
+  dimsChunk[0] = 1;
+
+  
+
+  if (!_h5->hasDataset(datasetFullName.c_str())) {
+    // Create dataset
+    // Dataset has unknown size.
+    hsize_t dims[1];
+    dims[0] = H5S_UNLIMITED;
+    _h5->createDataset(group, "time", dims, dimsChunk, ndims, 
+		       H5T_NATIVE_DOUBLE);
+  } // if
+  
+  // Write time stamp as chunk to HDF5 file.
+  // Current dimensions of dataset.
+  hsize_t dims[1];
+  dims[0] = _tstampIndex+1;
+  _h5->writeDatasetChunk(group, "time", &t, dims, dimsChunk, ndims, 
+			 _tstampIndex, H5T_NATIVE_DOUBLE);
+  
+  _tstampIndex++;
+} // _writeTimeStamp
+
+
+
 // End of file 

Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5Ext.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5Ext.hh	2011-05-27 00:00:05 UTC (rev 18471)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5Ext.hh	2011-05-27 00:01:39 UTC (rev 18472)
@@ -136,6 +136,14 @@
   /// Generate filename for external dataset file.
   std::string _datasetFilename(const char* field) const;
 
+  /** Write time stamp to file.
+   *
+   * @param t Time in seconds.
+   * @param group Name of group ['/vertex_fields' or '/cell_fields']
+   */
+  void _writeTimeStamp(const double t,
+		       const char* group);  
+
 // NOT IMPLEMENTED //////////////////////////////////////////////////////
 private :
 
@@ -156,6 +164,7 @@
   std::string _filename; ///< Name of HDF5 file.
   HDF5* _h5; ///< HDF5 file
   dataset_type _datasets; ///< Datasets
+  int _tstampIndex; ///< Index of last time stamp written.
 
 }; // DataWriterHDF5Ext
 

Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/HDF5.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/HDF5.cc	2011-05-27 00:00:05 UTC (rev 18471)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/HDF5.cc	2011-05-27 00:01:39 UTC (rev 18472)
@@ -484,7 +484,7 @@
       throw std::runtime_error("Could not open group.");
 
     // Create the dataspace
-    hid_t dataspace = H5Screate_simple(ndims, dims, 0);
+    hid_t dataspace = H5Screate_simple(ndims, dimsChunk, dims);
     if (dataspace < 0)
       throw std::runtime_error("Could not create dataspace.");
       
@@ -588,6 +588,15 @@
     if (dataset < 0)
       throw std::runtime_error("Could not open dataset.");
     
+#if defined(PYLITH_HDF5_USE_API_18)
+    herr_t err = H5Dset_extent(dataset, dims);
+#else
+    herr_t err = H5Dextend(dataset, dims);
+#endif
+    if (err < 0)
+      throw std::runtime_error("Could not set dataset extent.");
+
+
     hid_t dataspace = H5Dget_space(dataset);
     if (dataspace < 0)
       throw std::runtime_error("Could not get dataspace.");
@@ -596,8 +605,8 @@
     if (chunkspace < 0)
       throw std::runtime_error("Could not create chunk dataspace.");
 
-    herr_t err = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET,
-				     offset, stride, count, dimsChunk);
+    err = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET,
+			      offset, stride, count, dimsChunk);
     delete[] count; count = 0;
     delete[] stride; stride = 0;
     delete[] offset; offset = 0;

Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/HDF5.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/HDF5.hh	2011-05-27 00:00:05 UTC (rev 18471)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/HDF5.hh	2011-05-27 00:01:39 UTC (rev 18472)
@@ -173,7 +173,7 @@
    *
    * @param parent Full path of parent group for dataset.
    * @param name Name of dataset.
-   * @param dims Dimensions of data.
+   * @param dims Maximum dimensions of data.
    * @param dimsChunk Dimensions of data chunks.
    * @param ndims Number of dimensions of data.
    * @param datatype Type of data.
@@ -190,8 +190,8 @@
    * @param parent Full path of parent group for dataset.
    * @param name Name of dataset.
    * @param data Data.
-   * @param dims Dimensions of data.
-   * @param dimsChunk Dimensions of data chunks.
+   * @param dims Current total dimensions of data.
+   * @param dimsChunk Dimension of data chunk to write.
    * @param ndims Number of dimensions of data.
    * @param chunk Index of data chunk.
    * @param datatype Type of data.

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_bc.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_bc_cell.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_bc_vertex.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_cell.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_fault.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_fault_cell.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_fault_vertex.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_mat.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_mat_cell.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_mat_vertex.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_surf.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_surf_cell.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_surf_vertex.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/hex8_vertex.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_cell.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_mat.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_mat_cell.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_mat_vertex.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_surf.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_surf_cell.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_surf_vertex.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/line2_vertex.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_bc.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_bc_cell.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_bc_vertex.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_cell.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_fault.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_fault_cell.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_fault_vertex.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_mat.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_mat_cell.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_mat_vertex.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_surf.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_surf_cell.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_surf_vertex.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/quad4_vertex.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_bc.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_bc_cell.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_bc_vertex.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_cell.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_fault.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_fault_cell.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_fault_vertex.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_mat.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_mat_cell.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_mat_vertex.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_surf.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_surf_cell.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_surf_vertex.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tet4_vertex.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_bc.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_bc_cell.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_bc_vertex.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_cell.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_fault.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_fault_cell.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_fault_vertex.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_mat.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_mat_cell.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_mat_vertex.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_surf.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_surf_cell.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_surf_vertex.h5
===================================================================
(Binary files differ)

Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_vertex.h5
===================================================================
(Binary files differ)



More information about the CIG-COMMITS mailing list