[cig-commits] r18495 - in short/3D/PyLith/trunk: libsrc/pylith/meshio unittests/libtests/meshio
brad at geodynamics.org
brad at geodynamics.org
Mon May 30 14:56:15 PDT 2011
Author: brad
Date: 2011-05-30 14:56:15 -0700 (Mon, 30 May 2011)
New Revision: 18495
Modified:
short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5Ext.cc
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/TestHDF5.cc
Log:
Clean up setting current, maximum, and chunk sizes for HDF5 output.
Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5Ext.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5Ext.cc 2011-05-30 21:45:33 UTC (rev 18494)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5Ext.cc 2011-05-30 21:56:15 UTC (rev 18495)
@@ -598,7 +598,7 @@
// Create dataset
// Dataset has unknown size.
hsize_t dims[3];
- dims[0] = 1;
+ dims[0] = H5S_UNLIMITED;
dims[1] = 1;
dims[2] = 1;
_h5->createDataset("/", "time", dims, dimsChunk, ndims,
Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/HDF5.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/HDF5.cc 2011-05-30 21:45:33 UTC (rev 18494)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/HDF5.cc 2011-05-30 21:56:15 UTC (rev 18495)
@@ -686,14 +686,15 @@
void
pylith::meshio::HDF5::createDataset(const char* parent,
const char* name,
- const hsize_t* dims,
+ const hsize_t* maxDims,
const hsize_t* dimsChunk,
const int ndims,
hid_t datatype)
{ // createDataset
assert(parent);
assert(name);
- assert(dims);
+ assert(maxDims);
+ assert(dimsChunk);
try {
// Open group
@@ -706,13 +707,13 @@
throw std::runtime_error("Could not open group.");
// Create the dataspace
- hsize_t *maxDims = (ndims > 0) ? new hsize_t[ndims] : 0;
+ hsize_t *curDims = (ndims > 0) ? new hsize_t[ndims] : 0;
if (ndims > 0)
- maxDims[0] = H5S_UNLIMITED;
+ curDims[0] = (maxDims[0] == H5S_UNLIMITED) ? 1 : maxDims[0];
for (int i=1; i < ndims; ++i)
- maxDims[i] = dims[i];
- hid_t dataspace = H5Screate_simple(ndims, dims, maxDims);
- delete[] maxDims; maxDims = 0;
+ curDims[i] = maxDims[i];
+ hid_t dataspace = H5Screate_simple(ndims, curDims, maxDims);
+ delete[] curDims; curDims = 0;
if (dataspace < 0)
throw std::runtime_error("Could not create dataspace.");
@@ -996,14 +997,14 @@
pylith::meshio::HDF5::createDatasetRawExternal(const char* parent,
const char* name,
const char* filename,
- const hsize_t* dims,
+ const hsize_t* maxDims,
const int ndims,
hid_t datatype)
{ // createDatasetRawExternal
assert(parent);
assert(name);
assert(filename);
- assert(dims);
+ assert(maxDims);
try {
// Open group
@@ -1016,13 +1017,13 @@
throw std::runtime_error("Could not open group.");
// Create the dataspace
- hsize_t* maxDims = (ndims > 0) ? new hsize_t[ndims] : 0;
+ hsize_t* curDims = (ndims > 0) ? new hsize_t[ndims] : 0;
if (ndims > 0)
- maxDims[0] = H5S_UNLIMITED;
+ curDims[0] = (maxDims[0] == H5S_UNLIMITED) ? 1 : maxDims[0];
for (int i=1; i < ndims; ++i)
- maxDims[i] = dims[i];
- hid_t dataspace = H5Screate_simple(ndims, dims, maxDims);
- delete[] maxDims; maxDims = 0;
+ curDims[i] = maxDims[i];
+ hid_t dataspace = H5Screate_simple(ndims, curDims, maxDims);
+ delete[] curDims; curDims = 0;
if (dataspace < 0)
throw std::runtime_error("Could not create dataspace.");
Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/HDF5.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/HDF5.hh 2011-05-30 21:45:33 UTC (rev 18494)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/HDF5.hh 2011-05-30 21:56:15 UTC (rev 18495)
@@ -185,14 +185,14 @@
*
* @param parent Full path of parent group for dataset.
* @param name Name of dataset.
- * @param dims Maximum dimensions of data.
+ * @param maxDims Maximum dimensions of data.
* @param dimsChunk Dimensions of data chunks.
* @param ndims Number of dimensions of data.
* @param datatype Type of data.
*/
void createDataset(const char* parent,
const char* name,
- const hsize_t* dims,
+ const hsize_t* maxDims,
const hsize_t* dimsChunk,
const int ndims,
hid_t datatype);
@@ -243,14 +243,14 @@
* @param parent Full path of parent group for dataset.
* @param name Name of dataset.
* @param filename Name of external raw data file.
- * @param dims Dimensions of data.
+ * @param maxDims Maximum dimensions of data.
* @param ndims Number of dimensions of data.
* @param datatype Type of data.
*/
void createDatasetRawExternal(const char* parent,
const char* name,
const char* filename,
- const hsize_t* dims,
+ const hsize_t* maxDims,
const int ndims,
hid_t datatype);
Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/TestHDF5.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/TestHDF5.cc 2011-05-30 21:45:33 UTC (rev 18494)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/TestHDF5.cc 2011-05-30 21:56:15 UTC (rev 18495)
@@ -330,7 +330,7 @@
fout.close();
HDF5 h5("test.h5", H5F_ACC_TRUNC);
- dims[0] = 2;
+ dims[0] = H5S_UNLIMITED;
dims[1] = dimsE[1];
h5.createDatasetRawExternal("/", "data", "test.dat", dims, ndimsE,
H5T_NATIVE_INT);
More information about the CIG-COMMITS
mailing list