[MOAB-dev] r2086 - MOAB/trunk

kraftche at mcs.anl.gov kraftche at mcs.anl.gov
Wed Sep 24 09:58:33 CDT 2008


Author: kraftche
Date: 2008-09-24 09:58:33 -0500 (Wed, 24 Sep 2008)
New Revision: 2086

Modified:
   MOAB/trunk/MBMeshSet.cpp
   MOAB/trunk/MBTest.cpp
Log:
o Fix bug in insertion routine for set-based mesh sets where the set
  contents were corrupted when an input range of handles ended with
  the same value as a range of handles in the set.

o Fix new regression test for above bug: expected number of values in
  meshset depends on whether or not the MESHSET_SET flag is set during
  creation.



Modified: MOAB/trunk/MBMeshSet.cpp
===================================================================
--- MOAB/trunk/MBMeshSet.cpp	2008-09-24 04:14:56 UTC (rev 2085)
+++ MOAB/trunk/MBMeshSet.cpp	2008-09-24 14:58:33 UTC (rev 2086)
@@ -479,9 +479,9 @@
     
       // discard any input blocks already in the set
     for (; i != end && i->second <= list_write[1]; ++i);
-    if (i == end) {
+    if (i == end || i->first > list_write[1]+1) {
       list_write += 2;
-      break;
+      continue;
     }
     
       // merge subsequent blocks in meshset

Modified: MOAB/trunk/MBTest.cpp
===================================================================
--- MOAB/trunk/MBTest.cpp	2008-09-24 04:14:56 UTC (rev 2085)
+++ MOAB/trunk/MBTest.cpp	2008-09-24 14:58:33 UTC (rev 2086)
@@ -1366,29 +1366,26 @@
     return result;
 
   MBEntityHandle handle_array[] = {1, 2, 3, 4, 5, 7, 8, 9, 10};
+  const int num_handle = sizeof(handle_array)/sizeof(handle_array[0]);
     //add ents to set
-  result = MB->add_entities( temp_ms3, handle_array, 
-                             sizeof(handle_array)/sizeof(MBEntityHandle));
+  result = MB->add_entities( temp_ms3, handle_array, num_handle );
   if(result  != MB_SUCCESS ) 
     return result;
 
     // try adding again
-  result = MB->add_entities( temp_ms3, handle_array, 
-                             sizeof(handle_array)/sizeof(MBEntityHandle));
+  result = MB->add_entities( temp_ms3, handle_array, num_handle );
   if(result  != MB_SUCCESS ) 
     return result;
 
   int num_ents;
   result = MB->get_number_entities_by_handle(temp_ms3, num_ents);
-  if(result  != MB_SUCCESS ) return result;
-  else if (num_ents != sizeof(handle_array)/sizeof(MBEntityHandle))
+  if(result  != MB_SUCCESS ) 
+    return result;
+    
+  int num_expected = (flags & MESHSET_SET) ? num_handle : 2*num_handle;
+  if (num_ents != num_expected)
     return MB_FAILURE;
 
-  if(result != MB_SUCCESS )
-    return result;
-
-  
-
   return MB_SUCCESS;
 }
 




More information about the moab-dev mailing list