Skip to content

Commit b83d609

Browse files
author
Jilang Miao@roarcollab
committed
Merge remote-tracking branch 'upstream/develop' into develop
2 parents f9c1e64 + f544d02 commit b83d609

716 files changed

Lines changed: 29750 additions & 18078 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ jobs:
7575
LIBMESH: ${{ matrix.libmesh }}
7676
NPY_DISABLE_CPU_FEATURES: "AVX512F AVX512_SKX"
7777
OPENBLAS_NUM_THREADS: 1
78+
PYTEST_ADDOPTS: --cov=openmc --cov-report=lcov:coverage-python.lcov
7879
# libfabric complains about fork() as a result of using Python multiprocessing.
7980
# We can work around it with RDMAV_FORK_SAFE=1 in libfabric < 1.13 and with
8081
# FI_EFA_FORK_SAFE=1 in more recent versions.
@@ -171,11 +172,37 @@ jobs:
171172
uses: mxschmitt/action-tmate@v3
172173
timeout-minutes: 10
173174

174-
- name: after_success
175+
- name: Generate C++ coverage (gcovr)
175176
shell: bash
176177
run: |
177-
cpp-coveralls -i src -i include -e src/external --exclude-pattern "/usr/*" --dump cpp_cov.json
178-
coveralls --merge=cpp_cov.json --service=github
178+
# Produce LCOV directly from gcov data in the build tree
179+
gcovr \
180+
--root "$GITHUB_WORKSPACE" \
181+
--object-directory "$GITHUB_WORKSPACE/build" \
182+
--filter "$GITHUB_WORKSPACE/src" \
183+
--filter "$GITHUB_WORKSPACE/include" \
184+
--exclude "$GITHUB_WORKSPACE/src/external/.*" \
185+
--exclude "$GITHUB_WORKSPACE/src/include/openmc/external/.*" \
186+
--gcov-ignore-errors source_not_found \
187+
--gcov-ignore-errors output_error \
188+
--gcov-ignore-parse-errors suspicious_hits.warn \
189+
--print-summary \
190+
--lcov -o coverage-cpp.lcov || true
191+
192+
- name: Merge C++ and Python coverage
193+
shell: bash
194+
run: |
195+
# Merge C++ and Python LCOV into a single file for upload
196+
cat coverage-cpp.lcov coverage-python.lcov > coverage.lcov
197+
198+
- name: Upload coverage to Coveralls
199+
if: ${{ hashFiles('coverage.lcov') != '' }}
200+
uses: coverallsapp/github-action@v2
201+
with:
202+
github-token: ${{ secrets.GITHUB_TOKEN }}
203+
parallel: true
204+
flag-name: C++ and Python
205+
path-to-lcov: coverage.lcov
179206

180207
finish:
181208
needs: main
@@ -184,5 +211,5 @@ jobs:
184211
- name: Coveralls Finished
185212
uses: coverallsapp/github-action@v2
186213
with:
187-
github-token: ${{ secrets.github_token }}
214+
github-token: ${{ secrets.GITHUB_TOKEN }}
188215
parallel-finished: true

CITATION.cff

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
preferred-citation:
2+
authors:
3+
- family-names: Romano
4+
given-names: Paul K.
5+
orcid: "https://orcid.org/0000-0002-1147-045X"
6+
- final-names: Horelik
7+
given-names: Nicholas E.
8+
- family-names: Herman
9+
given-names: Bryan R.
10+
- family-names: Nelson
11+
given-names: Adam G.
12+
orcid: "https://orcid.org/0000-0002-3614-0676"
13+
- family-names: Forget
14+
given-names: Benoit
15+
orcid: "https://orcid.org/0000-0003-1459-7672"
16+
- family-names: Smith
17+
given-names: Kord
18+
contact:
19+
- family-names: Romano
20+
given-names: Paul K.
21+
orcid: "https://orcid.org/0000-0002-1147-045X"
22+
doi: 10.1016/j.anucene.2014.07.048
23+
issn: 0306-4549
24+
volume: 82
25+
journal: Annals of Nuclear Energy
26+
publisher:
27+
name: Elsevier
28+
start: 90
29+
end: 97
30+
year: 2015
31+
month: 8
32+
title: "OpenMC: A state-of-the-art Monte Carlo code for research and development"
33+
type: article
34+
url: "https://doi.org/10.1016/j.anucene.2014.07.048"

