[cig-commits] r18731 - short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio

brad at geodynamics.org brad at geodynamics.org
Mon Jul 11 14:01:41 PDT 2011


Author: brad
Date: 2011-07-11 14:01:41 -0700 (Mon, 11 Jul 2011)
New Revision: 18731

Modified:
   short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/DataWriterHDF5Ext.cc
Log:
Fixed bug in setting size of external dataset. HDF5 expects maxDims not current dims.

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-07-11 20:28:34 UTC (rev 18730)
+++ short/3D/PyLith/branches/v1.6-stable/libsrc/pylith/meshio/DataWriterHDF5Ext.cc	2011-07-11 21:01:41 UTC (rev 18731)
@@ -347,14 +347,14 @@
 	const int numTimeSteps
 	  = DataWriter<mesh_type, field_type>::_numTimeSteps;
 	const hsize_t ndims = (numTimeSteps > 0) ? 3 : 2;
-	hsize_t dims[3];
+	hsize_t maxDims[3];
 	if (3 == ndims) {
-	  dims[0] = 1; // external file only constains 1 time step so far.
-	  dims[1] = vNumbering->getGlobalSize();
-	  dims[2] = fiberDim;
+	  maxDims[0] = H5S_UNLIMITED;
+	  maxDims[1] = vNumbering->getGlobalSize();
+	  maxDims[2] = fiberDim;
 	} else {
-	  dims[0] = vNumbering->getGlobalSize();
-	  dims[1] = fiberDim;
+	  maxDims[0] = vNumbering->getGlobalSize();
+	  maxDims[1] = fiberDim;
 	} // else
 	// Create 'vertex_fields' group if necessary.
 	if (!_h5->hasGroup("/vertex_fields"))
@@ -362,7 +362,7 @@
 	
 	_h5->createDatasetRawExternal("/vertex_fields", field.label(),
 				      _datasetFilename(field.label()).c_str(),
-				      dims, ndims, H5T_IEEE_F64BE);
+				      maxDims, ndims, H5T_IEEE_F64BE);
 	std::string fullName = std::string("/vertex_fields/") + field.label();
 	_h5->writeAttribute(fullName.c_str(), "vector_field_type",
 			    topology::FieldBase::vectorFieldString(field.vectorFieldType()));
@@ -484,14 +484,14 @@
 	const int numTimeSteps =
 	  DataWriter<mesh_type, field_type>::_numTimeSteps;
 	const hsize_t ndims = (numTimeSteps > 0) ? 3 : 2;
-	hsize_t dims[3];
+	hsize_t maxDims[3];
 	if (3 == ndims) {
-	  dims[0] = 1; // external file only constains 1 time step so far.
-	  dims[1] = numbering->getGlobalSize();
-	  dims[2] = fiberDim;
+	  maxDims[0] = H5S_UNLIMITED;
+	  maxDims[1] = numbering->getGlobalSize();
+	  maxDims[2] = fiberDim;
 	} else {
-	  dims[0] = numbering->getGlobalSize();
-	  dims[1] = fiberDim;
+	  maxDims[0] = numbering->getGlobalSize();
+	  maxDims[1] = fiberDim;
 	} // else
 	// Create 'cell_fields' group if necessary.
 	if (!_h5->hasGroup("/cell_fields"))
@@ -499,7 +499,7 @@
 	
 	_h5->createDatasetRawExternal("/cell_fields", field.label(),
 				      _datasetFilename(field.label()).c_str(),
-				      dims, ndims, H5T_IEEE_F64BE);
+				      maxDims, ndims, H5T_IEEE_F64BE);
 	std::string fullName = std::string("/cell_fields/") + field.label();
 	_h5->writeAttribute(fullName.c_str(), "vector_field_type",
 			    topology::FieldBase::vectorFieldString(field.vectorFieldType()));



More information about the CIG-COMMITS mailing list