[MOAB-dev] r1555 - MOAB/trunk

tautges at mcs.anl.gov tautges at mcs.anl.gov
Tue Jan 22 22:58:24 CST 2008


Author: tautges
Date: 2008-01-22 22:58:24 -0600 (Tue, 22 Jan 2008)
New Revision: 1555

Modified:
   MOAB/trunk/Tqdcfr.cpp
Log:
Yet another tweak to handle non-contiguous ids properly on 64-bit machines.


Modified: MOAB/trunk/Tqdcfr.cpp
===================================================================
--- MOAB/trunk/Tqdcfr.cpp	2008-01-23 03:46:03 UTC (rev 1554)
+++ MOAB/trunk/Tqdcfr.cpp	2008-01-23 04:58:24 UTC (rev 1555)
@@ -1015,13 +1015,19 @@
       // compute the max cid; map is indexed by cid, so size is max_cid+1
 #define MAX(a,b) (a > b ? a : b)
 #define MIN(a,b) (a < b ? a : b)
-    max_cid = MAX(max_cid, ((unsigned int) *vrange.rbegin()-currVHandleOffset));
+      // sanity check that max vhandle is larger than offset
+    long new_max = *vrange.rbegin()-currVHandleOffset;
+    assert(new_max >= 0 && *vrange.begin() - currVHandleOffset >= 0);
+    max_cid = MAX(max_cid, ((unsigned int) new_max));
     cubMOABVertexMap = new std::vector<MBEntityHandle>(max_cid+1);
       // initialize to zero then put previous vertices into the map
     std::fill(cubMOABVertexMap->begin(), cubMOABVertexMap->end(), 0);
     MBRange::iterator rit;
-    for (rit = vrange.begin(); rit != vrange.end(); rit++)
+    for (rit = vrange.begin(); rit != vrange.end(); rit++) {
+      assert(*rit-currVHandleOffset >= 0 &&
+             *rit-currVHandleOffset <= max_cid);
       (*cubMOABVertexMap)[*rit - currVHandleOffset] = *rit;
+    }
   }
     // case B: there is a map and we need to resize it
   else if (cubMOABVertexMap && max_cid+1 > cubMOABVertexMap->size()) {
@@ -2132,7 +2138,7 @@
 MBErrorCode Tqdcfr::reset_record(AcisRecord &this_record) 
 {
   this_record.rec_type = Tqdcfr::UNKNOWN;
-  static std::string blank;
+  static const std::string blank;
   this_record.att_string = blank;
   this_record.first_attrib = this_record.att_prev = 
     this_record.att_next = this_record.att_ent_num = -1;




More information about the moab-dev mailing list