[MOAB-dev] r3710 - MOAB/trunk/src

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Thu Mar 25 12:58:56 CDT 2010


Author: kraftche
Date: 2010-03-25 12:58:56 -0500 (Thu, 25 Mar 2010)
New Revision: 3710

Modified:
   MOAB/trunk/src/AEntityFactory.cpp
Log:
fix bugs in estimation of memory used for storing adjacencies

Modified: MOAB/trunk/src/AEntityFactory.cpp
===================================================================
--- MOAB/trunk/src/AEntityFactory.cpp	2010-03-25 16:56:32 UTC (rev 3709)
+++ MOAB/trunk/src/AEntityFactory.cpp	2010-03-25 17:58:56 UTC (rev 3710)
@@ -1451,14 +1451,14 @@
       
       if (prev_data != (*i)->data()) {
         prev_data = (*i)->data();
-        memory_total += prev_data->size() * sizeof(AdjacencyVector);
+        memory_total += prev_data->size() * sizeof(AdjacencyVector*);
       }
       
       const AdjacencyVector* vec;
       for (EntityHandle h = (*i)->start_handle(); h <= (*i)->end_handle(); ++h) {
         get_adjacency_ptr( h, vec );
         if (vec) 
-          entity_total += vec->capacity() * sizeof(EntityHandle) * sizeof(AdjacencyVector);
+          entity_total += vec->capacity() * sizeof(EntityHandle) + sizeof(AdjacencyVector);
       }
     }
   }
@@ -1472,6 +1472,7 @@
                                        unsigned long& amortized )
 {
   min_per_ent = amortized = 0;
+  SequenceData* prev_data = 0;
   RangeSeqIntersectIter iter( thisMB->sequence_manager() );
   ErrorCode rval = iter.init( ents_in.begin(), ents_in.end() );
   if (MB_SUCCESS != rval)
@@ -1487,10 +1488,13 @@
                                 ->entity_map( iter.get_sequence()->type() )
                                  .get_occupied_size( iter.get_sequence()->data() );
     
-    amortized += sizeof(AdjacencyVector*) 
-                 * iter.get_sequence()->data()->size()
-                 * count / data_occ;
-                 
+    if (iter.get_sequence()->data() != prev_data) {
+      prev_data = iter.get_sequence()->data();
+      amortized += sizeof(AdjacencyVector*) 
+                   * iter.get_sequence()->data()->size()
+                   * count / data_occ;
+    }
+            
     array += iter.get_start_handle() - iter.get_sequence()->data()->start_handle();
     for (EntityID i = 0; i < count; ++i) {
       if (array[i]) 



More information about the moab-dev mailing list