Updates to object lifecycle for WeightWindows and WeightWindowGenerators #2582
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.
Description
This PR includes some updates to the C++
WeightWindows
andWeightWindowsGenerator
objects to resolve an issue clashing ID spaces between automatically created tallies for weight window generation and user-specified tallies. The weight window generation tallies are now created after reading in all user-specified filters and tallies so that the generator tally uses new ID space. This involved a simple refactor of theWeightWindowsGenerator
constructor and a call to setup these tallies once all other simulation initialization is complete.I've added an additional tally in the weight window generation regression test to ensure this problem is checked in CI.
There are a couple of other housekeeping items I took care of as well:
WeightWindow::set_mesh/set_energy_bounds
methods are called.WeightWindows::mesh_idx_
data member is initialized to-1
to ensure an error occurs if the weight windows are used without the mesh being set. Before, this value could initialize to0
and use the first mesh in the model without complaint.WeightWindows.energy_bounds
attribute was not initialized correctly in the case that. I've added a check for this as well.Checklist