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

sjackson at cae.wisc.edu sjackson at cae.wisc.edu
Fri Feb 10 15:46:10 CST 2012


Author: sjackson
Date: 2012-02-10 15:46:10 -0600 (Fri, 10 Feb 2012)
New Revision: 5390

Modified:
   MOAB/trunk/tools/dagmc/DagMC.cpp
Log:
Work around an issue in DagMC::entity_by_id()

This function did not behave as expected on reloaded
geometries from older versions of DagMC.

Modified: MOAB/trunk/tools/dagmc/DagMC.cpp
===================================================================
--- MOAB/trunk/tools/dagmc/DagMC.cpp	2012-02-10 18:30:46 UTC (rev 5389)
+++ MOAB/trunk/tools/dagmc/DagMC.cpp	2012-02-10 21:46:10 UTC (rev 5390)
@@ -1404,8 +1404,19 @@
   
   Range results;
   rval = MBI->get_entities_by_type_and_tag( 0, MBENTITYSET, tags, vals, 2, results );
-  if (MB_SUCCESS != rval || results.empty())
-    return 0;
+
+  if ( MB_SUCCESS != rval ) 
+      return 0;
+
+  if ( results.empty() ){
+    // old versions of dagmc did not set tags correctly on the implicit complement 'volume',
+    // causing it to not be found by the call above.  This check allows this function to work
+    // correctly, even on reloaded files from older versions.
+    if( dimension == 3 && get_entity_id(impl_compl_handle) == id )
+      return impl_compl_handle;
+    else 
+      return 0; 
+  }
   
   return results.front();
 }



























More information about the moab-dev mailing list