From 9fca1f690dd13752f73214627faf63778bba6df5 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Fri, 12 Mar 2021 23:42:09 -0600 Subject: [PATCH] Moving the DAGUniverse into the DAGMC header file. --- docs/source/usersguide/geometry.rst | 15 +++++++-------- include/openmc/cell.h | 25 +------------------------ include/openmc/constants.h | 9 +++++++++ include/openmc/dagmc.h | 22 +++++++++++++++++++--- include/openmc/surface.h | 9 --------- src/cell.cpp | 1 - src/particle.cpp | 1 + 7 files changed, 37 insertions(+), 45 deletions(-) diff --git a/docs/source/usersguide/geometry.rst b/docs/source/usersguide/geometry.rst index a271490717..4df3681a53 100644 --- a/docs/source/usersguide/geometry.rst +++ b/docs/source/usersguide/geometry.rst @@ -471,15 +471,14 @@ successfully and that the model is `watertight implementations of DAGMC geometry will support small volume overlaps and un-merged surfaces. +Cell, Surface, and Material IDs +------------------------------- -Cell and Material IDs ---------------------- - -By default, DAGMC applies cell IDs defined by the CAD engine that the model -originated in. If these IDs overlap with ID's in the CSG cell ID space, this -will result in an error. However, the ``auto_ids`` property of a DAGMC universe -can be set to set DAGMC cell IDs by appending to the existing CSG cell ID space -in the OpenMC model. +By default, DAGMC applies cell and surface IDs defined by the CAD engine that +the model originated in. If these IDs overlap with ID's in the CSG ID space, +this will result in an error. However, the ``auto_ids`` property of a DAGMC +universe can be set to set DAGMC cell and surface IDs by appending to the +existing CSG cell ID space in the OpenMC model. Similar options exist for the material IDs of DAGMC models. If DAGMC material assignments are based on natively defined OpenMC materials, no further work is diff --git a/include/openmc/cell.h b/include/openmc/cell.h index d1e3dc50ec..b7f18a116f 100644 --- a/include/openmc/cell.h +++ b/include/openmc/cell.h @@ -10,7 +10,6 @@ #include #include "hdf5.h" #include "pugixml.hpp" -#include "dagmc.h" #include "openmc/constants.h" #include "openmc/memory.h" // for unique_ptr @@ -77,29 +76,6 @@ public: unique_ptr partitioner_; }; -#ifdef DAGMC - -class DAGUniverse : public Universe { - -public: - explicit DAGUniverse(pugi::xml_node node); - explicit DAGUniverse(const std::string& filename, bool auto_ids = false); - - void initialize(); //!< Sets up the DAGMC instance and OpenMC internals - - std::map read_uwuw_materials(); //!< Reads UWUW materials and returns an ID map - - // Data Members - std::string filename_; - std::shared_ptr dagmc_instance_; //! DAGMC Instance for this universe - int32_t cell_idx_offset_; - int32_t surf_idx_offset_; - bool adjust_ids_; - -}; - -#endif - //============================================================================== //============================================================================== @@ -372,6 +348,7 @@ void read_cells(pugi::xml_node node); #ifdef DAGMC +class DAGUniverse; int32_t next_cell(DAGUniverse* dag_univ, DAGCell* cur_cell, DAGSurface* surf_xed); #endif diff --git a/include/openmc/constants.h b/include/openmc/constants.h index aac3a52a83..89afadeb43 100644 --- a/include/openmc/constants.h +++ b/include/openmc/constants.h @@ -379,6 +379,15 @@ enum class RunMode { // For non-accelerated regions on coarse mesh overlay constexpr int CMFD_NOACCEL {-1}; +//============================================================================== +// Geometry Constants + +enum class GeometryType { + CSG, + DAG +}; + + } // namespace openmc #endif // OPENMC_CONSTANTS_H diff --git a/include/openmc/dagmc.h b/include/openmc/dagmc.h index 0c76d6b1df..69b3f1610e 100644 --- a/include/openmc/dagmc.h +++ b/include/openmc/dagmc.h @@ -10,6 +10,7 @@ extern "C" const bool DAGMC_ENABLED; #include "DagMC.hpp" +#include "openmc/cell.h" #include "openmc/position.h" #include "openmc/xml_interface.h" @@ -19,9 +20,24 @@ namespace model { extern std::shared_ptr DAG; } -//============================================================================== -// Non-member functions -//============================================================================== +class DAGUniverse : public Universe { + +public: + explicit DAGUniverse(pugi::xml_node node); + explicit DAGUniverse(const std::string& filename, bool auto_ids = false); + + void initialize(); //!< Sets up the DAGMC instance and OpenMC internals + + std::map read_uwuw_materials(); //!< Reads UWUW materials and returns an ID map + + // Data Members + std::string filename_; + std::shared_ptr dagmc_instance_; //! DAGMC Instance for this universe + int32_t cell_idx_offset_; + int32_t surf_idx_offset_; + bool adjust_ids_; + +}; void load_dagmc_geometry(); int32_t create_dagmc_universe(const std::string& filename); diff --git a/include/openmc/surface.h b/include/openmc/surface.h index 5c729f8202..2bebdc8ce6 100644 --- a/include/openmc/surface.h +++ b/include/openmc/surface.h @@ -29,15 +29,6 @@ namespace model { extern vector> surfaces; } // namespace model -//============================================================================== -// Constants -//============================================================================== - -enum class GeometryType { - CSG, - DAG -}; - //============================================================================== //! Coordinates for an axis-aligned cube that bounds a geometric object. //============================================================================== diff --git a/src/cell.cpp b/src/cell.cpp index ae121d2ba1..63edf644be 100644 --- a/src/cell.cpp +++ b/src/cell.cpp @@ -22,7 +22,6 @@ #include "openmc/material.h" #include "openmc/nuclide.h" #include "openmc/settings.h" -#include "openmc/surface.h" #include "openmc/xml_interface.h" namespace openmc { diff --git a/src/particle.cpp b/src/particle.cpp index 5b2105a36e..b623b29178 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -9,6 +9,7 @@ #include "openmc/capi.h" #include "openmc/cell.h" #include "openmc/constants.h" +#include "openmc/dagmc.h" #include "openmc/error.h" #include "openmc/geometry.h" #include "openmc/hdf5_interface.h"