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

sjackson at cae.wisc.edu sjackson at cae.wisc.edu
Wed Apr 6 13:28:41 CDT 2011


Author: sjackson
Date: 2011-04-06 13:28:41 -0500 (Wed, 06 Apr 2011)
New Revision: 4720

Modified:
   MOAB/trunk/tools/dagmc/DagMC.cpp
Log:
* Gather and print info about the size of DagMC's implicit complement
  volume as it is being constructed.

* Change error message printouts in measure_volume and measure_area
  to use tag lookups instead of index lookups.  This is slower, but
  allows these functions to be safely called before the indices have
  been constructed (e.g. while the implicit complement is being built).
  The slowdown only affects surfaces that cause errors to be printed.

Modified: MOAB/trunk/tools/dagmc/DagMC.cpp
===================================================================
--- MOAB/trunk/tools/dagmc/DagMC.cpp	2011-04-06 17:04:08 UTC (rev 4719)
+++ MOAB/trunk/tools/dagmc/DagMC.cpp	2011-04-06 18:28:41 UTC (rev 4720)
@@ -441,6 +441,9 @@
   ErrorCode rval;
   std::vector<EntityHandle> parent_vols;
   
+  int impl_compl_surf_count = 0;
+  double impl_compl_surf_area = 0.0;
+
     // search through all surfaces  
   for (Range::iterator surf_i = surfs.begin(); surf_i != surfs.end(); ++surf_i) {
     
@@ -452,6 +455,12 @@
 
       // if only one parent, get the OBB root for this surface
     if (parent_vols.size() == 1 ) {
+
+      double a;
+      measure_area( *surf_i, a );
+      impl_compl_surf_count += 1;
+      impl_compl_surf_area  += a;
+
       rval = MBI->tag_get_data( obbTag, &*surf_i, 1, &surf_obb_root );
       if (MB_SUCCESS != rval)
         return rval;
@@ -484,6 +493,14 @@
 
     }  
   }
+  // print info about the implicit complement if one was created
+  if( impl_compl_surf_count ){
+    bool one = (impl_compl_surf_count == 1);
+    std::cout << "The implicit complement bounds " << impl_compl_surf_count
+	      << (one ? " surface" : " surfaces") << std::endl;
+    std::cout << "The implicit complement's total surface area = " 
+	      << impl_compl_surf_area << std::endl;
+  }
   
     // join surface trees to make OBB tree for implicit complement
   rval = obbTree.join_trees( comp_tree, comp_root );
@@ -1106,7 +1123,7 @@
     if (MB_SUCCESS != rval) 
       return rval;
     if (!triangles.all_of_type(MBTRI)) {
-      std::cout << "WARNING: Surface " << id_by_index(2, index_by_handle(surfaces[i]))
+      std::cout << "WARNING: Surface " << get_entity_id(surfaces[i])
                 << " contains non-triangle elements. Volume calculation may be incorrect." 
                 << std::endl;
       triangles.clear();


More information about the moab-dev mailing list