From 489c5177b303b6e30f448515cf47a2cf50183951 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Wed, 19 Aug 2026 16:25:29 -0700 Subject: [PATCH 1/2] FFT: expose OpenBCSolver's spectral Green's function 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) --- Src/FFT/AMReX_FFT_OpenBCSolver.H | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Src/FFT/AMReX_FFT_OpenBCSolver.H b/Src/FFT/AMReX_FFT_OpenBCSolver.H index 2403cf96860..349333d9ad5 100644 --- a/Src/FFT/AMReX_FFT_OpenBCSolver.H +++ b/Src/FFT/AMReX_FFT_OpenBCSolver.H @@ -67,6 +67,29 @@ public: */ [[nodiscard]] IntVect const& PaddedLength () const { return m_padded_length; } + /** + * \brief Access the spectral Green's function held by this solver. + * + * This lets a caller 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(). Since solve() only reads the spectral Green's function, one + * moved in this way needs no further preparation. + * + * \note 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. + * + * \return The spectral Green's function. + */ + [[nodiscard]] cMF& greensFunctionFFT () noexcept { return m_G_fft; } + + /** + * \brief Access the spectral Green's function held by this solver. + * + * \return The spectral Green's function. + */ + [[nodiscard]] cMF const& greensFunctionFFT () const noexcept { return m_G_fft; } + private: static IntVect make_padded_length (Box const& domain, Info const& info); static Box make_grown_domain (Box const& domain, IntVect const& padded_len, From eee2ca12ea056ec2db937a9c8bc6986a8a96c539 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Fri, 28 Aug 2026 09:27:05 -0700 Subject: [PATCH 2/2] Fix Docs --- Src/FFT/AMReX_FFT_OpenBCSolver.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Src/FFT/AMReX_FFT_OpenBCSolver.H b/Src/FFT/AMReX_FFT_OpenBCSolver.H index 349333d9ad5..f40f7628e73 100644 --- a/Src/FFT/AMReX_FFT_OpenBCSolver.H +++ b/Src/FFT/AMReX_FFT_OpenBCSolver.H @@ -75,7 +75,7 @@ public: * setGreensFunction(). Since solve() only reads the spectral Green's function, one * moved in this way needs no further preparation. * - * \note In two-d mode this is an alias of the Green's function R2C's spectral data. + * \note In 2D, 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. *