[MOAB-dev] r5013 - in MOAB/trunk: src test

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Wed Jun 15 17:23:05 CDT 2011


Author: kraftche
Date: 2011-06-15 17:23:04 -0500 (Wed, 15 Jun 2011)
New Revision: 5013

Modified:
   MOAB/trunk/src/Range.cpp
   MOAB/trunk/test/range_test.cpp
Log:
fix bug where Range contents are corrupted if insertion hint is past correct insert location

Modified: MOAB/trunk/src/Range.cpp
===================================================================
--- MOAB/trunk/src/Range.cpp	2011-06-15 21:27:47 UTC (rev 5012)
+++ MOAB/trunk/src/Range.cpp	2011-06-15 22:23:04 UTC (rev 5013)
@@ -314,6 +314,10 @@
   if (iter != &mHead && iter->first > val2+1)
     iter = mHead.mNext;
   
+    // If hint is bogus then search backwards
+  while (iter != mHead.mNext && iter->mPrev->second >= val1-1)
+    iter = iter->mPrev;
+  
   // Input range is before beginning?
   if (iter->mPrev == &mHead && val2 < iter->first - 1)
   {

Modified: MOAB/trunk/test/range_test.cpp
===================================================================
--- MOAB/trunk/test/range_test.cpp	2011-06-15 21:27:47 UTC (rev 5012)
+++ MOAB/trunk/test/range_test.cpp	2011-06-15 22:23:04 UTC (rev 5013)
@@ -4,6 +4,7 @@
 
 using namespace moab;
 
+void insert_hint_test();
 void intersect_test();
 void merge_test();
 void const_pair_iterator_test();
@@ -16,6 +17,7 @@
 int main()
 {
   int rval = 0;
+  rval += RUN_TEST(insert_hint_test);
   rval += RUN_TEST(intersect_test);
   rval += RUN_TEST(merge_test);
   rval += RUN_TEST(const_pair_iterator_test);
@@ -27,7 +29,47 @@
   return rval;
 }
 
+void insert_hint_test()
+{
+  const EntityHandle pairs[][2] = {
+    { 4980, 4981 },
+    { 4985, 4986 },
+    { 4990, 4990 },
+    { 5886, 5886 },
+    { 5888, 5890 },
+    { 5890, 5890 },
+    { 5886, 5888 },
+    { 5890, 5890 },


More information about the moab-dev mailing list