mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 21:55:41 -04:00
Fix for UWUW Macro Conflict (#3150)
Co-authored-by: Patrick Shriwise <pshriwise@gmail.com>
This commit is contained in:
parent
c0acc28038
commit
e047138833
5 changed files with 35 additions and 25 deletions
5
.github/workflows/ci.yml
vendored
5
.github/workflows/ci.yml
vendored
|
|
@ -131,6 +131,11 @@ jobs:
|
|||
echo "$HOME/NJOY2016/build" >> $GITHUB_PATH
|
||||
$GITHUB_WORKSPACE/tools/ci/gha-install.sh
|
||||
|
||||
- name: display-config
|
||||
shell: bash
|
||||
run: |
|
||||
openmc -v
|
||||
|
||||
- name: cache-xs
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
|
|
|
|||
|
|
@ -510,6 +510,14 @@ endif()
|
|||
if(OPENMC_USE_DAGMC)
|
||||
target_compile_definitions(libopenmc PRIVATE DAGMC)
|
||||
target_link_libraries(libopenmc dagmc-shared)
|
||||
|
||||
if(OPENMC_USE_UWUW)
|
||||
target_compile_definitions(libopenmc PRIVATE OPENMC_UWUW)
|
||||
target_link_libraries(libopenmc uwuw-shared)
|
||||
endif()
|
||||
elseif(OPENMC_USE_UWUW)
|
||||
set(OPENMC_USE_UWUW OFF)
|
||||
message(FATAL_ERROR "DAGMC must be enabled when UWUW is enabled.")
|
||||
endif()
|
||||
|
||||
if(OPENMC_USE_LIBMESH)
|
||||
|
|
@ -546,11 +554,6 @@ if(OPENMC_USE_NCRYSTAL)
|
|||
target_link_libraries(libopenmc NCrystal::NCrystal)
|
||||
endif()
|
||||
|
||||
if (OPENMC_USE_UWUW)
|
||||
target_compile_definitions(libopenmc PRIVATE UWUW)
|
||||
target_link_libraries(libopenmc uwuw-shared)
|
||||
endif()
|
||||
|
||||
#===============================================================================
|
||||
# Log build info that this executable can report later
|
||||
#===============================================================================
|
||||
|
|
|
|||
|
|
@ -39,6 +39,6 @@ if(@OPENMC_USE_MCPL@)
|
|||
find_package(MCPL REQUIRED)
|
||||
endif()
|
||||
|
||||
if(@OPENMC_USE_UWUW@)
|
||||
find_package(UWUW REQUIRED)
|
||||
endif()
|
||||
if(@OPENMC_USE_UWUW@ AND NOT ${DAGMC_BUILD_UWUW})
|
||||
message(FATAL_ERROR "UWUW is enabled in OpenMC but the DAGMC installation discovered was not configured with UWUW.")
|
||||
endif()
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
#include "openmc/settings.h"
|
||||
#include "openmc/string_utils.h"
|
||||
|
||||
#ifdef UWUW
|
||||
#ifdef OPENMC_UWUW
|
||||
#include "uwuw.hpp"
|
||||
#endif
|
||||
#include <fmt/core.h>
|
||||
|
|
@ -29,7 +29,7 @@ const bool DAGMC_ENABLED = true;
|
|||
const bool DAGMC_ENABLED = false;
|
||||
#endif
|
||||
|
||||
#ifdef UWUW
|
||||
#ifdef OPENMC_UWUW
|
||||
const bool UWUW_ENABLED = true;
|
||||
#else
|
||||
const bool UWUW_ENABLED = false;
|
||||
|
|
@ -112,6 +112,11 @@ void DAGUniverse::initialize()
|
|||
{
|
||||
geom_type() = GeometryType::DAG;
|
||||
|
||||
#ifdef OPENMC_UWUW
|
||||
// read uwuw materials from the .h5m file if present
|
||||
read_uwuw_materials();
|
||||
#endif
|
||||
|
||||
init_dagmc();
|
||||
|
||||
init_metadata();
|
||||
|
|
@ -431,16 +436,16 @@ void DAGUniverse::to_hdf5(hid_t universes_group) const
|
|||
|
||||
bool DAGUniverse::uses_uwuw() const
|
||||
{
|
||||
#ifdef UWUW
|
||||
#ifdef OPENMC_UWUW
|
||||
return uwuw_ && !uwuw_->material_library.empty();
|
||||
#else
|
||||
return false;
|
||||
#endif // UWUW
|
||||
#endif // OPENMC_UWUW
|
||||
}
|
||||
|
||||
std::string DAGUniverse::get_uwuw_materials_xml() const
|
||||
{
|
||||
#ifdef UWUW
|
||||
#ifdef OPENMC_UWUW
|
||||
if (!uses_uwuw()) {
|
||||
throw std::runtime_error("This DAGMC Universe does not use UWUW materials");
|
||||
}
|
||||
|
|
@ -460,12 +465,12 @@ std::string DAGUniverse::get_uwuw_materials_xml() const
|
|||
return ss.str();
|
||||
#else
|
||||
fatal_error("DAGMC was not configured with UWUW.");
|
||||
#endif // UWUW
|
||||
#endif // OPENMC_UWUW
|
||||
}
|
||||
|
||||
void DAGUniverse::write_uwuw_materials_xml(const std::string& outfile) const
|
||||
{
|
||||
#ifdef UWUW
|
||||
#ifdef OPENMC_UWUW
|
||||
if (!uses_uwuw()) {
|
||||
throw std::runtime_error(
|
||||
"This DAGMC universe does not use UWUW materials.");
|
||||
|
|
@ -478,7 +483,7 @@ void DAGUniverse::write_uwuw_materials_xml(const std::string& outfile) const
|
|||
mats_xml.close();
|
||||
#else
|
||||
fatal_error("DAGMC was not configured with UWUW.");
|
||||
#endif
|
||||
#endif // OPENMC_UWUW
|
||||
}
|
||||
|
||||
void DAGUniverse::legacy_assign_material(
|
||||
|
|
@ -540,7 +545,7 @@ void DAGUniverse::legacy_assign_material(
|
|||
|
||||
void DAGUniverse::read_uwuw_materials()
|
||||
{
|
||||
#ifdef UWUW
|
||||
#ifdef OPENMC_UWUW
|
||||
// If no filename was provided, don't read UWUW materials
|
||||
if (filename_ == "")
|
||||
return;
|
||||
|
|
@ -580,16 +585,13 @@ void DAGUniverse::read_uwuw_materials()
|
|||
}
|
||||
#else
|
||||
fatal_error("DAGMC was not configured with UWUW.");
|
||||
#endif
|
||||
#endif // OPENMC_UWUW
|
||||
}
|
||||
|
||||
void DAGUniverse::uwuw_assign_material(
|
||||
moab::EntityHandle vol_handle, std::unique_ptr<DAGCell>& c) const
|
||||
{
|
||||
#ifdef UWUW
|
||||
// read materials from uwuw material file
|
||||
read_uwuw_materials();
|
||||
|
||||
#ifdef OPENMC_UWUW
|
||||
// lookup material in uwuw if present
|
||||
std::string uwuw_mat = dmd_ptr->volume_material_property_data_eh[vol_handle];
|
||||
if (uwuw_->material_library.count(uwuw_mat) != 0) {
|
||||
|
|
@ -601,11 +603,11 @@ void DAGUniverse::uwuw_assign_material(
|
|||
} else {
|
||||
fatal_error(fmt::format("Material with value '{}' not found in the "
|
||||
"UWUW material library",
|
||||
mat_str));
|
||||
uwuw_mat));
|
||||
}
|
||||
#else
|
||||
fatal_error("DAGMC was not configured with UWUW.");
|
||||
#endif
|
||||
#endif // OPENMC_UWUW
|
||||
}
|
||||
//==============================================================================
|
||||
// DAGMC Cell implementation
|
||||
|
|
|
|||
|
|
@ -347,7 +347,7 @@ void print_build_info()
|
|||
#ifdef COVERAGEBUILD
|
||||
coverage = y;
|
||||
#endif
|
||||
#ifdef UWUW
|
||||
#ifdef OPENMC_UWUW
|
||||
uwuw = y;
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue