From ca3ba803dcbc82de6d8566be21485ba3576acb79 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Tue, 14 May 2024 11:37:30 -0500 Subject: [PATCH] Fix rejection threshold check in sample_with_constraints --- src/source.cpp | 4 ++++ tests/unit_tests/test_source.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/source.cpp b/src/source.cpp index 453d4befa9b..405de998c89 100644 --- a/src/source.cpp +++ b/src/source.cpp @@ -190,6 +190,10 @@ SourceSite Source::sample_with_constraints(uint64_t* seed) const } } } + + // Increment number of accepted samples + ++n_accept; + return site; } diff --git a/tests/unit_tests/test_source.py b/tests/unit_tests/test_source.py index 90c9683f67d..2661910b448 100644 --- a/tests/unit_tests/test_source.py +++ b/tests/unit_tests/test_source.py @@ -127,7 +127,7 @@ def test_constraints_independent(sphere_box_model, run_in_tmpdir): model, cell1, cell2, cell3 = sphere_box_model # Set up a box source with rejection on the spherical cell - space = openmc.stats.Box(*cell3.bounding_box) + space = openmc.stats.Box((-4., -1., -1.), (4., 1., 1.)) model.settings.source = openmc.IndependentSource( space=space, constraints={'domains': [cell1, cell2]} )