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

bmsmith6 at wisc.edu bmsmith6 at wisc.edu
Wed Mar 3 13:19:23 CST 2010


Author: bmsmith
Date: 2010-03-03 13:19:23 -0600 (Wed, 03 Mar 2010)
New Revision: 3562

Modified:
   MOAB/trunk/tools/dagmc/DagMC.cpp
Log:
point_in_volume: Warn the user when the fast test fails instead of throwing an assert.

write_mcnp: Clear the MBRange before it is reused. This fixes a bug for tallies specified in CGM groups.

measure_volume and measure_area: In the ITER model, three surfaces are faceted with triangles and (unexpectedly) 1 polygon.
  Only use the triangles, and print a warning. When viewed in Cubit, the triangles resolve the continuous surface.                                        


Modified: MOAB/trunk/tools/dagmc/DagMC.cpp
===================================================================
--- MOAB/trunk/tools/dagmc/DagMC.cpp	2010-03-03 18:26:12 UTC (rev 3561)
+++ MOAB/trunk/tools/dagmc/DagMC.cpp	2010-03-03 19:19:23 UTC (rev 3562)
@@ -574,7 +574,7 @@
 {
   MBErrorCode rval;
   const double epsilon = discardDistTol;
-  
+
     // Get OBB Tree for volume
   assert(volume - setOffset < rootSets.size());
   MBEntityHandle root = rootSets[volume - setOffset];
@@ -695,7 +695,10 @@
     // triangulation.  That shoudn't be possible (must be 
     // closer to at least one of the adjacent triagles than
     // to the saddle vertex.)
-  assert(false /*shouldn't be here*/);
+  std::cout << "point_in_volume fast test failure: xyz= " << x << " " << y << " " << z 
+            << " uvw= " << u << " " << v << " " << w 
+            << " vol=" << id_by_index(3, index_by_handle(volume)) << std::endl; 
+  // For now, proceed with the slow test.
   return point_in_volume_slow( volume, x, y, z, result );
 }
 
@@ -760,8 +763,12 @@
     if (MB_SUCCESS != rval) 
       return rval;
     if (!triangles.all_of_type(MBTRI)) {
-      std::cerr << "ERROR: Surface contains non-triangle elements.  Cannot calculate volume." << std::endl;
-      return MB_FAILURE;
+      std::cout << "WARNING: Surface " << id_by_index(2, index_by_handle(surfaces[i]))
+                << " contains non-triangle elements. Volume calculation may be incorrect." 
+                << std::endl;
+      triangles.clear();
+      rval = MBI->get_entities_by_type( surfaces[i], MBTRI, triangles );
+      if (MB_SUCCESS != rval) return rval;
     }
     
       // calculate signed volume beneath surface (x 6.0)
@@ -796,8 +803,12 @@
   if (MB_SUCCESS != rval) 
     return rval;
   if (!triangles.all_of_type(MBTRI)) {
-    std::cerr << "ERROR: Surface contains non-triangle elements.  Cannot calculate area." << std::endl;
-    return MB_FAILURE;
+    std::cout << "WARNING: Surface " << id_by_index(2, index_by_handle(surface))
+              << " contains non-triangle elements. Area calculation may be incorrect." 
+              << std::endl;
+    triangles.clear();
+    rval = MBI->get_entities_by_type( surface, MBTRI, triangles );
+    if (MB_SUCCESS != rval) return rval;
   }
 
     // calculate sum of area of triangles
@@ -1154,6 +1165,7 @@
     if (grp_names.empty()) continue;
     
     // get sets associated with this group
+    grp_sets.clear();
     rval = MBI->get_entities_by_type(group, MBENTITYSET, grp_sets);
     if (MB_SUCCESS != rval) continue;
 



More information about the moab-dev mailing list