[MOAB-dev] r3129 - MOAB/trunk

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Thu Sep 3 18:41:54 CDT 2009


Author: kraftche
Date: 2009-09-03 18:41:53 -0500 (Thu, 03 Sep 2009)
New Revision: 3129

Modified:
   MOAB/trunk/MBRange.cpp
Log:
fix O(n^2) behavior in MBRange::intersect

Modified: MOAB/trunk/MBRange.cpp
===================================================================
--- MOAB/trunk/MBRange.cpp	2009-09-03 20:04:04 UTC (rev 3128)
+++ MOAB/trunk/MBRange.cpp	2009-09-03 23:41:53 UTC (rev 3129)
@@ -655,6 +655,7 @@
   MBEntityHandle low_it, high_it;
   
   MBRange lhs;
+  MBRange::iterator hint = lhs.begin();
   
     // terminate the while loop when at least one "start" iterator is at the
     // end of the list
@@ -673,7 +674,7 @@
       high_it = MIN(r_it[0]->second, r_it[1]->second);
       
         // insert into result
-      lhs.insert(low_it, high_it);
+      hint = lhs.insert(hint, low_it, high_it);
       
         // now find bounds of this insertion and increment corresponding iterator
       if (high_it == r_it[0]->second) r_it[0]++;



More information about the moab-dev mailing list