[cig-commits] r19101 - short/3D/PyLith/trunk/libsrc/pylith/meshio

brad at geodynamics.org brad at geodynamics.org
Thu Oct 20 10:28:30 PDT 2011


Author: brad
Date: 2011-10-20 10:28:30 -0700 (Thu, 20 Oct 2011)
New Revision: 19101

Modified:
   short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5Ext.cc
Log:
More fixes for single precision.

Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5Ext.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5Ext.cc	2011-10-20 02:23:07 UTC (rev 19100)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/DataWriterHDF5Ext.cc	2011-10-20 17:28:30 UTC (rev 19101)
@@ -107,6 +107,9 @@
     PetscViewer binaryViewer;
     PetscErrorCode err = 0;
     
+    const hid_t scalartype = (sizeof(double) == sizeof(PylithScalar)) ? 
+      H5T_IEEE_F64BE : H5T_IEEE_F32BE;
+
     const ALE::Obj<typename mesh_type::SieveMesh>& sieveMesh = mesh.sieveMesh();
     assert(!sieveMesh.isNull());
 
@@ -153,7 +156,7 @@
       dims[1] = cs->spaceDim();
       _h5->createDatasetRawExternal("/geometry", "vertices", 
 				    filenameVertices.c_str(),
-				    dims, ndims, H5T_IEEE_F64BE);
+				    dims, ndims, scalartype);
     } // if
     
     // Write cells
@@ -239,7 +242,7 @@
       dims[0] = cNumbering->getGlobalSize();
       dims[1] = numCorners;
       _h5->createDatasetRawExternal("/topology", "cells", filenameCells.c_str(),
-				    dims, ndims, H5T_IEEE_F64BE);
+				    dims, ndims, scalartype);
       const int cellDim = mesh.dimension();
       _h5->writeAttribute("/topology/cells", "cell_dim", (void*)&cellDim,
 			  H5T_NATIVE_INT);
@@ -317,6 +320,9 @@
     PetscViewer binaryViewer;
     PetscErrorCode err = 0;
 
+    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()) {
@@ -375,7 +381,7 @@
 	
 	_h5->createDatasetRawExternal("/vertex_fields", field.label(),
 				      _datasetFilename(field.label()).c_str(),
-				      maxDims, ndims, H5T_IEEE_F64BE);
+				      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()));
@@ -453,6 +459,9 @@
     PetscViewer binaryViewer;
     PetscErrorCode err = 0;
 
+    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()) {
@@ -512,7 +521,7 @@
 	
 	_h5->createDatasetRawExternal("/cell_fields", field.label(),
 				      _datasetFilename(field.label()).c_str(),
-				      maxDims, ndims, H5T_IEEE_F64BE);
+				      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()));



More information about the CIG-COMMITS mailing list