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

const std::array<int, 3> m_grid

The number of parts in each dimension.

The global World this decomposition partitions.

Stored by value so the Decomposition is self-contained: a factory function may safely return a Decomposition whose source World only existed in the factory’s local scope. (Earlier this member was const World&, which silently dangled in exactly that pattern — see tests/unit/kernel/decomposition/test_decomposition_lifetime.cpp.)

std::vector<pfc::Box3i> m_local_boxes

Local subdomain boxes.

pfc::Domain m_domain

Global Domain this partitions.

pfc::fft::IHostFFT

struct IHostFFT : public pfc::fft::IFFTQueries

Host-container FFT (std::vector / host Field). Device backends are not this.

Subclassed by pfc::fft::FFT_Impl< heffte::backend::fftw >, pfc::fft::FFT_Impl< BackendTag, Interface >

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).

pfc::fft::CPUFFT

class CPUFFT : public pfc::fft::FFT_Impl<heffte::backend::fftw>