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

sjackson at cae.wisc.edu sjackson at cae.wisc.edu
Thu Jun 16 11:39:06 CDT 2011


Author: sjackson
Date: 2011-06-16 11:39:04 -0500 (Thu, 16 Jun 2011)
New Revision: 5017

Modified:
   MOAB/trunk/tools/dagmc/DagMC.cpp
   MOAB/trunk/tools/dagmc/DagMC.hpp
   MOAB/trunk/tools/dagmc/test_geom.cc
Log:
Add new DagMC function to traverse across a surface.

Rationale: Clients need to do this regularly, and they shouldn't need to
understand the underlying parent-child links in DagMC's meshset
objects to do it.

Update test_geom to use new function.

Modified: MOAB/trunk/tools/dagmc/DagMC.cpp
===================================================================
--- MOAB/trunk/tools/dagmc/DagMC.cpp	2011-06-16 16:02:03 UTC (rev 5016)
+++ MOAB/trunk/tools/dagmc/DagMC.cpp	2011-06-16 16:39:04 UTC (rev 5017)
@@ -1131,7 +1131,31 @@
   return MB_SUCCESS;
 }
 
+ErrorCode DagMC::next_vol( EntityHandle surface, EntityHandle old_volume, 
+                           EntityHandle& new_volume )
+{
+  std::vector<EntityHandle> parents;
+  ErrorCode rval = MBI->get_parent_meshsets( surface, parents );
 
+  if (MB_SUCCESS == rval) {
+    if (parents.size() != 2)
+      rval = MB_FAILURE;
+    else if (parents.front() == old_volume) 
+      new_volume = parents.back();
+    else if( parents.back() == old_volume )
+      new_volume = parents.front();
+    else 
+      rval = MB_FAILURE;
+  }
+
+  if( rval != MB_SUCCESS ){
+    std::cerr << "DAGMC: mesh error in next_vol for surf " << get_entity_id(surface) << std::endl;
+  }
+
+  return rval;
+
+}
+
 /* SECTION II (private) */
 
 ErrorCode DagMC::CAD_ray_intersect(

Modified: MOAB/trunk/tools/dagmc/DagMC.hpp
===================================================================
--- MOAB/trunk/tools/dagmc/DagMC.hpp	2011-06-16 16:02:03 UTC (rev 5016)
+++ MOAB/trunk/tools/dagmc/DagMC.hpp	2011-06-16 16:39:04 UTC (rev 5017)
@@ -223,6 +223,16 @@
   ErrorCode get_angle(EntityHandle surf, 
                       double xxx, double yyy, double zzz, double *ang);
 
+  /** Get the volume on the other side of a surface
+   *
+   * @param A surface to query 
+   * @param old_volume A volume on one side of surface
+   * @param new_volume Output parameter for volume on the other side of surface
+   * @return MB_SUCCESS if new_volume was set successfully, error if not.


More information about the moab-dev mailing list