[MOAB-dev] r3385 - MOAB/trunk/tools/dagmc

wilsonp at engr.wisc.edu wilsonp at engr.wisc.edu
Wed Nov 25 08:15:48 CST 2009


Author: wilsonp
Date: 2009-11-25 08:15:47 -0600 (Wed, 25 Nov 2009)
New Revision: 3385

Modified:
   MOAB/trunk/tools/dagmc/DagMC.cpp
Log:
Add some error handling in parsing metadata.

Modified: MOAB/trunk/tools/dagmc/DagMC.cpp
===================================================================
--- MOAB/trunk/tools/dagmc/DagMC.cpp	2009-11-24 21:22:30 UTC (rev 3384)
+++ MOAB/trunk/tools/dagmc/DagMC.cpp	2009-11-25 14:15:47 UTC (rev 3385)
@@ -1087,13 +1087,17 @@
     int cellid,matid;
     double imp, density;
 
-    MBI->tag_get_data( idTag , &(*iter), 1, &cellid   );
-    MBI->tag_get_data(impTag , &(*iter), 1, &imp      );
-    MBI->tag_get_data(matTag , &(*iter), 1, &matid    );
+    rval = MBI->tag_get_data( idTag , &(*iter), 1, &cellid   );
+    if (MB_SUCCESS != rval) return rval;
+    rval = MBI->tag_get_data(impTag , &(*iter), 1, &imp      );
+    if (MB_SUCCESS != rval) return rval;
+    rval = MBI->tag_get_data(matTag , &(*iter), 1, &matid    );
+    if (MB_SUCCESS != rval) return rval;
     if (0 == matid) {
       cgmfile << cellid << " " << matid << " imp:n=" << imp ;
     } else {
-      MBI->tag_get_data(densTag, &(*iter), 1, &density  );
+      rval = MBI->tag_get_data(densTag, &(*iter), 1, &density  );
+      if (MB_SUCCESS != rval) return rval;
       cgmfile << cellid << " " << matid << " " << density << " imp:n=" << imp ;
     }      
     if (*iter == impl_compl_handle)
@@ -1109,13 +1113,17 @@
     
     int surfid, bc_id;
 
-    MBI->tag_get_data( idTag, &(*iter), 1, &surfid );
-    MBI->tag_get_data( bcTag, &(*iter), 1, &bc_id  );
+    rval = MBI->tag_get_data( idTag, &(*iter), 1, &surfid );
+    if (MB_SUCCESS != rval) return rval;
+    rval = MBI->tag_get_data( bcTag, &(*iter), 1, &bc_id  );
+    if (MB_SUCCESS != rval && MB_TAG_NOT_FOUND != rval) return rval;
 
-    if (BC_SPEC == bc_id)
-      cgmfile << "*";
-    if (BC_WHITE == bc_id)
-      cgmfile << "+";
+    if (MB_TAG_NOT_FOUND != rval) {
+      if (BC_SPEC == bc_id)
+	cgmfile << "*";
+      if (BC_WHITE == bc_id)
+	cgmfile << "+";
+    }
     cgmfile << surfid << std::endl;
 
   }



More information about the moab-dev mailing list