Skip to content

Commit

Permalink
Merge pull request #1747 from pshriwise/dagmc-3.2.0
Browse files Browse the repository at this point in the history
Updates for DAGMC 3.2.0
  • Loading branch information
paulromano authored Jan 18, 2021
2 parents 4ac0d5f + 1baf921 commit 6aa1570
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ endif()
#===============================================================================
if(dagmc)
find_package(DAGMC REQUIRED PATH_SUFFIXES lib/cmake)
if (${DAGMC_VERSION} VERSION_LESS 3.2.0)
message(FATAL_ERROR "Discovered DAGMC Version: ${DAGMC_VERSION}. \
Please update DAGMC to version 3.2.0 or greater.")
endif()
endif()

#===============================================================================
Expand Down Expand Up @@ -329,7 +333,7 @@ endif()
# Avoid vs error lnk1149 :output filename matches input filename
if(NOT MSVC)
set_target_properties(libopenmc PROPERTIES
OUTPUT_NAME openmc)
OUTPUT_NAME openmc)
endif()

target_include_directories(libopenmc
Expand Down
11 changes: 7 additions & 4 deletions src/dagmc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ bool get_uwuw_materials_xml(std::string& s) {
ss << "<materials>\n";
const auto& mat_lib = uwuw.material_library;
// write materials
for (auto mat : mat_lib) { ss << mat.second.openmc("atom"); }
for (auto mat : mat_lib) { ss << mat.second->openmc("atom"); }
// write footer
ss << "</materials>";
s = ss.str();
Expand Down Expand Up @@ -101,12 +101,15 @@ bool write_uwuw_materials_xml() {
return found_uwuw_mats;
}

void legacy_assign_material(const std::string& mat_string, DAGCell* c)
void legacy_assign_material(std::string mat_string, DAGCell* c)
{
bool mat_found_by_name = false;
// attempt to find a material with a matching name
to_lower(mat_string);
for (const auto& m : model::materials) {
if (mat_string == m->name_) {
std::string m_name = m->name();
to_lower(m_name);
if (mat_string == m_name) {
// assign the material with that name
if (!mat_found_by_name) {
mat_found_by_name = true;
Expand Down Expand Up @@ -239,7 +242,7 @@ void load_dagmc_geometry()
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 "
Expand Down
Binary file modified tests/regression_tests/dagmc/refl/dagmc.h5m
Binary file not shown.
Binary file modified tests/regression_tests/dagmc/uwuw/dagmc.h5m
Binary file not shown.

0 comments on commit 6aa1570

Please sign in to comment.