Skip to content

Commit 0635a09

Browse files
authored
Merge branch 'develop' into tdrr-clean-refactor
2 parents d0e7252 + 3e2f1f5 commit 0635a09

File tree

30 files changed

+814
-236
lines changed

30 files changed

+814
-236
lines changed

.github/workflows/ci.yml

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: Tests and Coverage
22

33
on:
44
# allows us to run workflows manually
@@ -21,7 +21,25 @@ env:
2121
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2222

2323
jobs:
24+
filter-changes:
25+
runs-on: ubuntu-latest
26+
outputs:
27+
source_changed: ${{ steps.filter.outputs.source_changed }}
28+
steps:
29+
- name: Check out the repository
30+
uses: actions/checkout@v4
31+
- name: Examine changed files
32+
id: filter
33+
uses: dorny/paths-filter@668c092af3649c4b664c54e4b704aa46782f6f7c # latest master commit, not released yet
34+
with:
35+
filters: |
36+
source_changed:
37+
- '!docs/**'
38+
- '!**/*.md'
39+
predicate-quantifier: 'every'
2440
main:
41+
needs: filter-changes
42+
if: ${{ needs.filter-changes.outputs.source_changed == 'true' }}
2543
runs-on: ubuntu-22.04
2644
strategy:
2745
matrix:
@@ -205,12 +223,33 @@ jobs:
205223
flag-name: C++ and Python
206224
path-to-lcov: coverage.lcov
207225

208-
finish:
209-
needs: main
226+
coverage:
227+
needs: [filter-changes, main]
228+
if: ${{ always() }}
210229
runs-on: ubuntu-latest
211230
steps:
212231
- name: Coveralls Finished
232+
if: ${{ needs.filter-changes.outputs.source_changed == 'true' }}
213233
uses: coverallsapp/github-action@v2
214234
with:
215235
github-token: ${{ secrets.GITHUB_TOKEN }}
216236
parallel-finished: true
237+
238+
ci-pass:
239+
needs: [filter-changes, main, coverage]
240+
name: Check CI status
241+
if: ${{ always() }}
242+
runs-on: ubuntu-latest
243+
steps:
244+
- name: Check CI status
245+
run: |
246+
if [[ "${{ needs.filter-changes.outputs.source_changed }}" == "false" ]]; then
247+
echo "Documentation-only change - CI skipped successfully"
248+
exit 0
249+
fi
250+
if [[ "${{ needs.main.result }}" == "success" && "${{ needs.coverage.result }}" == "success" ]]; then
251+
echo "CI passed"
252+
exit 0
253+
fi
254+
echo "CI failed"
255+
exit 1

AGENTS.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,24 @@ C++17/Python codebase where:
3131
- **Depletion**: `openmc.deplete` implements burnup via operator-splitting with various integrators (Predictor, CECM, etc.)
3232
- **Nuclear Data**: `openmc.data` provides programmatic access to nuclear data files (ENDF, ACE, HDF5)
3333

34+
## Git Branching Workflow
35+
36+
OpenMC uses a git flow branching model with two primary branches:
37+
38+
- **`develop` branch**: The main development branch where all ongoing development takes place. This is the **primary branch against which pull requests are submitted and merged**. This branch is not guaranteed to be stable and may contain work-in-progress features.
39+
- **`master` branch**: The stable release branch containing the latest stable release of OpenMC. This branch only receives merges from `develop` when the development team decides a release should occur.
40+
41+
### Instructions for Code Review
42+
43+
When analyzing code changes on a feature or bugfix branch (e.g., when a user asks "what do you think of these changes?"), **compare the branch changes against `develop`, not `master`**. Pull requests are submitted to merge into `develop`, so differences relative to `develop` represent the actual proposed changes. Comparing against `master` will include unrelated changes from other features that have already been merged to `develop`.
44+
45+
### Workflow for contributors
46+
47+
1. Create a feature/bugfix branch off `develop`
48+
2. Make changes and commit to the feature branch
49+
3. Open a pull request to merge the feature branch into `develop`
50+
4. A committer reviews and merges the PR into `develop`
51+
3452
## Critical Build & Test Workflows
3553

