Internals
These functions and types are not part of the public API (they are not exported), but are documented here for contributors. They may change without notice.
Execution-backend helpers
Introspection helpers for the execution axis (used internally and by the distribution extensions; reachable as FlowFieldSpectra.Types.<name>).
FlowFieldSpectra.Types.local_backend — Function
local_backend(backend) -> AbstractExecutionBackendThe per-process compute backend: the wrapped inner for a distribution wrapper, else the backend itself.
FlowFieldSpectra.Types.is_distributed — Function
is_distributed(backend) — true if backend splits work across processes/ranks.
FlowFieldSpectra.Types.resolve_backend — Function
resolve_backend(backend) -> AbstractExecutionBackendResolve AutoBackend to a concrete local backend instance; all other backends are returned as-is. The AutoBackend method is defined in the parent FlowFieldSpectra module so it can detect a loaded threading extension via Base.get_extension.
Grids
FlowFieldSpectra.Grids.physical_wavenumbers — Function
physical_wavenumbers(grid::AbstractCartesianGrid, ms) -> NTuple{D,<:AbstractRange}Physical wavenumber ranges for a Cartesian grid at spectral resolution ms.
FlowFieldSpectra.Grids.spatial_dims — Function
spatial_dims(grid) -> IntNumber of physical/spatial (transformed) dimensions D. For a scattered grid this is the ambient dimension (number of coordinate axes), which can exceed ndims_spatial.
FlowFieldSpectra.Grids.ndims_spatial — Function
ndims_spatial(grid) -> IntNumber of leading array dimensions a field on this grid consumes: D for a tensor-product Cartesian grid or a structured spherical grid, and 1 for any scattered/point-cloud grid (the single point axis). Every array dimension after these is a batch dimension.
FlowFieldSpectra.Grids.spatial_size — Function
spatial_size(grid) -> NTupleSizes of the leading spatial array dimensions: (N_1, …, N_D) for a tensor-product Cartesian grid, (Nθ, Nφ) for a structured spherical grid, and (N,) for a scattered grid.
FlowFieldSpectra.Grids.npoints — Function
npoints(grid) -> IntTotal number of spatial sample points: prod(spatial_size(grid)) (∏ N_d for a tensor grid, N for a scattered grid).
Transform problem & layout
FlowFieldSpectra.Problem.spatial_shape — Function
spatial_shape(prob) — the leading spatial array sizes (N_1, …).
FlowFieldSpectra.Problem.batch_shape — Function
batch_shape(prob) — the trailing batch sizes (() if none).
FlowFieldSpectra.Problem.n_batch — Function
n_batch(prob) — number of trailing batch dims.
FlowFieldSpectra.Problem.batch_length — Function
batch_length(prob) — total batch slices, prod(batch) (1 if no batch axes).
FlowFieldSpectra.Problem.coeff_output_size — Function
coeff_output_size(spectral::Tuple, prob) -> NTupleShape of the coefficient array: (spectral…, batch…).
FlowFieldSpectra.Problem.coeff_eltype — Function
coeff_eltype(grid) -> TypeComplex coefficient element type for a grid (Complex{FT}).
FlowFieldSpectra.Problem.stack_fields — Function
stack_fields(fields::Tuple) -> AbstractArrayConvenience for the multi-field call form: stack equal-shaped field arrays along a new trailing batch axis ((spatial…, batch…, NU)). This materializes a combined array — pass a single (spatial…, batch…) array to avoid the copy.
Preprocessing helpers
FlowFieldSpectra.Preprocessing.window_function — Function
window_function(win::AbstractWindow, n::Integer, ::Type{T}=Float64) -> Vector{T}Allocate and return the length-n taper win.
FlowFieldSpectra.Preprocessing.window_function! — Function
window_function!(w::AbstractVector, win::AbstractWindow) -> wFill w (length n) in place with the taper win.
FlowFieldSpectra.Preprocessing.window_correction — Function
window_correction(w::AbstractVector) -> (S1, S2)Coherent-gain factor S1 = (Σ w)/n and power factor S2 = (Σ w²)/n. Amplitude spectra divide by S1; power/energy spectra divide by S2 to preserve variance.
FlowFieldSpectra.Preprocessing.detrend! — Function
detrend!(x::AbstractVector, d::AbstractDetrend) -> xDetrend x in place according to d.
Normalization helpers
FlowFieldSpectra.Normalization.sided_factor — Function
sided_factor(s::AbstractSidedness, k, kmax) -> RealFolding multiplier. TwoSided → 1 everywhere. OneSided → 2 for interior wavenumbers, 1 at DC (k≈0) and Nyquist (k≈kmax) which have no negative-frequency partner.
Spherical-harmonic kernels
FlowFieldSpectra.SphericalKernels.LegendreTables — Type
LegendreTables{FT}Precomputed, point-independent recurrence coefficients for the normalized associated Legendre functions $\bar P_\ell^m$ up to degree lmax. Built once per transform via legendre_tables; the per-point table is then filled in O(lmax²) with no sqrt calls by fill_legendre!.
FlowFieldSpectra.SphericalKernels.legendre_tables — Function
legendre_tables(::Type{FT}, lmax::Int) -> LegendreTables{FT}Precompute the recurrence coefficients up to degree lmax.
FlowFieldSpectra.SphericalKernels.fill_legendre! — Function
fill_legendre!(Plm::AbstractMatrix, t::LegendreTables, x, s, lmax)Fill Plm[l+1, m+1] = \bar P_\ell^m(x) for m = 0:lmax, l = m:lmax at a single point with x = cosθ, s = sinθ, reusing the precomputed coefficients in t. Entries with l < m are left untouched (the projection never reads them).
FlowFieldSpectra.SphericalKernels.normalized_legendre — Function
normalized_legendre(l, m, x, s) -> FTSingle normalized associated Legendre value $\bar P_\ell^m(x)$ (m ≥ 0) computed by on-the-fly recurrence. Reference implementation used for validation; the hot path uses fill_legendre!.