Decomposition and FFT¶
OpenPFC spectral workflows partition a Domain across MPI ranks and transform
local data through an implementation of the FFT contract. Read the
spectral-stack concept before using the exact
API below.
pfc::decomposition::Decomposition¶
-
struct Decomposition
Describes a static, pure partitioning of the global simulation domain into local subdomains.
The Decomposition struct encapsulates how the global World domain is split across compute units, such as MPI processes, OpenMP threads, or GPU tiles. It represents the ownership layout, not how communication is performed.
Each Decomposition instance defines the local subdomain assigned to the current compute entity, including bounding box, size, and global offset. It provides a consistent, backend-independent view of how the World is subdivided.
Public Members
-
pfc::World m_global_world
Backward compatibility: kept for migration.
The global World this decomposition partitions.
Stored by value so the
Decompositionis self-contained: a factory function may safely return aDecompositionwhose sourceWorldonly existed in the factory’s local scope. (Earlier this member wasconst World&, which silently dangled in exactly that pattern — seetests/unit/kernel/decomposition/test_decomposition_lifetime.cpp.)
-
const std::array<int, 3> m_grid
The number of parts in each dimension.
-
std::vector<pfc::Box3i> m_local_boxes
Local subdomain boxes (M1.3).
-
pfc::Domain m_domain
Global domain extracted from World (M1.3).
-
pfc::World m_global_world
pfc::fft::IFFT¶
-
struct IFFT
Subclassed by pfc::fft::FFT_Impl< heffte::backend::fftw >, pfc::fft::FFT_Impl< BackendTag >
Public Functions
-
virtual void forward(const RealVector &in, ComplexVector &out) = 0
Forward real-to-complex transform on this rank’s local boxes.
- Parameters:
in – Real buffer; must satisfy
in.size() == size_inbox()out – Complex buffer; must satisfy
out.size() == size_outbox()
- Throws:
std::invalid_argument – when either buffer size mismatches the inbox/outbox contract (implementations report expected and actual).
-
virtual void backward(const ComplexVector &in, RealVector &out) = 0
Backward complex-to-real transform on this rank’s local boxes.
- Parameters:
in – Complex buffer; must satisfy
in.size() == size_outbox()out – Real buffer; must satisfy
out.size() == size_inbox()
- Throws:
std::invalid_argument – when either buffer size mismatches the outbox/inbox contract (implementations report expected and actual).
-
virtual size_t size_inbox() const = 0
Local real-buffer element count required by
forward/backward.
-
virtual size_t size_outbox() const = 0
Local complex-buffer element count required by
forward/backward.
-
virtual Box3i get_inbox_bounds() const = 0
Local real-space index box (inclusive corners) for this rank.
-
virtual Box3i get_outbox_bounds() const = 0
Local Fourier-space index box for this rank.
-
virtual void forward(const RealVector &in, ComplexVector &out) = 0
pfc::fft::CpuFft¶
-
class CpuFft : public pfc::fft::FFT_Impl<heffte::backend::fftw>