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

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Thu May 6 18:06:29 CDT 2010


Author: kraftche
Date: 2010-05-06 18:06:29 -0500 (Thu, 06 May 2010)
New Revision: 3857

Modified:
   MOAB/trunk/src/io/IODebugTrack.cpp
Log:
Fix bugs in code for debugging binary IO

Modified: MOAB/trunk/src/io/IODebugTrack.cpp
===================================================================
--- MOAB/trunk/src/io/IODebugTrack.cpp	2010-05-06 23:06:00 UTC (rev 3856)
+++ MOAB/trunk/src/io/IODebugTrack.cpp	2010-05-06 23:06:29 UTC (rev 3857)
@@ -1,4 +1,5 @@
 #include "IODebugTrack.hpp"
+#include "moab/Range.hpp"
 #include <iostream>
 #include <vector>
 #include <assert.h>
@@ -58,19 +59,44 @@
     return;
   }
   
-  std::list<DRange>::const_iterator j, i = dataSet.begin();
-  if (i->begin > 0) {
-    ostr << PFX << tableName << " : [0," << i->begin-1 << "] : No Data Written!" << std::endl;
-    ostr.flush();
+  std::list<DRange>::const_iterator i;
+  if (!maxSize) {
+    for (i = dataSet.begin(); i != dataSet.end(); ++i)
+      if (i->end >= maxSize)
+        maxSize = i->end + 1;
   }
-  j = i;
-  for (++j; j != dataSet.end(); ++i, ++j) 
-    if (i->end + 1 != j->begin) {
-      ostr << PFX << tableName << " : [" << i->end + 1 << "," << j->begin-1 << "] : No Data Written!" << std::endl;
-      ostr.flush();
+  Range processed;
+  Range::iterator h = processed.begin();
+  bool wrote_zero = false;
+  for (i = dataSet.begin(); i != dataSet.end(); ++i) {
+    // ranges cannot contain zero
+    assert(i->begin <= i->end);
+    if (i->begin)
+      h = processed.insert( h, i->begin, i->end );
+    else {
+      wrote_zero = true;
+      if (i->end)
+        h = processed.insert( h, i->begin+1, i->end );
     }
-  if (maxSize && i->end + 1 < maxSize) {
-    ostr << PFX << tableName << " : [" << i->end + 1 << "," << maxSize - 1 << "] : No Data Written!" << std::endl;
+  }
+    
+    // ranges cannot contain zero
+  Range unprocessed;
+  if (maxSize > 1) 
+    unprocessed.insert( 1, maxSize - 1 );
+  unprocessed = subtract( unprocessed, processed );


More information about the moab-dev mailing list