[MOAB-dev] r4596 - MOAB/trunk/src/io

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Tue Mar 15 18:14:43 CDT 2011


Author: kraftche
Date: 2011-03-15 18:14:43 -0500 (Tue, 15 Mar 2011)
New Revision: 4596

Modified:
   MOAB/trunk/src/io/WriteHDF5.cpp
   MOAB/trunk/src/io/WriteHDF5.hpp
Log:
debug code to help find where in WriteHDF5 a failing HDF5 call is made

Modified: MOAB/trunk/src/io/WriteHDF5.cpp
===================================================================
--- MOAB/trunk/src/io/WriteHDF5.cpp	2011-03-15 23:13:50 UTC (rev 4595)
+++ MOAB/trunk/src/io/WriteHDF5.cpp	2011-03-15 23:14:43 UTC (rev 4596)
@@ -47,6 +47,7 @@
 #endif 
 #include <H5Tpublic.h>
 #include <H5Ppublic.h>
+#include <H5Epublic.h>
 #include "moab/Interface.hpp"
 #include "Internals.hpp"
 #include "MBTagConventions.hpp"
@@ -141,6 +142,33 @@
   { return rval; }
 
 
+// Call \c error function during HDF5 library errors to make
+// it easier to trap such errors in the debugger.  This function
+// gets registered with the HDF5 library as a callback.  It
+// works the same as the default (H5Eprint), except that it 
+// also calls the \c error fuction as a no-op.
+#if defined(H5E_auto_t_vers) && H5E_auto_t_vers > 1
+static herr_t handle_hdf5_error( hid_t stack, void* data )
+{
+  WriteHDF5::HDF5ErrorHandler* h = reinterpret_cast<WriteHDF5::HDF5ErrorHandler*>(data);
+  herr_t result = 0;
+  if (h->func)
+    result = (*h->func)(stack,h->data);
+  error(MB_FAILURE);
+  return result;
+}
+#else
+static herr_t handle_hdf5_error( void* data )
+{
+  WriteHDF5::HDF5ErrorHandler* h = reinterpret_cast<WriteHDF5::HDF5ErrorHandler*>(data);
+  herr_t result = 0;
+  if (h->func)
+    result = (*h->func)(h->data);
+  error(MB_FAILURE);
+  return result;
+}
+#endif
+
   // Some macros to handle error checking.  The
   // CHK_MHDF__ERR* macros check the value of an mhdf_Status 
   // object.  The CHK_MB_ERR_* check the value of an ErrorCode.
@@ -374,6 +402,28 @@
   CHK_MB_ERR_0(rval);
 
   idMap.clear();
+  


More information about the moab-dev mailing list