From 837796add055e4ca606d0449b32d17cceeacee19 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Fri, 7 Jun 2019 12:47:30 -0500 Subject: [PATCH] Including making TL RayHistory, last_dir available in surface.cpp and adding a reflection method to DAGSurface. --- include/openmc/dagmc.h | 8 ++++++-- include/openmc/surface.h | 1 + src/cell.cpp | 6 +----- src/dagmc.cpp | 3 +++ src/surface.cpp | 7 +++++++ 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/include/openmc/dagmc.h b/include/openmc/dagmc.h index 508b617d1e..adc4f47f1f 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 4db397a593..7a70f4767c 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 e5d0f2f007..cf53b6e518 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 8add1f4f37..05e0659415 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 f30b444310..83ee218cb0 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;