CMakeLists.txt

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ option(OPENMC_ENABLE_COVERAGE "Compile with coverage analysis flags"
3636
option(OPENMC_USE_DAGMC "Enable support for DAGMC (CAD) geometry" OFF)
3737
option(OPENMC_USE_LIBMESH "Enable support for libMesh unstructured mesh tallies" OFF)
3838
option(OPENMC_USE_MPI "Enable MPI" OFF)
39-
option(OPENMC_USE_MCPL "Enable MCPL" OFF)
4039
option(OPENMC_USE_UWUW "Enable UWUW" OFF)
40+
option(OPENMC_FORCE_VENDORED_LIBS "Explicitly use submodules defined in 'vendor'" OFF)
4141

4242
message(STATUS "OPENMC_USE_OPENMP ${OPENMC_USE_OPENMP}")
4343
message(STATUS "OPENMC_BUILD_TESTS ${OPENMC_BUILD_TESTS}")
@@ -46,8 +46,8 @@ message(STATUS "OPENMC_ENABLE_COVERAGE ${OPENMC_ENABLE_COVERAGE}")
4646
message(STATUS "OPENMC_USE_DAGMC ${OPENMC_USE_DAGMC}")
4747
message(STATUS "OPENMC_USE_LIBMESH ${OPENMC_USE_LIBMESH}")
4848
message(STATUS "OPENMC_USE_MPI ${OPENMC_USE_MPI}")
49-
message(STATUS "OPENMC_USE_MCPL ${OPENMC_USE_MCPL}")
5049
message(STATUS "OPENMC_USE_UWUW ${OPENMC_USE_UWUW}")
50+
message(STATUS "OPENMC_FORCE_VENDORED_LIBS ${OPENMC_FORCE_VENDORED_LIBS}")
5151

5252
# Warnings for deprecated options
5353
foreach(OLD_OPT IN ITEMS "openmp" "profile" "coverage" "dagmc" "libmesh")
@@ -189,22 +189,6 @@ if(${HDF5_VERSION} VERSION_GREATER_EQUAL 1.12.0)
189189
list(APPEND cxxflags -DH5Oget_info_by_idx_vers=1 -DH5O_info_t_vers=1)
190190
endif()
191191

192-
#===============================================================================
193-
# MCPL
194-
#===============================================================================
195-
196-
if (OPENMC_USE_MCPL)
197-
if (NOT DEFINED MCPL_DIR)
198-
execute_process(
199-
COMMAND mcpl-config --show cmakedir
200-
OUTPUT_VARIABLE MCPL_DIR
201-
OUTPUT_STRIP_TRAILING_WHITESPACE
202-
)
203-
endif()
204-
find_package(MCPL REQUIRED)
205-
message(STATUS "Found MCPL: ${MCPL_DIR} (found version \"${MCPL_VERSION}\")")
206-
endif()
207-
208192
#===============================================================================
209193
# Set compile/link flags based on which compiler is being used
210194
#===============================================================================
@@ -256,41 +240,61 @@ endif()
256240
# pugixml library
257241
#===============================================================================
258242

259-
find_package_write_status(pugixml)
260-
if (NOT pugixml_FOUND)
243+
if(OPENMC_FORCE_VENDORED_LIBS)
261244
add_subdirectory(vendor/pugixml)
262245
set_target_properties(pugixml PROPERTIES CXX_STANDARD 14 CXX_EXTENSIONS OFF)
246+
else()
247+
find_package_write_status(pugixml)
248+
if (NOT pugixml_FOUND)
249+
add_subdirectory(vendor/pugixml)
250+
set_target_properties(pugixml PROPERTIES CXX_STANDARD 14 CXX_EXTENSIONS OFF)
251+
endif()
263252
endif()
264253

265254
#===============================================================================
266255
# {fmt} library
267256
#===============================================================================
268257

269-
find_package_write_status(fmt)
270-
if (NOT fmt_FOUND)
258+
if(OPENMC_FORCE_VENDORED_LIBS)
271259
set(FMT_INSTALL ON CACHE BOOL "Generate the install target.")
272260
add_subdirectory(vendor/fmt)
261+
else()
262+
find_package_write_status(fmt)
263+
if (NOT fmt_FOUND)
264+
set(FMT_INSTALL ON CACHE BOOL "Generate the install target.")
265+
add_subdirectory(vendor/fmt)
266+
endif()
273267
endif()
274268

275269
#===============================================================================
276270
# xtensor header-only library
277271
#===============================================================================
278272

279-
find_package_write_status(xtensor)
280-
if (NOT xtensor_FOUND)
273+
if(OPENMC_FORCE_VENDORED_LIBS)
281274
add_subdirectory(vendor/xtl)
282275
set(xtl_DIR ${CMAKE_CURRENT_BINARY_DIR}/vendor/xtl)
283276
add_subdirectory(vendor/xtensor)
277+
else()
278+
find_package_write_status(xtensor)
279+
if (NOT xtensor_FOUND)
280+
add_subdirectory(vendor/xtl)
281+
set(xtl_DIR ${CMAKE_CURRENT_BINARY_DIR}/vendor/xtl)
282+
add_subdirectory(vendor/xtensor)
283+
endif()
284284
endif()
285285

286286
#===============================================================================
287287
# Catch2 library
288288
#===============================================================================
289289

290290
if(OPENMC_BUILD_TESTS)
291-
find_package_write_status(Catch2)
292-
if (NOT Catch2_FOUND)
291+
if (OPENMC_FORCE_VENDORED_LIBS)
293292
add_subdirectory(vendor/Catch2)
293+
else()
294+
find_package_write_status(Catch2)
295+
if (NOT Catch2_FOUND)
296+
add_subdirectory(vendor/Catch2)
297+
endif()
294298
endif()
295299
endif()
296300

@@ -334,6 +338,7 @@ list(APPEND libopenmc_SOURCES
334338
src/cell.cpp
335339
src/chain.cpp
336340
src/cmfd_solver.cpp
341+
src/collision_track.cpp
337342
src/cross_sections.cpp
338343
src/dagmc.cpp
339344
src/distribution.cpp
@@ -414,6 +419,7 @@ list(APPEND libopenmc_SOURCES
414419
src/tallies/filter_materialfrom.cpp
415420
src/tallies/filter_mesh.cpp
416421
src/tallies/filter_meshborn.cpp
422+
src/tallies/filter_meshmaterial.cpp
417423
src/tallies/filter_meshsurface.cpp
418424
src/tallies/filter_mu.cpp
419425
src/tallies/filter_musurface.cpp
@@ -498,11 +504,11 @@ else()
498504
endif()
499505

500506
if(OPENMC_USE_DAGMC)
501-
target_compile_definitions(libopenmc PRIVATE DAGMC)
507+
target_compile_definitions(libopenmc PRIVATE OPENMC_DAGMC_ENABLED)
502508
target_link_libraries(libopenmc dagmc-shared)
503509

504510
if(OPENMC_USE_UWUW)
505-
target_compile_definitions(libopenmc PRIVATE OPENMC_UWUW)
511+
target_compile_definitions(libopenmc PRIVATE OPENMC_UWUW_ENABLED)
506512
target_link_libraries(libopenmc uwuw-shared)
507513
endif()
508514
elseif(OPENMC_USE_UWUW)
@@ -511,7 +517,7 @@ elseif(OPENMC_USE_UWUW)
511517
endif()
512518

513519
if(OPENMC_USE_LIBMESH)
514-
target_compile_definitions(libopenmc PRIVATE LIBMESH)
520+
target_compile_definitions(libopenmc PRIVATE OPENMC_LIBMESH_ENABLED)
515521
target_link_libraries(libopenmc PkgConfig::LIBMESH)
516522
endif()
517523

@@ -534,11 +540,6 @@ if (OPENMC_BUILD_TESTS)
534540
add_subdirectory(tests/cpp_unit_tests)
535541
endif()
536542

537-
if (OPENMC_USE_MCPL)
538-
target_compile_definitions(libopenmc PUBLIC OPENMC_MCPL)
539-
target_link_libraries(libopenmc MCPL::mcpl)
540-
endif()
541-
542543
#===============================================================================
543544
# Log build info that this executable can report later
544545
#===============================================================================

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ ARG compile_cores=1
2424
ARG build_dagmc=off
2525
ARG build_libmesh=off
2626

27-
FROM debian:bookworm-slim AS dependencies
27+
FROM ubuntu:24.04 AS dependencies
2828

2929
ARG compile_cores
3030
ARG build_dagmc
@@ -96,6 +96,7 @@ RUN if [ "$build_dagmc" = "on" ]; then \
9696
# Install addition packages required for DAGMC
9797
apt-get -y install libeigen3-dev libnetcdf-dev libtbb-dev libglfw3-dev \
9898
&& pip install --upgrade numpy \
99+
&& pip install --no-cache-dir setuptools cython \
99100
# Clone and install EMBREE
100101
&& mkdir -p $HOME/EMBREE && cd $HOME/EMBREE \
101102
&& git clone --single-branch -b ${EMBREE_TAG} --depth 1 ${EMBREE_REPO} \

cmake/OpenMCConfig.cmake.in

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
get_filename_component(OpenMC_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY)
22

3-
find_package(fmt REQUIRED HINTS ${OpenMC_CMAKE_DIR}/../fmt)
4-
find_package(pugixml REQUIRED HINTS ${OpenMC_CMAKE_DIR}/../pugixml)
5-
find_package(xtl REQUIRED HINTS ${OpenMC_CMAKE_DIR}/../xtl)
6-
find_package(xtensor REQUIRED HINTS ${OpenMC_CMAKE_DIR}/../xtensor)
3+
# Compute the install prefix from this file's location
4+
get_filename_component(_OPENMC_PREFIX "${OpenMC_CMAKE_DIR}/../../.." ABSOLUTE)
5+
6+
find_package(fmt CONFIG REQUIRED HINTS ${_OPENMC_PREFIX})
7+
find_package(pugixml CONFIG REQUIRED HINTS ${_OPENMC_PREFIX})
8+
find_package(xtl CONFIG REQUIRED HINTS ${_OPENMC_PREFIX})
9+
find_package(xtensor CONFIG REQUIRED HINTS ${_OPENMC_PREFIX})
710
if(@OPENMC_USE_DAGMC@)
811
find_package(DAGMC REQUIRED HINTS @DAGMC_DIR@)
912
endif()
@@ -29,10 +32,6 @@ if(@OPENMC_USE_OPENMP@)
2932
find_package(OpenMP REQUIRED)
3033
endif()
3134

32-
if(@OPENMC_USE_MCPL@)
33-
find_package(MCPL REQUIRED HINTS @MCPL_DIR@)
34-
endif()
35-
3635
if(@OPENMC_USE_UWUW@ AND NOT ${DAGMC_BUILD_UWUW})
3736
message(FATAL_ERROR "UWUW is enabled in OpenMC but the DAGMC installation discovered was not configured with UWUW.")
3837
endif()

docs/source/capi/index.rst

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,17 @@ Functions
8484
:return: Return status (negative if an error occurred)
8585
:rtype: int
8686
87+
.. c:function:: int openmc_cell_get_density(int32_t index, const int32_t* instance, double* density)
88+
89+
Get the density of a cell
90+
91+
:param int32_t index: Index in the cells array
92+
:param int32_t* instance: Which instance of the cell. If a null pointer is passed, the density
93+
multiplier of the first instance is returned.
94+
:param double* density: Density of the cell in [g/cm3]
95+
:return: Return status (negative if an error occurred)
96+
:rtype: int
97+
8798
.. c:function:: int openmc_cell_set_fill(int32_t index, int type, int32_t n, const int32_t* indices)
8899
89100
Set the fill for a cell
@@ -113,8 +124,22 @@ Functions
113124
:param double T: Temperature in Kelvin
114125
:param instance: Which instance of the cell. To set the temperature for all
115126
instances, pass a null pointer.
116-
:param set_contained: If the cell is not filled by a material, whether to set the temperatures
117-
of all filled cells
127+
:param bool set_contained: If the cell is not filled by a material, whether
128+
to set the temperatures of all filled cells
129+
:type instance: const int32_t*
130+
:return: Return status (negative if an error occurred)
131+
:rtype: int
132+
133+
.. c:function:: int openmc_cell_set_density(index index, double density, const int32_t* instance, bool set_contained)
134+
135+
Set the density of a cell.
136+
137+
:param int32_t index: Index in the cells array
138+
:param double density: Density of the cell in [g/cm3]
139+
:param instance: Which instance of the cell. To set the density multiplier for all
140+
instances, pass a null pointer.
141+
:param bool set_contained: If the cell is not filled by a material, whether
142+
to set the density multiplier of all filled cells
118143
:type instance: const int32_t*
119144
:return: Return status (negative if an error occurred)
120145
:rtype: int

docs/source/conf.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,7 @@
121121
# -- Options for HTML output ---------------------------------------------------
122122

123123
# The theme to use for HTML and HTML Help pages
124-
import sphinx_rtd_theme
125124
html_theme = 'sphinx_rtd_theme'
126-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
127125
html_baseurl = "https://docs.openmc.org/en/stable/"
128126

129127
html_logo = '_images/openmc_logo.png'
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
.. _io_collision_track:
2+
3+
===========================
4+
Collision Track File Format
5+
===========================
6+
7+
When collision tracking is enabled with ``mcpl=false`` (the default), OpenMC
8+
writes binary data to an HDF5 file named ``collision_track.h5``. The same data
9+
may also be written after each batch when multiple files are requested
10+
(``collision_track.N.h5``) or when the run is performed in parallel. The file
11+
contains the information needed to reconstruct each recorded collision.
12+
13+
The current revision of the collision track file format is 1.0.
14+
15+
**/**
16+
17+
:Attributes:
18+
- **filetype** (*char[]*) -- String indicating the type of file.
19+
For collision-track files the value is ``"collision_track"``.
20+
21+
:Datasets:
22+
23+
- **collision_track_bank** (Compound type) -- Collision information
24+
for each stored event. Each entry in the dataset corresponds to one
25+
collision and contains the following fields:
26+
27+
- ``r`` (*double[3]*) -- Position of the collision in [cm].
28+
- ``u`` (*double[3]*) -- Direction unit vector immediately after the collision.
29+
- ``E`` (*double*) -- Incident particle energy before the collision in [eV].
30+
- ``dE`` (*double*) -- Energy loss over the collision (:math:`E_\text{before} - E_\text{after}`) in [eV].
31+
- ``time`` (*double*) -- Time of the collision in [s].
32+
- ``wgt`` (*double*) -- Particle weight at the collision.
33+
- ``event_mt`` (*int*) -- ENDF MT number identifying the reaction.
34+
- ``delayed_group`` (*int*) -- Delayed neutron group index (non-zero for delayed events).
35+
- ``cell_id`` (*int*) -- ID of the cell in which the collision occurred.
36+
- ``nuclide_id`` (*int*) -- ZA identifier of the nuclide (ZZZAAAM format).
37+
- ``material_id`` (*int*) -- ID of the material containing the collision site.
38+
- ``universe_id`` (*int*) -- ID of the universe containing the collision site.
39+
- ``n_collision`` (*int*) -- Collision counter for the particle history.
40+
- ``particle`` (*int*) -- Particle type (0=neutron, 1=photon, 2=electron, 3=positron).
41+
- ``parent_id`` (*int64*) -- Unique ID of the parent particle.
42+
- ``progeny_id`` (*int64*) -- Progeny ID of the particle.
43+
44+
In an MPI run, OpenMC writes the combined dataset by gathering collision-track
45+
entries from all ranks before flushing them to disk, so the final file appears
46+
as though it were produced serially.

0 commit comments

Comments
 (0)