Skip to content

Commit

Permalink
Fix rejection threshold check in sample_with_constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
paulromano committed May 14, 2024
1 parent 42898cc commit ca3ba80
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ SourceSite Source::sample_with_constraints(uint64_t* seed) const
}
}
}

// Increment number of accepted samples
++n_accept;

return site;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/test_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]}
)
Expand Down

0 comments on commit ca3ba80

Please sign in to comment.