diff --git a/include/openmc/surface.h b/include/openmc/surface.h index 28590b449..3d386e876 100644 --- a/include/openmc/surface.h +++ b/include/openmc/surface.h @@ -97,6 +97,7 @@ public: int id_; //!< Unique ID std::string name_; //!< User-defined name std::shared_ptr bc_ {nullptr}; //!< Boundary condition + GeometryType geom_type_; //!< Geometry type indicator (CSG or DAGMC) bool surf_source_ {false}; //!< Activate source banking for the surface? explicit Surface(pugi::xml_node surf_node); @@ -143,13 +144,13 @@ public: //! Write all information needed to reconstruct the surface to an HDF5 group. //! \param group_id An HDF5 group id. - virtual void to_hdf5(hid_t group_id) const = 0; + void to_hdf5(hid_t group_id) const; //! Get the BoundingBox for this surface. virtual BoundingBox bounding_box(bool /*pos_side*/) const { return {}; } protected: - virtual void to_hdf5_inner(hid_t group_id) const = 0; + virtual void to_hdf5_inner(hid_t group_id) const = 0; }; class CSGSurface : public Surface @@ -158,7 +159,8 @@ public: explicit CSGSurface(pugi::xml_node surf_node); CSGSurface(); - void to_hdf5(hid_t group_id) const; +protected: + virtual void to_hdf5_inner(hid_t group_id) const = 0; }; //============================================================================== diff --git a/src/dagmc.cpp b/src/dagmc.cpp index f459580d6..91e2ffb01 100644 --- a/src/dagmc.cpp +++ b/src/dagmc.cpp @@ -154,7 +154,7 @@ void read_dagmc_materials() { std::stringstream ss; ss << "\n"; ss << "\n"; - for (auto mat : mat_lib) { ss << mat.second.openmc("atom"); } + for (auto mat : mat_lib) { ss << mat.second->openmc("atom"); } ss << ""; std::string mat_xml_string = ss.str(); @@ -389,7 +389,7 @@ void DAGUniverse::initialize() { std::string uwuw_mat = DMD.volume_material_property_data_eh[vol_handle]; if (uwuw.material_library.count(uwuw_mat) != 0) { // Note: material numbers are set by UWUW - int mat_number = uwuw.material_library[uwuw_mat].metadata["mat_number"].asInt(); + int mat_number = uwuw.material_library.get_material(uwuw_mat).metadata["mat_number"].asInt(); c->material_.push_back(mat_number); } else { fatal_error(fmt::format("Material with value {} not found in the " @@ -448,12 +448,11 @@ void DAGUniverse::initialize() { std::string bc_value = DMD.get_surface_property("boundary", surf_handle); to_lower(bc_value); if (bc_value.empty() || bc_value == "transmit" || bc_value == "transmission") { - // set to transmission by default - s->bc_ = Surface::BoundaryType::TRANSMIT; + // set to transmission by default (nullptr) } else if (bc_value == "vacuum") { - s->bc_ = Surface::BoundaryType::VACUUM; + s->bc_ = std::make_shared(); } else if (bc_value == "reflective" || bc_value == "reflect" || bc_value == "reflecting") { - s->bc_ = Surface::BoundaryType::REFLECT; + s->bc_ = std::make_shared(); } else if (bc_value == "periodic") { fatal_error("Periodic boundary condition not supported in DAGMC."); } else { @@ -469,7 +468,7 @@ void DAGUniverse::initialize() { // if this surface belongs to the graveyard if (graveyard && parent_vols.find(graveyard) != parent_vols.end()) { // set graveyard surface BC's to vacuum - s->bc_ = Surface::BoundaryType::VACUUM; + s->bc_ = std::make_shared(); } // add to global array and map diff --git a/src/particle.cpp b/src/particle.cpp index 817f7f60b..5b2105a36 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -505,7 +505,7 @@ Particle::cross_reflective_bc(const Surface& surf, Direction new_u) surface() = -surface(); #ifdef DAGMC - if (surf->geom_type_ != GeometryType::DAGMC) history_.reset(); + if (surf.geom_type_ != GeometryType::DAG) history_.reset(); #endif // If a reflective surface is coincident with a lattice or universe