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

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Thu May 20 12:06:55 CDT 2010


Author: kraftche
Date: 2010-05-20 12:06:55 -0500 (Thu, 20 May 2010)
New Revision: 3928

Modified:
   MOAB/trunk/src/io/ReadHDF5.cpp
Log:
fix bugs reading dense-formatted tag data

Modified: MOAB/trunk/src/io/ReadHDF5.cpp
===================================================================
--- MOAB/trunk/src/io/ReadHDF5.cpp	2010-05-20 14:27:49 UTC (rev 3927)
+++ MOAB/trunk/src/io/ReadHDF5.cpp	2010-05-20 17:06:55 UTC (rev 3928)
@@ -3066,11 +3066,18 @@
   rval = iFace->tag_get_data_type( tag_handle, mb_type );
   if (MB_SUCCESS != rval) 
     return error(rval);
+
   
-  hsize_t read_size = 0;
-  if (mb_type == MB_TYPE_HANDLE) {
-    read_size = H5Tget_size( hdf_read_type );
-    if (!read_size)
+  int read_size;
+  rval = iFace->tag_get_size( tag_handle, read_size );
+  if (MB_SUCCESS != rval) // wrong function for variable-length tags
+    return error(rval);
+  if (MB_TYPE_BIT == mb_type) 
+    read_size = (read_size + 7)/8; // convert bits to bytes, plus 7 for ceiling
+    
+  if (hdf_read_type) { // if not opaque
+    hsize_t hdf_size = H5Tget_size( hdf_read_type );
+    if (hdf_size != (hsize_t)read_size) 
       return error(MB_FAILURE);
   }
   
@@ -3099,7 +3106,7 @@
     long count = file_ids.const_pair_begin()->second - first + 1;
     if (buffer_size < count)
       count = buffer_size;
-    file_ids.erase( file_ids.begin(), file_ids.begin() + (count - 1) );
+    file_ids.erase( file_ids.begin(), file_ids.begin() + count );
     
     assert_range( dataBuffer, count );
     mhdf_readDenseTagWithOpt( data, first - start_id, count, hdf_read_type, 

















More information about the moab-dev mailing list