Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for UWUW Macro Conflict #3150

Merged
merged 18 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ option(OPENMC_USE_LIBMESH "Enable support for libMesh unstructured mesh tall
option(OPENMC_USE_MPI "Enable MPI" OFF)
option(OPENMC_USE_MCPL "Enable MCPL" OFF)
option(OPENMC_USE_NCRYSTAL "Enable support for NCrystal scattering" OFF)
option(OPENMC_USE_UWUW "Enable UWUW" OFF)
option(OPENMC_USE_UWUW "Enable UWUW" ON)
pshriwise marked this conversation as resolved.
Show resolved Hide resolved

# Warnings for deprecated options
foreach(OLD_OPT IN ITEMS "openmp" "profile" "coverage" "dagmc" "libmesh")
Expand Down Expand Up @@ -509,6 +509,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(WARNING "UWUW is enabled but DAGMC was not found. Disabling.")
ahnaf-tahmid-chowdhury marked this conversation as resolved.
Show resolved Hide resolved
endif()

if(OPENMC_USE_LIBMESH)
Expand Down Expand Up @@ -545,11 +553,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
#===============================================================================
Expand Down
2 changes: 1 addition & 1 deletion cmake/OpenMCConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ if(@OPENMC_USE_MCPL@)
endif()

if(@OPENMC_USE_UWUW@)
find_package(UWUW REQUIRED)
find_package(OPEMC_UWUW REQUIRED)
pshriwise marked this conversation as resolved.
Show resolved Hide resolved
endif()
2 changes: 1 addition & 1 deletion include/openmc/dagmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class DAGUniverse : public Universe {
//! \param[in] vol_handle The DAGMC material assignment string
//! \param[in] c The OpenMC cell to which the material is assigned
void uwuw_assign_material(
moab::EntityHandle vol_handle, std::unique_ptr<DAGCell>& c) const;
pshriwise marked this conversation as resolved.
Show resolved Hide resolved
moab::EntityHandle vol_handle, std::unique_ptr<DAGCell>& c);

//! Assign a material to a cell based
//! \param[in] mat_string The DAGMC material assignment string
Expand Down
28 changes: 14 additions & 14 deletions src/dagmc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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;
Expand Down Expand Up @@ -431,16 +431,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");
}
Expand All @@ -460,12 +460,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.");
Expand All @@ -478,7 +478,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(
Expand Down Expand Up @@ -540,7 +540,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;
Expand Down Expand Up @@ -580,13 +580,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
moab::EntityHandle vol_handle, std::unique_ptr<DAGCell>& c)
{
#ifdef UWUW
#ifdef OPENMC_UWUW
// read materials from uwuw material file
read_uwuw_materials();

Expand All @@ -601,11 +601,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
Expand Down
2 changes: 1 addition & 1 deletion src/output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ void print_build_info()
#ifdef COVERAGEBUILD
coverage = y;
#endif
#ifdef UWUW
#ifdef OPENMC_UWUW
uwuw = y;
#endif

Expand Down
Loading