Adding set_strides() to openmc_simulation_init() #2183
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #2181. For applications that change their mesh between OpenMC runs (e.g. AMR in Cardinal), it will be important to update the bins for the estimators, as their structure will have changed. When the bins change,
set_strides()
needs to be called again to make sure the xtensor multidimensional results array is sized properly to collect tallies during the next Monte Carlo simulation.Originally, the thought was to move
set_strides()
away fromset_filters()
, but this caused errors in local tests. It will potentially add duplicate, unnecessary computations ifset_strides()
is called twice, but the filters and mesh are the same. This occurs before the histories start though and is not expected to cause a significant slowdown.It is possible, in theory, to refactor such that
set_strides()
is only called when the mesh/filters change, but the effort to get this right may not be worth the hassle. Especially when the simpler alternative isn't expected to concerningly degrade performance.