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

sjackson at cae.wisc.edu sjackson at cae.wisc.edu
Wed Jun 15 15:45:16 CDT 2011


Author: sjackson
Date: 2011-06-15 15:45:15 -0500 (Wed, 15 Jun 2011)
New Revision: 5010

Modified:
   MOAB/trunk/tools/dagmc/DagMC.cpp
   MOAB/trunk/tools/dagmc/DagMC.hpp
   MOAB/trunk/tools/dagmc/ray_fire_test.cc
   MOAB/trunk/tools/dagmc/test_geom.cc
Log:
Refactor and clean up DagMC::ray_fire()

* Remove mcnp-specific arguments
* Reorder and document remaining arguments
* Remove extra state stored within DagMC object between
  ray_fire calls.  The relevant state is now moved into an
  optional RayHistory object, removing the ordering dependence
  that calls to this function previously carried
* Update tests to use the new interface

Modified: MOAB/trunk/tools/dagmc/DagMC.cpp
===================================================================
--- MOAB/trunk/tools/dagmc/DagMC.cpp	2011-06-15 17:00:35 UTC (rev 5009)
+++ MOAB/trunk/tools/dagmc/DagMC.cpp	2011-06-15 20:45:15 UTC (rev 5010)
@@ -118,7 +118,6 @@
 
 DagMC::DagMC(Interface *mb_impl) 
   : mbImpl(mb_impl), obbTree(mb_impl), have_cgm_geom(false),
-    u_last(0), v_last(0), w_last(0), last_n_particles(-1), 
     n_pt_in_vol_calls(0), n_ray_fire_calls(0)
 {
     // This is the correct place to uniquely define default values for the dagmc settings
@@ -548,14 +547,23 @@
 }
 
   /* SECTION II: Fundamental Geometry Operations/Queries */
-ErrorCode DagMC::ray_fire(const EntityHandle vol, const EntityHandle last_surf_hit, 
-                          const int n_particles,
-                          const double u, const double v, const double w,
-                          const double x, const double y, const double z,
-                          const double huge_val,
- 			  double &dist_traveled, EntityHandle &next_surf_hit, 
-                          OrientedBoxTreeTool::TrvStats* stats ) {
+void DagMC::RayHistory::reset() { 
+  prev_facets.clear();
+}
 
+void DagMC::RayHistory::reset_to_last_intersection() {
+  assert(!prev_facets.empty());
+  const EntityHandle last_facet_hit = prev_facets.back();
+  prev_facets.clear();
+  prev_facets.push_back(last_facet_hit);
+}
+
+ErrorCode DagMC::ray_fire(const EntityHandle vol, 
+                          const double point[3], const double dir[3],
+                          EntityHandle& next_surf, double& next_surf_dist,
+                          RayHistory* history, 
+                          OrientedBoxTreeTool::TrvStats* stats ) { 
+
   // take some stats that are independent of nps
   if(counting) {
     ++n_ray_fire_calls;
@@ -567,20 +575,17 @@
 
   if (debug) {
     std::cout << "ray_fire:" 
-              << " xyz=" << x << " " << y << " " << z 
-              << " uvw=" << u << " " << v << " " << w
-              << " vol_id=" << id_by_index(3, index_by_handle(vol))
-              << " last_surf_id=";


More information about the moab-dev mailing list