FFT: expose OpenBCSolver's spectral Green's function - #5627
Merged
Conversation
Add greensFunctionFFT() accessors so a caller can keep its own set of Green's functions and move them into and out of the solver, for instance with std::swap, instead of recomputing them with setGreensFunction(). solve() only reads the spectral Green's function, and prepare_openbc() concerns the R2C plans rather than the Green's function values, so one moved in this way needs no further preparation. Note that in two-d mode this is an alias of the Green's function R2C's spectral data: callers may write through it, but must not swap or otherwise re-seat it, because a later setGreensFunction() writes into the aliased array. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ax3l
force-pushed
the
topic-igf-greens-cache
branch
from
August 27, 2026 22:02
dc9414f to
489c517
Compare
ax3l
commented
Aug 28, 2026
WeiqunZhang
approved these changes
Aug 28, 2026
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.
OpenBCSolverrebuilds its spectral Green's function wheneversetGreensFunction()is called, and there is no way to hand it one that was built earlier. AddgreensFunctionFFT()accessors so a caller can keep its own set and move them into and out of the solver withstd::swaprather than recomputing.solve()only reads the spectral Green's function, andprepare_openbc()concerns the R2C plans rather than the Green's function values, so one moved in this way needs no further preparation.The one caveat, documented at the accessor: in 2D,
m_G_fftis an alias of the Green's function R2C's spectral data, which a latersetGreensFunction()writes into. Callers may write through the reference there, but must not swap or otherwise re-seat it.Additive only, so nothing changes for existing users. Exercised downstream in BLAST-WarpX/warpx#7178 & BLAST-ImpactX/impactx#1621, where reusing Green's functions this way reproduces rebuilding them bit for bit, and where it takes an accelerating beam simulation from 100 Green's function builds to 10.