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.resolve_backendFunction
resolve_backend(backend) -> AbstractExecutionBackend

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

source

Grids

FlowFieldSpectra.Grids.spatial_dimsFunction
spatial_dims(grid) -> Int

Number of physical/spatial (transformed) dimensions D. For a scattered grid this is the ambient dimension (number of coordinate axes), which can exceed ndims_spatial.

source
FlowFieldSpectra.Grids.ndims_spatialFunction
ndims_spatial(grid) -> Int

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

source
FlowFieldSpectra.Grids.spatial_sizeFunction
spatial_size(grid) -> NTuple

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

source
FlowFieldSpectra.Grids.npointsFunction
npoints(grid) -> Int

Total number of spatial sample points: prod(spatial_size(grid)) (∏ N_d for a tensor grid, N for a scattered grid).

source

Transform problem & layout

FlowFieldSpectra.Problem.stack_fieldsFunction
stack_fields(fields::Tuple) -> AbstractArray

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

source

Preprocessing helpers

FlowFieldSpectra.Preprocessing.window_correctionFunction
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.

source

Normalization helpers

FlowFieldSpectra.Normalization.sided_factorFunction
sided_factor(s::AbstractSidedness, k, kmax) -> Real

Folding multiplier. TwoSided1 everywhere. OneSided2 for interior wavenumbers, 1 at DC (k≈0) and Nyquist (k≈kmax) which have no negative-frequency partner.

source

Spherical-harmonic kernels

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

source