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

sjackson at cae.wisc.edu sjackson at cae.wisc.edu
Wed Jul 13 14:53:03 CDT 2011


Author: sjackson
Date: 2011-07-13 14:53:02 -0500 (Wed, 13 Jul 2011)
New Revision: 5055

Modified:
   MOAB/trunk/tools/dagmc/DagMC.cpp
   MOAB/trunk/tools/dagmc/DagMC.hpp
Log:
Allow the DagMC::get_angle function to accept an optional RayHistory,
and operate upon its most recent entry if one is available.

Modified: MOAB/trunk/tools/dagmc/DagMC.cpp
===================================================================
--- MOAB/trunk/tools/dagmc/DagMC.cpp	2011-07-12 21:43:23 UTC (rev 5054)
+++ MOAB/trunk/tools/dagmc/DagMC.cpp	2011-07-13 19:53:02 UTC (rev 5055)
@@ -1111,15 +1111,24 @@
   return MB_SUCCESS;
 }
 
-ErrorCode DagMC::get_angle(EntityHandle surf, const double in_pt[3], double angle[3] )
+ErrorCode DagMC::get_angle(EntityHandle surf, const double in_pt[3], double angle[3], const RayHistory* history )
 {
   EntityHandle root = rootSets[surf - setOffset];
+  ErrorCode rval;
   
   std::vector<EntityHandle> facets;
-  ErrorCode rval = obbTree.closest_to_location( in_pt, root, numericalPrecision, facets );
-  assert(MB_SUCCESS == rval);
-  if (MB_SUCCESS != rval) return rval;
-  
+
+  // if no history or history empty, use nearby facets
+  if( !history || (history->prev_facets.size() == 0) ){
+    rval = obbTree.closest_to_location( in_pt, root, numericalPrecision, facets );
+    assert(MB_SUCCESS == rval);
+    if (MB_SUCCESS != rval) return rval;
+  }
+  // otherwise use most recent facet in history
+  else{
+    facets.push_back( history->prev_facets.back() );
+  }
+
   CartVect coords[3], normal(0.0);
   const EntityHandle *conn;
   int len;

Modified: MOAB/trunk/tools/dagmc/DagMC.hpp
===================================================================
--- MOAB/trunk/tools/dagmc/DagMC.hpp	2011-07-12 21:43:23 UTC (rev 5054)
+++ MOAB/trunk/tools/dagmc/DagMC.hpp	2011-07-13 19:53:02 UTC (rev 5055)
@@ -234,9 +234,12 @@
    * @param surf Surface on which to get normal
    * @param xyz Point on surf
    * @param angle Set to coordinates of surface normal nearest xyz
-   * 
+   * @param history Optional ray history from a previous call to ray_fire().  
+   *        If present and non-empty, return the normal 
+   *        of the most recently intersected facet, ignoring xyz.
    */
-  ErrorCode get_angle(EntityHandle surf, const double xyz[3], double angle[3] );
+  ErrorCode get_angle(EntityHandle surf, const double xyz[3], double angle[3], 
+                      const RayHistory* history = NULL );


More information about the moab-dev mailing list