diff --git a/include/openmc/dagmc.h b/include/openmc/dagmc.h index adc4f47f1f..d3012e3a0a 100644 --- a/include/openmc/dagmc.h +++ b/include/openmc/dagmc.h @@ -14,10 +14,14 @@ extern "C" const bool dagmc_enabled; namespace openmc { -extern moab::DagMC::RayHistory history; -extern Direction last_dir; +namespace simulation { + +extern moab::DagMC::RayHistory history; //!< facet history for DagMC particles +extern Direction last_dir; //!< last direction passed to DagMC's ray_fire #pragma omp threadprivate(history, last_dir) +} + namespace model { extern moab::DagMC* DAG; } diff --git a/src/cell.cpp b/src/cell.cpp index 4ad114b7ed..a65d07f3c4 100644 --- a/src/cell.cpp +++ b/src/cell.cpp @@ -617,9 +617,9 @@ DAGCell::distance(Position r, Direction u, int32_t on_surface) const { // if we've changed direction or we're not on a surface, // reset the history and update last direction - if (u != last_dir || on_surface == 0) { - history.reset(); - last_dir = u; + if (u != simulation::last_dir || on_surface == 0) { + simulation::history.reset(); + simulation::last_dir = u; } moab::ErrorCode rval; @@ -628,7 +628,7 @@ DAGCell::distance(Position r, Direction u, int32_t on_surface) const double dist; double pnt[3] = {r.x, r.y, r.z}; double dir[3] = {u.x, u.y, u.z}; - rval = dagmc_ptr_->ray_fire(vol, pnt, dir, hit_surf, dist, &history); + rval = dagmc_ptr_->ray_fire(vol, pnt, dir, hit_surf, dist, &simulation::history); MB_CHK_ERR_CONT(rval); int surf_idx; if (hit_surf != 0) { diff --git a/src/dagmc.cpp b/src/dagmc.cpp index 05e0659415..78d8bc4fb6 100644 --- a/src/dagmc.cpp +++ b/src/dagmc.cpp @@ -38,9 +38,15 @@ const bool dagmc_enabled = false; const std::string DAGMC_FILENAME = "dagmc.h5m"; namespace openmc { + + +namespace simulation { + moab::DagMC::RayHistory history; Direction last_dir; +} + namespace model { moab::DagMC* DAG; diff --git a/src/particle.cpp b/src/particle.cpp index eef58a490d..afcc56317f 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -373,9 +373,7 @@ Particle::transport() } #ifdef DAGMC - if(settings::dagmc) { - history.reset(); - } + if (settings::dagmc) simulation::history.reset(); #endif // Finish particle track output. diff --git a/src/surface.cpp b/src/surface.cpp index a643d52730..a33607b775 100644 --- a/src/surface.cpp +++ b/src/surface.cpp @@ -266,9 +266,9 @@ Direction DAGSurface::normal(Position r) const Direction DAGSurface::reflect(Position r, Direction u) const { - history.reset_to_last_intersection(); - last_dir = Surface::reflect(r, u); - return last_dir; + simulation::history.reset_to_last_intersection(); + simulation::last_dir = Surface::reflect(r, u); + return simulation::last_dir; } BoundingBox DAGSurface::bounding_box() const