Spectral plans
The method = Spectral() plans of the core: the FFT path's padding and reach, the nonuniform FFT, and the node-set plan every other grid takes.
CoarseGrainingEnergyFluxes.Filtering._bounded_length — Method
_bounded_length(N, extent, Δ, reach) -> IntThe transform length of a bounded axis of N cells Δ apart over extent: the least even 2·3·5-smooth length of at least 2N at which every image of a cell lies at least reach beyond the cells.
CoarseGrainingEnergyFluxes.Filtering._fft_ik — Method
_fft_ik(layout) -> (ikx, iky)i k_x along the first axis of the half spectrum and i k_y along the second, host arrays shaped to broadcast against it, zero at ±P/2 of an even axis, entry P ÷ 2 + 1 of both the half and the full axis: a real field's two halves of that mode carry opposite i k, so its derivative there vanishes.
CoarseGrainingEnergyFluxes.Filtering._fft_layout — Method
_fft_layout(grid, reach) -> (; dims, P, topology, Δ, kx, ky, reach)The transform grid of a two-direction uniform Cartesian grid: dims the grid's shape and P the transform's, a periodic axis at its own length and a bounded one zero-padded to _bounded_length for reach; the grid's topology, whose Bounded directions are the padded ones; the spacing per direction; the angular wavenumbers of the real-to-complex half spectrum, kx over k₁ ≥ 0 and ky in FFT order; and the distance the padding puts every image of a cell beyond the grid's cells, Inf with no bounded direction.
CoarseGrainingEnergyFluxes.Filtering._fft_transfer — Method
_fft_transfer(kernel, topology, layout, scale) -> MatrixThe transfer function on layout's half spectrum, on the host: Ĝ at each wavenumber, and for Kernels.SharpSpectralKernel with a bounded direction _lattice_brick_wall.
CoarseGrainingEnergyFluxes.Filtering._lattice_brick_wall — Function
_lattice_brick_wall(topology, layout, scale) -> MatrixThe sharp kernel's transfer on layout's half spectrum with a bounded direction: the transform over the padded box of the brick wall's lattice kernel at the grid's offsets within its extent. The field is zero past a bounded edge, so the filter is the brick wall |k| ≤ π/ℓ of the infinite lattice exactly, for ℓ at least the spacing of each bounded direction. Methods in the AbstractFFTs extension.
Both directions bounded, the lattice kernel is h(o) = Δx Δy k_c²/(4π) · 2J₁(k_c r)/(k_c r), r the offset's length; with one periodic, each of its wavenumbers k leaves the bounded direction the one-dimensional brick wall |k′| ≤ a = √(k_c² − k²), h(o) = Δ sin(a o Δ)/(π o Δ).
CoarseGrainingEnergyFluxes.Filtering.distributed_fft_grid_plan — Function
distributed_fft_grid_plan(grid, reach; execution::DistributedBackend, batch) -> AbstractGridPlan
distributed_fft_filter_plan(grid_plan, kernel, scale, mask_strategy) -> AbstractFilterPlanAn FFT spectral plan whose two-direction transform is divided among the worker processes: each worker transforms a block of columns along the first direction and a block of rows along the second, over the transform grid _fft_layout pads for reach. Methods in the extension AbstractFFTs, Distributed and SharedArrays load together; the transforms run on the FFT provider of the workers' arrays.
CoarseGrainingEnergyFluxes.Filtering.NUFFTFilterPlan — Type
NUFFTFilterPlanScattered-Cartesian spectral filter plan: the shared NUFFTGridPlan, the transfer function on its modes, the Deformable inverse local mass and its derivative along each direction (or nothing for both), and the NUFFTScratch the apply writes through.
CoarseGrainingEnergyFluxes.Filtering.NUFFTGridPlan — Type
NUFFTGridPlanThe half of a nonuniform-FFT filter plan the filter scale does not reach: the transform over the node set (and one over a trailing batch of nb fields when planned for it), the box periods, the mode count per direction, the quadrature weights, the mask, the grid's topology, the distance every image of a point lies beyond the other points (Inf with no bounded direction), the execution backend whose memory holds them, the points this process transforms (nothing for all), i k_d along each direction of the mode array, and the integer frequency at each index of each mode axis. A transform holds the working state of its own execution, so a concurrent driver needs its own grid plan per worker.
CoarseGrainingEnergyFluxes.Filtering.NUFFTScratch — Type
NUFFTScratchThe transient half of a nonuniform-FFT filter plan: the values and modes one execution writes, and the same pair with a trailing batch axis for a batched plan. One per concurrent worker.
CoarseGrainingEnergyFluxes.Filtering.NUFFTSumFootprint — Type
NUFFTSumFootprintThe real-space filter over a Cartesian grid's cells as points, Σⱼ G(|x − xⱼ|) Aⱼ fⱼ / Σⱼ G(|x − xⱼ|) Aⱼ over the cells the strategy counts, its sums taken by nonuniform FFT. On a box whose bounded directions are padded by the kernel's radius, so that every image of a point lies past the radius from every other,
Σⱼ G(x − xⱼ) Aⱼ cⱼ = Σ_k Ĝ(k) e^{ik⋅x} Σⱼ (Aⱼ / ∏L) cⱼ e^{−ik⋅xⱼ}(Potts & Steidl 2003), with |k| up to Kernels.transfer_cutoff. It is the node CSR engine's sum with the kernel continued past its truncation radius, where it is below Kernels.truncation_tol of its peak, and the transforms run at that tolerance.
invden is the reciprocal of the denominator, zero where it vanishes or, under Deformable, at an inactive node, and dden the denominator's derivative along each direction, which the quotient rule of the filtered field's derivative reads. bound is whether the two strategies' denominators differ, which they do on a masked grid.
References
- Potts & Steidl (2003), SIAM J. Sci. Comput. 24(6), "Fast summation at nonequispaced knots by NFFTs".
CoarseGrainingEnergyFluxes.Filtering._KernelBox — Type
_KernelBox(radius, cutoff)The box of a kernel sum (NUFFTSumFootprint): a bounded direction padded by the kernel's radius, so every image of a point lies at least radius from the others, and every mode with |k| ≤ cutoff.
CoarseGrainingEnergyFluxes.Filtering._nufft_library — Method
_nufft_library(spectral_backend) -> tag or nothingThe FlowTransformBindings tag that runs a nonuniform-FFT filter: the one named, or for AutoSpectralBackend NonuniformFFTs when it is loaded and FINUFFT when only it is; nothing when neither is loaded.
CoarseGrainingEnergyFluxes.Filtering.distributed_nufft_grid_plan — Function
distributed_nufft_grid_plan(nufft, grid, reach; execution::DistributedBackend, batch) -> AbstractGridPlan
distributed_nufft_filter_plan(grid_plan, kernel, scale, mask_strategy) -> AbstractFilterPlanA nonuniform-FFT spectral plan whose points are divided among the worker processes, each holding the library plan over its block of the box padded for reach. Methods in the Distributed extension.
CoarseGrainingEnergyFluxes.Filtering.mass_analysis — Method
mass_analysis(plan) -> M̂The analysis of the density whose kernel sum is the window mass of the kernel-sum plan: every node's weight under ZeroFill, the active nodes' under Deformable.
CoarseGrainingEnergyFluxes.Filtering.nufft_sum_footprint — Method
nufft_sum_footprint(grid, kernel, scale; mask_strategy = ZeroFill(), execution = SerialBackend())
-> NUFFTSumFootprintThe NUFFTSumFootprint of a kernel with a Kernels.transfer_cutoff over the cells of a Cartesian grid with no lattice of its own, a node set or a curvilinear mesh, read and written in the grid's linear cell order. The transforms run on the NUFFT library AutoSpectralBackend takes, on _library_threads(execution) threads.
CoarseGrainingEnergyFluxes.Filtering.rescale! — Method
rescale!(plan::NUFFTFilterPlan, kernel, scale) -> planplan refilled with the transfer function of kernel at scale, its transforms and scratch kept. A plan that divides by the filtered mask's mass (Deformable on a masked or bounded node set) holds a mass of its own scale and raises, as does a kernel reaching past the grid plan's padding.
CoarseGrainingEnergyFluxes.Filtering.spectral_filter_plan — Method
spectral_filter_plan(spectral_backend, grid::UnstructuredGrid{Cartesian}, kernel, scale;
mask_strategy = ZeroFill(), execution = AutoBackend(), batch = nothing,
modes = nothing, tol = nothing, grid_plan = nothing, scratch = nothing)
-> AbstractFilterPlanThe nonuniform-FFT filter plan over a Cartesian node set, built on grid_plan and scratch when given, otherwise on a box whose bounded directions are padded for kernel at scale. batch = nb adds a transform with ntrans = nb, which filter_apply_batched! runs over an (npts, nb) array in one execution per direction. modes, one count per direction of a periodic node set, sets the modes the box holds; nothing takes a mode per node. tol is the transforms' relative accuracy, nothing for FlowTransformBindings.default_tolerance of the grid's precision. The library runs on _library_threads(execution) threads; rescale! refills the plan for another scale. SharpSpectralKernel raises on a node set with a bounded direction.
CoarseGrainingEnergyFluxes.Filtering.NodeSetGradient — Type
NodeSetGradientThe inner plan's series_gradient and the node-set pair a gradient lands in before its cells are copied out, with the same pair over the batch for a batched plan.
CoarseGrainingEnergyFluxes.Filtering.NodeSetGridPlan — Type
NodeSetGridPlanThe scale-independent half of a node-set spectral plan: the node set built from the grid's cells, its completion to the whole sphere where the grid is regional, the nonuniform transform's own grid plan over it, and the execution backend whose memory the transform runs in. The grid's cells come first, in linear order. batch is the trailing batch extent the transform was planned for, or nothing.
CoarseGrainingEnergyFluxes.Filtering.NodeSetPlan — Type
NodeSetPlanA spectral filter plan over a grid's cells: the nonuniform transform's plan over the node set, with the NodeSetGridPlan and NodeSetScratch it was built from.
CoarseGrainingEnergyFluxes.Filtering.NodeSetScratch — Type
NodeSetScratchThe node-set plan's transient buffers: a field and an output over the node set, the same pair with a trailing batch axis for a batched plan, and the nonuniform transform's own scratch. One per concurrent worker.
CoarseGrainingEnergyFluxes.Filtering._node_set — Method
_node_set(grid) -> UnstructuredGridgrid's cells as a node set — centres, measures and mask, in linear order — followed on a regional sphere by the rest of its lattice, inactive.
CoarseGrainingEnergyFluxes.Filtering._node_set_filter_plan — Method
_node_set_filter_plan(spectral_backend, grid, kernel, scale; execution = AutoBackend(),
grid_plan = nothing, scratch = nothing, batch = nothing, kwargs...) -> NodeSetPlanThe spectral plan for grid over its node set. Raises where the backend does not take a node set or no loaded extension transforms it.
CoarseGrainingEnergyFluxes.Filtering._node_set_grid_plan — Method
_node_set_grid_plan(spectral_backend, grid, kernel; execution = AutoBackend(), batch = nothing,
kwargs...) -> NodeSetGridPlan or nothingThe node set of grid and the nonuniform transform's grid plan over it, planned for a trailing batch of batch fields, or nothing where the backend does not take the node set or no loaded extension transforms it.