[MOAB-dev] r4850 - in MOAB/trunk/src: io parallel
kraftche at cae.wisc.edu
kraftche at cae.wisc.edu
Thu May 19 15:15:31 CDT 2011
Author: kraftche
Date: 2011-05-19 15:15:31 -0500 (Thu, 19 May 2011)
New Revision: 4850
Added:
MOAB/trunk/src/io/HDF5Common.cpp
MOAB/trunk/src/io/HDF5Common.hpp
Modified:
MOAB/trunk/src/io/Makefile.am
MOAB/trunk/src/io/ReadHDF5.cpp
MOAB/trunk/src/io/ReadHDF5.hpp
MOAB/trunk/src/io/WriteHDF5.hpp
MOAB/trunk/src/parallel/WriteHDF5Parallel.cpp
MOAB/trunk/src/parallel/WriteHDF5Parallel.hpp
Log:
auto-detect application of HDF5 hyperslab append hack
Added: MOAB/trunk/src/io/HDF5Common.cpp
===================================================================
--- MOAB/trunk/src/io/HDF5Common.cpp (rev 0)
+++ MOAB/trunk/src/io/HDF5Common.cpp 2011-05-19 20:15:31 UTC (rev 4850)
@@ -0,0 +1,42 @@
+#include <HDF5Common.hpp>
+#include <H5Spublic.h>
+#include <assert.h>
+
+namespace moab {
+
+bool HDF5_can_append_hyperslabs()
+{
+ hsize_t dim = 100;
+ hid_t space = H5Screate_simple( 1, &dim, NULL );
+ bool result = false;
+
+ HDF5_Error_Func_Type fptr = 0;
+ void* fdata = 0;
+#if defined(H5Eget_auto_vers) && H5Eget_auto_vers > 1
+ if (0 <= H5Eget_auto( H5E_DEFAULT, &fptr, &fdata ))
+ H5Eset_auto( H5E_DEFAULT, 0, 0 );
+#else
+ if (0 <= H5Eget_auto( &fptr, &fdata ))
+ H5Eset_auto( 0, 0 );
+#endif
+
+
+ hsize_t start = 1, count = 5;
+ H5Sselect_hyperslab( space, H5S_SELECT_SET, &start, 0, &count, 0 );
+ start = 20;
+ if (0 <= H5Sselect_hyperslab( space, H5S_SELECT_APPEND, &start, 0, &count, 0 ))
+ result = true;
+
+ if (fptr) {
+#if defined(H5Eset_auto_vers) && H5Eset_auto_vers > 1
+ H5Eset_auto( H5E_DEFAULT, fptr, fdata );
+#else
+ H5Eset_auto( fptr, fdata );
+#endif
+ }
+ H5Sclose( space );
+
+ return result;
+}
+
+}
Added: MOAB/trunk/src/io/HDF5Common.hpp
===================================================================
--- MOAB/trunk/src/io/HDF5Common.hpp (rev 0)
More information about the moab-dev
mailing list