[MOAB-dev] r4434 - MOAB/trunk/src/io

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Tue Jan 11 17:59:31 CST 2011


Author: kraftche
Date: 2011-01-11 17:59:31 -0600 (Tue, 11 Jan 2011)
New Revision: 4434

Modified:
   MOAB/trunk/src/io/ReadHDF5.cpp
Log:
fix O(n**2) behavior when reading range-compacted sets from HDF5 file

Modified: MOAB/trunk/src/io/ReadHDF5.cpp
===================================================================
--- MOAB/trunk/src/io/ReadHDF5.cpp	2011-01-11 22:10:49 UTC (rev 4433)
+++ MOAB/trunk/src/io/ReadHDF5.cpp	2011-01-11 23:59:31 UTC (rev 4434)
@@ -3409,6 +3409,7 @@
                                         Range& merge )
 {
   RangeMap<long,EntityHandle>::iterator it = id_map.begin();
+  Range::iterator hint = merge.begin();
   for (size_t i = 0; i < num_ranges; ++i) {
     long id = ranges[2*i];
     const long end = id + ranges[2*i+1];
@@ -3423,7 +3424,7 @@
     while (id < end) {
       const long off = id - it->begin;
       long count = std::min( it->count - off,  end - id );
-      merge.insert( it->value + off, it->value + off + count - 1 );
+      hint = merge.insert( hint, it->value + off, it->value + off + count - 1 );
       id += count;
       if (id < end)
         if (++it == id_map.end())
































More information about the moab-dev mailing list