Bundle each IFP data stream with the flag and banks that govern it - #4097
Open
GuySten wants to merge 1 commit into
Open
Bundle each IFP data stream with the flag and banks that govern it#4097GuySten wants to merge 1 commit into
GuySten wants to merge 1 commit into
Conversation
GuySten
marked this pull request as ready for review
September 1, 2026 19:17
GuySten
force-pushed
the
ifp-cleanup-2
branch
from
September 1, 2026 22:30
48bb4b9 to
fd72752
Compare
GuySten
force-pushed
the
ifp-cleanup-2
branch
from
September 1, 2026 22:38
fd72752 to
9d2b2dd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Bundle each IFP data stream with the flag and banks that govern it
Pure refactor. No behaviour change, no results change, no regolds. Follows on
from the enum removal, and is the second of the pieces split out of #3728.
Problem
IFP tracks two quantities with identical bookkeeping: the delayed group number
of the ancestor neutron (
int) and its lifetime (double). Each has a sourcebank, a fission bank, and a flag saying whether it is being maintained -- six
globals and two flags, all of which have to stay consistent with each other.
Because they are separate, every operation is written twice:
Every function in
ifp.cpphas that shape, andeigenvalue.cppcalls the MPIhelpers once per stream behind the same pair of flag checks. Nothing enforces
that a bank is only resized when its flag is set, or that the two banks of one
stream are resized together; that is a convention held up by repetition.
Changes
One type holds a stream's flag and both its banks:
Every operation is a no-op when the stream is off, so callers stop branching.
ifp()becomes:and the three
if (delayed) ...; if (lifetime) ...;pairs ineigenvalue.cppbecome unconditional calls.
deserialize_ifp_infotakes the stream rather than abank, so it can check the flag itself.
settings::ifp_delayed_onandsettings::ifp_lifetime_onare gone; the flagslive on the streams.
ifp_on()moves toifp.halongside them.free_memory_bank()previously cleared four banks by name and left the flagsalone -- the bug the previous PR fixed separately in
free_memory_settings().It is now a single
reset_ifp_streams()that clears both banks and both flags,so the two cannot drift apart again.
Effect
11 files, +219 / -252.
ifp.cppgoes from 117 lines to 53: six of its eight functions become inlinemethods and disappear.
ifp.hgrows by 56, because the class plus itsdocumentation costs more than the free functions it replaces, so the net line
count is only modestly better. The gain is structural rather than in the
diffstat: six globals and two flags become two objects, and a flag can no longer
disagree with the banks it governs.
Testing
No results change, so the existing IFP regression and unit tests cover this
unchanged. The MPI paths are exercised by the regression suite when run with
more than one process.
Notes
This makes the remaining piece of #3728 -- delaying activation of IFP tallies --
considerably smaller. That change becomes a matter of calling
enable()on thetwo streams at the right batch, rather than threading an activation condition
through
bank.cpp,eigenvalue.cpp,tally_scoring.cppandphysics.cpp.Checklist
I have followed the style guidelines for Python source files (if applicable)I have made corresponding changes to the documentation (if applicable)I have added tests that prove my fix is effective or that my feature works (if applicable)