mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Merge remote-tracking branch 'upstream/develop' into develop
This commit is contained in:
commit
bc1efb50ba
9 changed files with 1011 additions and 806 deletions
|
|
@ -9,6 +9,11 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
|||
# Set module path
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
|
||||
|
||||
# Allow user to specify <project>_ROOT variables
|
||||
if (NOT (CMAKE_VERSION VERSION_LESS 3.12))
|
||||
cmake_policy(SET CMP0074 NEW)
|
||||
endif()
|
||||
|
||||
#===============================================================================
|
||||
# Command line options
|
||||
#===============================================================================
|
||||
|
|
@ -35,18 +40,18 @@ endif()
|
|||
#===============================================================================
|
||||
if(dagmc)
|
||||
find_package(DAGMC REQUIRED)
|
||||
add_library(dagmc-imported INTERFACE IMPORTED)
|
||||
link_directories(${DAGMC_LIBRARY_DIRS})
|
||||
target_link_libraries(dagmc-imported INTERFACE ${DAGMC_LIBRARIES})
|
||||
target_include_directories(dagmc-imported INTERFACE ${DAGMC_INCLUDE_DIRS})
|
||||
else()
|
||||
set(DAGMC_FOUND false)
|
||||
endif()
|
||||
|
||||
#===============================================================================
|
||||
# HDF5 for binary output
|
||||
#===============================================================================
|
||||
|
||||
# Allow user to specify HDF5_ROOT
|
||||
if (NOT (CMAKE_VERSION VERSION_LESS 3.12))
|
||||
cmake_policy(SET CMP0074 NEW)
|
||||
endif()
|
||||
|
||||
# Unfortunately FindHDF5.cmake will always prefer a serial HDF5 installation
|
||||
# over a parallel installation if both appear on the user's PATH. To get around
|
||||
# this, we check for the environment variable HDF5_ROOT and if it exists, use it
|
||||
|
|
@ -357,8 +362,7 @@ target_link_libraries(libopenmc ${ldflags} ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES
|
|||
|
||||
if(dagmc)
|
||||
target_compile_definitions(libopenmc PRIVATE DAGMC)
|
||||
target_link_libraries(libopenmc ${DAGMC_LIBRARIES})
|
||||
target_include_directories(libopenmc PRIVATE ${DAGMC_INCLUDE_DIRS})
|
||||
target_link_libraries(libopenmc dagmc-imported)
|
||||
endif()
|
||||
|
||||
#===============================================================================
|
||||
|
|
@ -388,6 +392,8 @@ add_custom_command(TARGET libopenmc POST_BUILD
|
|||
# Install executable, scripts, manpage, license
|
||||
#===============================================================================
|
||||
|
||||
configure_file(cmake/OpenMCConfig.cmake.in "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/OpenMCConfig.cmake" @ONLY)
|
||||
|
||||
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/OpenMC)
|
||||
install(TARGETS openmc libopenmc faddeeva
|
||||
EXPORT openmc-targets
|
||||
|
|
@ -401,7 +407,7 @@ install(EXPORT openmc-targets
|
|||
DESTINATION ${INSTALL_CONFIGDIR})
|
||||
|
||||
install(DIRECTORY src/relaxng DESTINATION ${CMAKE_INSTALL_DATADIR}/openmc)
|
||||
install(FILES cmake/OpenMCConfig.cmake DESTINATION ${INSTALL_CONFIGDIR})
|
||||
install(FILES "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/OpenMCConfig.cmake" DESTINATION ${INSTALL_CONFIGDIR})
|
||||
install(FILES man/man1/openmc.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
|
||||
install(FILES LICENSE DESTINATION "${CMAKE_INSTALL_DOCDIR}" RENAME copyright)
|
||||
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
|
|
|
|||
|
|
@ -12,7 +12,9 @@ find_path(DAGMC_CMAKE_CONFIG NAMES DAGMCConfig.cmake
|
|||
PATHS ENV LD_LIBRARY_PATH
|
||||
PATH_SUFFIXES lib Lib cmake lib/cmake
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
message(STATUS "Found DAGMC in ${DAGMC_CMAKE_CONFIG}")
|
||||
|
||||
include(${DAGMC_CMAKE_CONFIG}/DAGMCConfig.cmake)
|
||||
if(DAGMC_CMAKE_CONFIG)
|
||||
message(STATUS "Found DAGMC in ${DAGMC_CMAKE_CONFIG}")
|
||||
include(${DAGMC_CMAKE_CONFIG}/DAGMCConfig.cmake)
|
||||
else()
|
||||
message(WARNING "Cound not find DAGMC")
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -5,6 +5,15 @@ find_package(gsl-lite REQUIRED HINTS ${OpenMC_CMAKE_DIR}/../gsl-lite)
|
|||
find_package(pugixml REQUIRED HINTS ${OpenMC_CMAKE_DIR}/../pugixml)
|
||||
find_package(xtl REQUIRED HINTS ${OpenMC_CMAKE_DIR}/../xtl)
|
||||
find_package(xtensor REQUIRED HINTS ${OpenMC_CMAKE_DIR}/../xtensor)
|
||||
if(@DAGMC_FOUND@)
|
||||
find_package(DAGMC REQUIRED HINTS @DAGMC_LIBRARY_DIRS@)
|
||||
add_library(dagmc-imported INTERFACE IMPORTED)
|
||||
target_link_libraries(dagmc-imported INTERFACE ${DAGMC_LIBRARIES})
|
||||
foreach(dir ${DAGMC_LIBRARY_DIRS})
|
||||
target_link_libraries(dagmc-imported INTERFACE "-L${dir}")
|
||||
endforeach()
|
||||
target_include_directories(dagmc-imported INTERFACE ${DAGMC_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
if(NOT TARGET OpenMC::libopenmc)
|
||||
include("${OpenMC_CMAKE_DIR}/OpenMCTargets.cmake")
|
||||
|
|
@ -784,8 +784,9 @@ class IncidentPhoton(EqualityMixin):
|
|||
sub_group = shell_group.create_group(key)
|
||||
|
||||
# Write atomic relaxation
|
||||
if key in self.atomic_relaxation.subshells:
|
||||
self.atomic_relaxation.to_hdf5(sub_group, key)
|
||||
if self.atomic_relaxation is not None:
|
||||
if key in self.atomic_relaxation.subshells:
|
||||
self.atomic_relaxation.to_hdf5(sub_group, key)
|
||||
else:
|
||||
continue
|
||||
|
||||
|
|
|
|||
1752
openmc/surface.py
1752
openmc/surface.py
File diff suppressed because it is too large
Load diff
|
|
@ -377,7 +377,7 @@ CSGCell::CSGCell(pugi::xml_node cell_node)
|
|||
throw std::runtime_error{"Invalid surface ID " + std::to_string(abs(r))
|
||||
+ " specified in region for cell " + std::to_string(id_) + "."};
|
||||
}
|
||||
r = copysign(it->second + 1, r);
|
||||
r = (r > 0) ? it->second + 1 : -(it->second + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -536,8 +536,8 @@ CSGCell::to_hdf5(hid_t cell_group) const
|
|||
region_spec << " |";
|
||||
} else {
|
||||
// Note the off-by-one indexing
|
||||
region_spec << " "
|
||||
<< copysign(model::surfaces[abs(token)-1]->id_, token);
|
||||
auto surf_id = model::surfaces[abs(token)-1]->id_;
|
||||
region_spec << " " << ((token > 0) ? surf_id : -surf_id);
|
||||
}
|
||||
}
|
||||
write_string(group, "region", region_spec.str(), false);
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ extern "C" void print_particle(Particle* p)
|
|||
// Display miscellaneous info.
|
||||
if (p->surface_ != 0) {
|
||||
const Surface& surf {*model::surfaces[std::abs(p->surface_)-1]};
|
||||
fmt::print(" Surface = {}\n", std::copysign(surf.id_, p->surface_));
|
||||
fmt::print(" Surface = {}\n", (p->surface_ > 0) ? surf.id_ : -surf.id_);
|
||||
}
|
||||
fmt::print(" Weight = {}\n", p->wgt_);
|
||||
if (settings::run_CE) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "openmc/particle.h"
|
||||
|
||||
#include <algorithm> // copy, min
|
||||
#include <cmath> // log, abs, copysign
|
||||
#include <cmath> // log, abs
|
||||
|
||||
#include <fmt/core.h>
|
||||
|
||||
|
|
@ -539,7 +539,7 @@ Particle::cross_surface()
|
|||
// TODO: off-by-one
|
||||
surface_ = rotational ?
|
||||
surf_p->i_periodic_ + 1 :
|
||||
std::copysign(surf_p->i_periodic_ + 1, surface_);
|
||||
((surface_ > 0) ? surf_p->i_periodic_ + 1 : -(surf_p->i_periodic_ + 1));
|
||||
|
||||
// Figure out what cell particle is in now
|
||||
n_coord_ = 1;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
from collections.abc import Mapping, Callable
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
|
|
@ -144,3 +145,9 @@ def test_export_to_hdf5(tmpdir, element):
|
|||
element2.bremsstrahlung['electron_energy']).all()
|
||||
# Export to hdf5 again
|
||||
element2.export_to_hdf5(filename, 'w')
|
||||
|
||||
def test_photodat_only(run_in_tmpdir):
|
||||
endf_dir = Path(os.environ['OPENMC_ENDF_DATA'])
|
||||
photoatomic_file = endf_dir / 'photoat' / 'photoat-001_H_000.endf'
|
||||
data = openmc.data.IncidentPhoton.from_endf(photoatomic_file)
|
||||
data.export_to_hdf5('tmp.h5', 'w')
|
||||
Loading…
Add table
Add a link
Reference in a new issue