diff --git a/include/openmc/dagmc.h b/include/openmc/dagmc.h index 508b617d1..adc4f47f1 100644 --- a/include/openmc/dagmc.h +++ b/include/openmc/dagmc.h @@ -9,11 +9,15 @@ extern "C" const bool dagmc_enabled; #ifdef DAGMC #include "DagMC.hpp" -#include "openmc/cell.h" -#include "openmc/surface.h" +#include "openmc/xml_interface.h" +#include "openmc/position.h" namespace openmc { +extern moab::DagMC::RayHistory history; +extern Direction last_dir; +#pragma omp threadprivate(history, last_dir) + namespace model { extern moab::DagMC* DAG; } diff --git a/include/openmc/surface.h b/include/openmc/surface.h index 4db397a59..7a70f4767 100644 --- a/include/openmc/surface.h +++ b/include/openmc/surface.h @@ -136,6 +136,7 @@ public: double evaluate(Position r) const; double distance(Position r, Direction u, bool coincident) const; Direction normal(Position r) const; + Direction reflect(Position r, Direction u) const; //! Get the bounding box of this surface. BoundingBox bounding_box() const; diff --git a/src/cell.cpp b/src/cell.cpp index e5d0f2f00..cf53b6e51 100644 --- a/src/cell.cpp +++ b/src/cell.cpp @@ -7,6 +7,7 @@ #include "openmc/capi.h" #include "openmc/constants.h" +#include "openmc/dagmc.h" #include "openmc/error.h" #include "openmc/geometry.h" #include "openmc/hdf5_interface.h" @@ -609,11 +610,6 @@ CSGCell::contains_complex(Position r, Direction u, int32_t on_surface) const //============================================================================== #ifdef DAGMC -extern moab::DagMC::RayHistory history; -extern Direction last_dir; -#pragma omp threadprivate(history, last_dir) -moab::DagMC::RayHistory history; -Direction last_dir; DAGCell::DAGCell() : Cell{} {}; diff --git a/src/dagmc.cpp b/src/dagmc.cpp index 8add1f4f3..05e065941 100644 --- a/src/dagmc.cpp +++ b/src/dagmc.cpp @@ -9,6 +9,7 @@ #include "openmc/material.h" #include "openmc/string_utils.h" #include "openmc/settings.h" +#include "openmc/surface.h" #ifdef DAGMC @@ -37,6 +38,8 @@ const bool dagmc_enabled = false; const std::string DAGMC_FILENAME = "dagmc.h5m"; namespace openmc { +moab::DagMC::RayHistory history; +Direction last_dir; namespace model { diff --git a/src/surface.cpp b/src/surface.cpp index f30b44431..83ee218cb 100644 --- a/src/surface.cpp +++ b/src/surface.cpp @@ -6,6 +6,7 @@ #include #include "openmc/error.h" +#include "openmc/dagmc.h" #include "openmc/hdf5_interface.h" #include "openmc/settings.h" #include "openmc/string_utils.h" @@ -264,6 +265,12 @@ Direction DAGSurface::normal(Position r) const return u; } +Direction DAGSurface::reflect(Position r, Direction u) const +{ + history.rollback_last_intersection(); + return Surface::reflect(r, u); +} + BoundingBox DAGSurface::bounding_box() const { moab::ErrorCode rval;