3654
### Build Dependencies

docs/source/usersguide/random_ray.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,7 @@ Supported scores:
513513
- total
514514
- fission
515515
- nu-fission
516+
- kappa-fission
516517
- events
517518

518519
Supported Estimators:

include/openmc/cell.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,11 @@ class Region {
123123
//! BoundingBox if the particle is in a complex cell.
124124
BoundingBox bounding_box_complex(vector<int32_t> postfix) const;
125125

126-
//! Enfource precedence: Parenthases, Complement, Intersection, Union
127-
void add_precedence();
126+
//! Enforce precedence between intersections and unions
127+
void enforce_precedence();
128128

129129
//! Add parenthesis to enforce precedence
130-
int64_t add_parentheses(int64_t start);
130+
void add_parentheses(int64_t start);
131131

132132
//! Remove complement operators from the expression
133133
void remove_complement_ops();

include/openmc/mesh.h

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#ifndef OPENMC_MESH_H
55
#define OPENMC_MESH_H
66

7+
#include <set>
78
#include <unordered_map>
89

910
#include "hdf5.h"
@@ -969,7 +970,7 @@ class LibMesh : public UnstructuredMesh {
969970

970971
Position sample_element(int32_t bin, uint64_t* seed) const override;
971972

972-
int get_bin(Position r) const override;
973+
virtual int get_bin(Position r) const override;
973974

974975
int n_bins() const override;
975976

@@ -1007,16 +1008,21 @@ class LibMesh : public UnstructuredMesh {
10071008

10081009
protected:
10091010
// Methods
1010-
10111011
//! Translate a bin value to an element reference
10121012
virtual const libMesh::Elem& get_element_from_bin(int bin) const;
10131013

10141014
//! Translate an element pointer to a bin index
10151015
virtual int get_bin_from_element(const libMesh::Elem* elem) const;
10161016

1017+
// Data members
10171018
libMesh::MeshBase* m_; //!< pointer to libMesh MeshBase instance, always set
10181019
//!< during intialization
1020+
vector<unique_ptr<libMesh::PointLocatorBase>>
1021+
pl_; //!< per-thread point locators
1022+
libMesh::BoundingBox bbox_; //!< bounding box of the mesh
1023+
10191024
private:
1025+
// Methods
10201026
void initialize() override;
10211027
void set_mesh_pointer_from_filename(const std::string& filename);
10221028
void build_eqn_sys();
@@ -1025,8 +1031,6 @@ class LibMesh : public UnstructuredMesh {
10251031
unique_ptr<libMesh::MeshBase> unique_m_ =
10261032
nullptr; //!< pointer to the libMesh MeshBase instance, only used if mesh is
10271033
//!< created inside OpenMC
1028-
vector<unique_ptr<libMesh::PointLocatorBase>>
1029-
pl_; //!< per-thread point locators
10301034
unique_ptr<libMesh::EquationSystems>
10311035
equation_systems_; //!< pointer to the libMesh EquationSystems
10321036
//!< instance
@@ -1035,16 +1039,16 @@ class LibMesh : public UnstructuredMesh {
10351039
std::unordered_map<std::string, unsigned int>
10361040
variable_map_; //!< mapping of variable names (tally scores) to libMesh
10371041
//!< variable numbers
1038-
libMesh::BoundingBox bbox_; //!< bounding box of the mesh
10391042
libMesh::dof_id_type
10401043
first_element_id_; //!< id of the first element in the mesh
10411044
};
10421045

10431046
class AdaptiveLibMesh : public LibMesh {
10441047
public:
10451048
// Constructor
1046-
AdaptiveLibMesh(
1047-
libMesh::MeshBase& input_mesh, double length_multiplier = 1.0);
1049+
AdaptiveLibMesh(libMesh::MeshBase& input_mesh, double length_multiplier = 1.0,
1050+
const std::set<libMesh::subdomain_id_type>& block_ids =
1051+
std::set<libMesh::subdomain_id_type>());
10481052

10491053
// Overridden methods
10501054
int n_bins() const override;
@@ -1056,6 +1060,8 @@ class AdaptiveLibMesh : public LibMesh {
10561060

10571061
void write(const std::string& filename) const override;
10581062

1063+
int get_bin(Position r) const override;
1064+
10591065
protected:
10601066
// Overridden methods
10611067
int get_bin_from_element(const libMesh::Elem* elem) const override;
@@ -1064,6 +1070,9 @@ class AdaptiveLibMesh : public LibMesh {
10641070

10651071
private:
10661072
// Data members
1073+
const std::set<libMesh::subdomain_id_type>
1074+
block_ids_; //!< subdomains of the mesh to tally on
1075+
const bool block_restrict_; //!< whether a subset of the mesh is being used
10671076
const libMesh::dof_id_type num_active_; //!< cached number of active elements
10681077

10691078
std::vector<libMesh::dof_id_type>

include/openmc/random_ray/flat_source_domain.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ class FlatSourceDomain {
138138
vector<double> nu_sigma_f_;
139139
vector<double> sigma_f_;
140140
vector<double> chi_;
141+
vector<double> kappa_fission_;
141142

142143
// 3D arrays stored in 1D representing values for all materials x energy
143144
// groups x energy groups

include/openmc/random_ray/random_ray_simulation.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@ class RandomRaySimulation {
2121
// Methods
2222
void apply_fixed_sources_and_mesh_domains();
2323
void prepare_fixed_sources_adjoint();
24-
void run_single_simulation();
25-
void random_ray_adjoint();
26-
void kinetic_initial_condition();
2724
void kinetic_single_time_step(int i);
25+
void prepare_adjoint_simulation();
2826
void simulate();
2927
void output_simulation_results() const;
3028
void instability_check(
@@ -35,9 +33,15 @@ class RandomRaySimulation {
3533
// Accessors
3634
FlatSourceDomain* domain() const { return domain_.get(); }
3735

36+
//----------------------------------------------------------------------------
37+
// Public data members
38+
39+
// Flag for adjoint simulation;
40+
bool adjoint_needed_;
41+
3842
private:
3943
//----------------------------------------------------------------------------
40-
// Data Members
44+
// Private data members
4145

4246
// Contains all flat source region data
4347
unique_ptr<FlatSourceDomain> domain_;
@@ -58,9 +62,6 @@ class RandomRaySimulation {
5862
// Toggle for first simulation
5963
bool is_first_simulation_;
6064

61-
// Flag for adjoint simulation;
62-
bool adjoint_needed_;
63-
6465
//----------------------------------------------------------------------------
6566
// Data Members for kinetic simulations
6667

@@ -77,6 +78,7 @@ class RandomRaySimulation {
7778
void openmc_run_random_ray();
7879
void validate_random_ray_inputs();
7980
void openmc_reset_random_ray();
81+
void print_adjoint_header();
8082

8183
//! Write data related to randaom ray to statepoint
8284
//! \param[in] group HDF5 group

openmc/data/photon.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,9 @@ def transitions(self, transitions):
203203
for subshell, df in transitions.items():
204204
cv.check_value('subshell', subshell, _SUBSHELLS)
205205
cv.check_type('transitions', df, pd.DataFrame)
206-
self._transitions = transitions
206+
self._transitions = {
207+
subshell: df.convert_dtypes() for subshell, df in transitions.items()
208+
}
207209

208210
@classmethod
209211
def from_ace(cls, ace):

0 commit comments

Comments
 (0)