[MOAB-dev] r1573 - MOAB/trunk

kraftche at mcs.anl.gov kraftche at mcs.anl.gov
Thu Jan 31 16:40:17 CST 2008


Author: kraftche
Date: 2008-01-31 16:40:16 -0600 (Thu, 31 Jan 2008)
New Revision: 1573

Modified:
   MOAB/trunk/WriteHDF5.cpp
Log:
Add proper testing for invalid (stale) handles in set contents.  Rather 
than relying on old dense tag behavior, where we get back the default value 
for invalid handles, check the return code and explicitly mark invalid
handles as 'not to be written'.

This is more robust, and is better than wasting an entire day every time
I make changes to the tag code trying to figure out why the merge test
is failing.


Modified: MOAB/trunk/WriteHDF5.cpp
===================================================================
--- MOAB/trunk/WriteHDF5.cpp	2008-01-31 20:39:48 UTC (rev 1572)
+++ MOAB/trunk/WriteHDF5.cpp	2008-01-31 22:40:16 UTC (rev 1573)
@@ -976,7 +976,15 @@
     // Get file IDs from handles
   output_id_list.resize( input_range.size() );
   rval = iFace->tag_get_data( idTag, input_range, &output_id_list[0] );
-  CHK_MB_ERR_0(rval);
+  if (MB_ENTITY_NOT_FOUND == rval) { // ignore stale handles
+    MBRange::const_iterator i;
+    std::vector<id_t>::iterator j = output_id_list.begin();
+    for (i = input_range.begin(); i != input_range.end(); ++i, ++j) 
+      if (MB_SUCCESS != iFace->tag_get_data( idTag, &*i, 1, &*j ))
+        *j = 0;
+  }
+  else
+    CHK_MB_ERR_0(rval);
   std::sort( output_id_list.begin(), output_id_list.end() );
   
     // Count the number of ranges in the id list
@@ -1046,7 +1054,10 @@
   {
     handle = *i_iter;
     rval = iFace->tag_get_data( idTag, &handle, 1, &id );
-    CHK_MB_ERR_0(rval);
+    if (MB_ENTITY_NOT_FOUND == rval) // ignore stale handles
+      id = 0;
+    else
+      CHK_MB_ERR_0(rval);
     *o_iter = id;
     ++o_iter;
     ++i_iter;




More information about the moab-dev mailing list