[MOAB-dev] r2995 - MOAB/trunk

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Fri Jul 10 17:19:38 CDT 2009


Author: kraftche
Date: 2009-07-10 17:19:37 -0500 (Fri, 10 Jul 2009)
New Revision: 2995

Modified:
   MOAB/trunk/WriteHDF5.cpp
Log:
fix O(n^2) write of sets due to MBRange insertion

Modified: MOAB/trunk/WriteHDF5.cpp
===================================================================
--- MOAB/trunk/WriteHDF5.cpp	2009-07-10 21:15:45 UTC (rev 2994)
+++ MOAB/trunk/WriteHDF5.cpp	2009-07-10 22:19:37 UTC (rev 2995)
@@ -2316,7 +2316,7 @@
 {
   MBErrorCode rval;
   MBRange set_contents;
-  MBRange::const_iterator iter = sets.begin();
+  MBRange::const_iterator iter = sets.begin(), ins = compressed_sets.begin();
   const MBRange::const_iterator end = sets.end();
   long contents_length_set, children_length_set, parents_length_set;
   unsigned long flags;
@@ -2333,7 +2333,7 @@
     CHK_MB_ERR_0(rval);
     
       // check if can and should compress as ranges
-    if ((flags&MESHSET_SET) && !(flags&MESHSET_ORDERED))
+    if ((flags&MESHSET_SET) && !(flags&MESHSET_ORDERED) && contents_length_set > 4)
     {
       set_contents.clear();
       rval = iFace->get_entities_by_handle( *iter, set_contents, false );
@@ -2347,7 +2347,7 @@
       {
         assert (set_contents_ids.size() % 2 == 0);
         contents_length_set = set_contents_ids.size();
-        compressed_sets.insert( *iter );
+        ins = compressed_sets.insert( ins, *iter, *iter );
       }
     }
     



More information about the moab-dev mailing list