Commit f2cbba4
FFT: expose OpenBCSolver's spectral Green's function (AMReX-Codes#5627)
`OpenBCSolver` rebuilds its spectral Green's function whenever
`setGreensFunction()` is called, and there is no way to hand it one that
was built earlier. Add `greensFunctionFFT()` accessors so a caller can
keep its own set and move them into and out of the solver with
`std::swap` rather than recomputing. `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.
The one caveat, documented at the accessor: in 2D, `m_G_fft` is an alias
of the Green's function R2C's spectral data, which a later
`setGreensFunction()` 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.
- [x] 🤖 Generated with [Claude Code](https://claude.com/claude-code)
- [x] tested with ABLASTR/WarpX and ImpactX
- [x] manually self-reviewed
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 5b16e49 commit f2cbba4
1 file changed
Lines changed: 23 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
70 | 93 | | |
71 | 94 | | |
72 | 95 | | |
| |||
0 commit comments