Filtering

The filter API, plans, mask strategies, engine selection, the process shares and the workers' plan copies. The real-space engines are on Filtering engines, and the vector filter of the sphere on Filtering on the sphere.

CoarseGrainingEnergyFluxes.Filtering.filter_field! — Method
filter_field!(out, field, grid, kernel, scale; mask_strategy = ZeroFill(), filter_plan = nothing,
              execution = AutoBackend(), method = RealSpace(), transform = AutoSpectralBackend(), kwargs...)

Filter a field on a grid using kernel at characteristic full width scale (ℓ), writing the result to out (returned): filter_apply! of the plan_filter the keywords build.

Keyword Arguments

  • mask_strategy::AbstractMaskStrategy=ZeroFill(): how masked cells and a bounded edge enter the filter. ZeroFill filters the field extended by zero over masked cells and past each bounded edge, normalized by the kernel's full mass over the lattice continued at its edge spacing, so filtering commutes with spatial derivatives, conserves the integral over all space, and defines the output at masked cells too; a uniform field falls toward a coast. Deformable normalizes over the active in-domain cells of each window and zeroes masked cells, so a constant is reproduced next to a boundary and the kernel changes shape there.
  • filter_plan::Union{Nothing,AbstractFilterPlan}=nothing: a prebuilt plan_filter result, reused across calls on the same grid, kernel and scale. When supplied, every other keyword is ignored.
  • execution::AbstractExecutionBackend=AutoBackend(): execution backend (SerialBackend, ThreadedBackend, GPUBackend, …).
  • method, transform and every other keyword: as for plan_filter, which raises on a keyword the method does not take.

For spherical grids the longitude footprint wraps only when the grid is periodic (isperiodic); distances use the great-circle (Haversine) metric.

Examples

geom = CartesianGeometry()
grid = StructuredGrid(geom, 0.0:1000.0:99_000.0, 0.0:1000.0:99_000.0, mask)
out = zeros(100, 100)
filter_field!(out, field, grid, TopHatKernel(), 5000.0; mask_strategy = Deformable())
source
CoarseGrainingEnergyFluxes.Filtering.apply_footprint_row_batch! — Method
apply_footprint_row_batch!(outs, fields, grid, fp, strategy, periodic_x, periodic_y, j) -> outs

Row j of the batched banded apply: each field's numerator by one contiguous axpy per tap, scaled by the plan's precomputed inverse window mass invden, which depends on the geometry, the mask and the strategy alone.

source
CoarseGrainingEnergyFluxes.Filtering.AbstractCacheStrategy — Type
AbstractCacheStrategy

Whether a real-space footprint over a nonuniform axis (StructuredGrid with a Vector axis, CurvilinearGrid, or ND with a non-Range axis) stores its per-point neighbour list for reuse across filter_apply! calls, or recomputes it at every apply. Both give the same neighbours and weights.

source
CoarseGrainingEnergyFluxes.Filtering.AlwaysCache — Type
AlwaysCache <: AbstractCacheStrategy

Store the per-point neighbour list, the default: built in one pass of the ball query, it makes every apply a pass over the list. It holds each target's neighbours, an index and a weight per neighbour.

source
CoarseGrainingEnergyFluxes.Filtering.NeverCache — Type
NeverCache <: AbstractCacheStrategy

Recompute neighbours at every filter_apply!/filter_apply_batch! call and store no list: each apply runs the ball query the list is built from, in no memory beyond the plan's.

source
CoarseGrainingEnergyFluxes.Filtering._allocate — Method
_allocate(backend, T, dims) -> array
_on_backend(backend, x) -> array
_host_memory(backend) -> Bool

Zeroed storage of element type T, and a copy of the host array x, in the memory backend runs in, and whether that memory is the host's. It is host memory for every backend but a GPUBackend on a device other than KernelAbstractions' CPU, whose memory the KernelAbstractions extension allocates. An MPI rank runs in its inner backend's memory; a DistributedBackend plan's caller holds host memory, and its workers their inner backend's.

source
CoarseGrainingEnergyFluxes.Filtering._library_threads — Method
_library_threads(backend) -> Int

The thread count a transform library runs at in a plan built for backend: 1 under SerialBackend, the backend a threaded slice or batch loop builds its plans with; Threads.nthreads() under ThreadedBackend, AutoBackend and GPUBackend. A distributed backend runs each process's share at the count of its inner backend.

source
CoarseGrainingEnergyFluxes.Filtering._owned — Method
_owned(backend, n) -> Vector{Int} or nothing
_sum_across!(backend, A) -> A

The points of n this process transforms, nothing for all of them, and the sum of A over the processes that share the transform, in place. Under MPIBackend (MPI extension) each rank owns the points rank + 1, rank + 1 + nproc, … of a field every rank holds, and the sum is an Allreduce.

source
CoarseGrainingEnergyFluxes.Filtering._resident_apply! — Function
_resident_apply!(out, field, grid, fp, strategy) -> out

The apply of a footprint whose arrays live in its plan's execution memory, by broadcasts and library transforms: the padded and zonal FFTs. A GPU backend's extension calls it for a footprint it has no kernel for; out and field are in the same memory as fp.

source
CoarseGrainingEnergyFluxes.Filtering.spectral_grid_plan — Method
spectral_grid_plan(spectral_backend, grid, kernel; mask_strategy, execution, batch, max_scale = 0)
    -> AbstractGridPlan or nothing

The half of a spectral plan a sweep shares: the transform objects themselves, the wavenumber grids, and the mask. The transfer function Ĝ(|k|, ℓ) and the Deformable renormalization depend on the filter scale, so a sweep builds this once and each scale keeps only those two. A bounded Cartesian direction is zero-padded so that kernel at every scale up to max_scale stays clear of the domain's periodic copies; a filter plan at a larger scale raises. max_scale = 0 pads to twice the direction's length. The transforms run on _library_threads(execution) threads.

Returns nothing for a backend with no grid plan; a sweep then builds a full plan per scale.

source
CoarseGrainingEnergyFluxes.Filtering.spectral_scratch — Method
spectral_scratch(grid_plan) -> AbstractFilterScratch or nothing

The transient half of a spectral plan — the complex spectrum buffer, the mask · field staging array, and whatever else the apply overwrites — sized from grid_plan (see spectral_grid_plan). A sweep hands one to every scale; a driver that applies concurrently builds one per worker.

Returns nothing for a backend that keeps no apply-time buffers.

source
CoarseGrainingEnergyFluxes.Filtering.PhysicalFilterPlan — Type
PhysicalFilterPlan

A physical-space filter plan: the precomputed footprint, with the grid, mask strategy, kernel, scale and resolved execution backend it was built for. kernel and scale are passed to the backend hooks, which take them positionally; the footprint is never rebuilt from them.

source
CoarseGrainingEnergyFluxes.Filtering.analysis_status — Function
analysis_status(plan) -> FlowTransformBindings.SolverResult
analysis_status(workspace) -> FlowTransformBindings.SolverResult

The outcome of the least-squares fit of plan's last apply: NUFSHT's over a spherical node set under LeastSquares, combined with its mask's fit; a fit that stops short still writes its coefficients, and is reported here. A diagnostic workspace reports the worst of the fits its generalized convolution has run. A plan or workspace whose analysis is a quadrature or an exact transform fits nothing and has no method.

source
CoarseGrainingEnergyFluxes.Filtering.filter_synthesize_derivative! — Function
filter_synthesize_derivative!(out, F̂, ū, plan, d) -> out

∂ū/∂x_d at the plan's points, ū the filtered field and F̂ its field's analysis: the synthesis of i k_d Ĝ F̂ for a Series plan, and for a SeriesRatio one the quotient rule, (∂_d N − ū ∂_d M)/M, with ∂_d M synthesized once at plan build. A method per plan type whose series_form is not NoSeries and whose series_gradient is nothing; a sphere's plans differentiate through filter_synthesize_gradient!.

source
CoarseGrainingEnergyFluxes.Filtering.plan_filter — Method
plan_filter(grid, kernel, scale; mask_strategy = ZeroFill(), execution = AutoBackend(),
            method = RealSpace(), transform = AutoSpectralBackend(), cache_strategy = AlwaysCache(),
            grid_plan = nothing, scratch = nothing, engine = AutoEngine(), fft_options = (;)) -> AbstractFilterPlan

A reusable filter plan for execution, applied by filter_apply!(out, field, plan): the real-space footprint, or under method = Spectral() the transform plan. engine names the real-space engine (AbstractEngine); AutoEngine() takes the one with the fewest operations (_select_engine). A spectral plan also takes batch = nb for a trailing batch axis and, over a spherical node set, nufft, the NUFFT library NUFSHT runs, and analysis (AbstractAnalysis); a keyword the method does not take raises an ArgumentError. grid_plan and scratch are the parts a sweep shares; see plan_filter_sweep. fft_options are the planner keywords of the FFTs the plan makes (the spectral FFT filter, the padded and zonal FFT engines), passed to the FFT library's plan_* as they stand, e.g. (; flags = FFTW.MEASURE) under FFTW.

A transform runs on 1 thread under SerialBackend() and on Threads.nthreads() under ThreadedBackend(), AutoBackend() and GPUBackend(), in the device's memory under the last. Under MPIBackend(inner) every rank holds the field and the output. A nonuniform transform (NUFFT, NUFSHT) gives each rank a disjoint share of the points: the analysis F_k = Σⱼ wⱼ cⱼ exp(−i k⋅xⱼ) is a sum over points, so the ranks' partial sums add to it exactly, and each rank evaluates the filtered series at its own points. An FFT or FastSphericalHarmonics transform runs whole on every rank. Under DistributedBackend(inner) the worker processes share the transform, a nonuniform one by blocks of points and an FFT by blocks of columns and then of rows, each at inner's thread count; a FastSphericalHarmonics transform runs in the calling process.

source
CoarseGrainingEnergyFluxes.Filtering.prepare_workspace — Method
prepare_workspace(backend, grid, footprint) -> workspace

Backend hook plan_filter calls once; its result is stored as the plan's footprint. The default returns footprint unchanged; a backend with its own memory, such as a GPU's device buffers, returns the resident form its apply step reads.

source
CoarseGrainingEnergyFluxes.Filtering.rate_plan — Function
rate_plan(plan, kernel, scale) -> plan

plan with its transfer replaced by ∂_ℓĜ (Kernels.TransferRate(kernel)) at scale, everything else shared: its synthesis of an analysis plan writes is ∂_ℓN/M, with M the window mass a renormalized plan divides by (1 otherwise), so ∂_ℓū = synth(F̂) − ū · synth(M̂), M̂ the analysis of a field of ones. A method per spectral plan type; rate_available answers where the kernel has the derivative.

source
CoarseGrainingEnergyFluxes.Filtering.WindowSecond — Type
WindowSecond

The second derivative of a WindowRate: the plans of the second-order weights and ρ_p = c_p M_p/M, c_p the term's multiplicity, with B = Σ_p ρ_p = D²M/M, so D²ū = A − ū·B − 2(Dū)·B₁ with A = Σ_p ρ_p ū_p, D = ℓ∂_ℓ and B₁ the first derivative's.

source
CoarseGrainingEnergyFluxes.Filtering.rate_plans — Method
rate_plans(plan::PhysicalFilterPlan) -> Tuple

The plans whose filters give plan's derivative in its width, ℓ∂_ℓū = Σ_p (M_p/M)(ū_p − ū) with M each plan's window_mass!: one of Kernels.ScaleRate(kernel) for radial weights, and for a separable kernel's tables one of Kernels.AxisRate(kernel, Val(d)) per axis. Each is built on plan's grid, strategy, backend and engine, over the cells plan sums, caching its neighbours where plan does and sharing its pass buffers.

source
CoarseGrainingEnergyFluxes.Filtering.window_mass! — Method
window_mass!(m, plan::PhysicalFilterPlan) -> m

Each target's window mass, the sum of weights plan divides by, into m in the plan's memory, shaped like the grid's mask; zero at a target the strategy leaves unfiltered. Read from the footprint where it holds it, and summed by the engine's own loops where it forms it per target.

source
CoarseGrainingEnergyFluxes.Filtering.FilterPlanFamily — Type
FilterPlanFamily(grid_plan, plans, scratch[, rates, rate_order])

The plans for a sweep of scales over one grid, with the scale-independent AbstractGridPlan and the per-apply AbstractFilterScratch they share; either is nothing for an engine with nothing to share. rates holds each plan's scale_rate when the family was built with ScaleRates or ScaleCurvatures, the tag rate_order holds, and is nothing otherwise. A family is an AbstractVector of its plans.

The plans of one family share one scratch, so they must not be applied concurrently; give each concurrent worker a worker_copy of the family, which shares its tables.

source
CoarseGrainingEnergyFluxes.Filtering._is_flat_cell — Method
_is_flat_cell(grid) -> Bool

Whether grid names a cell by a single integer, FlowGeometries.Grids.FlatCells(): a node set, or a spherical pixelization whose cells carry one id. The node CSR engine reads such a grid only through fold_within(grid, t), measure(grid, j) and isactive(grid, t). A CartesianCells() grid names a cell by an index tuple and takes the rectilinear or curvilinear engines.

source
CoarseGrainingEnergyFluxes.Filtering._nufft_sum_ops — Method
_nufft_sum_ops(grid, kernel, scale, cutoff) -> (transform, entries, build)

The operations of one apply over Cartesian points by the nonuniform-FFT sum, and the neighbour list's entries (one operation each per apply) and the operations of its build. The sum is two transforms of M·w^D spreading and 2.5 N log₂ N over the twice-oversampled box of n_d = 2⌊K L_d/2π⌋ + 1 modes, w the spreading width ⌈−log₁₀ tol⌉ + 1 and L_d the box of _KernelBox; building its plan is one such apply, the window masses. The list holds each point's neighbours at the mean density, V_D r^D · M/ΣA, and is built from the point bins (_binned_csr) in two passes over the points of the bins within reach, D + 1 operations each (a squared distance and its test), and a weight and a store per entry.

source
CoarseGrainingEnergyFluxes.Filtering._padded_halfwidths — Method
_padded_halfwidths(grid, kernel, scale) -> NTuple{N,Int}

The half-widths in cells of the direct footprint the padded transform samples on a uniform Cartesian grid: the ball of kernel_radius for a radial kernel, the separable engine's stencil for a separable one. A bounded axis reaches no farther than its extent.

source
CoarseGrainingEnergyFluxes.Filtering._real_space_ops — Method
_real_space_ops(grid, kernel, scale) -> Float64

The operations of one apply on a uniform Cartesian grid by the real-space engine for kernel: the direct sum over the ball of radius kernel_radius, the prefix-sum top-hat (in two and three directions), or the separable passes.

source
CoarseGrainingEnergyFluxes.Filtering._select_engine — Method
_select_engine(grid, kernel, scale, resolved) -> AbstractEngine

The engine AutoEngine takes on the resolved backend. On a backend whose applies run in this process' loops: the binned top-hat and the nonuniform-FFT sum over Cartesian points; there and on a GPU backend, the padded and zonal transforms over rectilinear grids where an FFT library serves the backend's memory; each where it applies and costs fewer operations than the footprint, the footprint otherwise. check_setup reports from the same choice.

source
CoarseGrainingEnergyFluxes.Filtering._zonal_fft_ops — Method
_zonal_fft_ops(grid, kernel, scale) -> (transform, realspace)

The operations of one apply on a sphere of uniform longitude by the transform along longitude and by the banded sum. Per pair of latitude rows the taps are the longitude offsets within great-circle distance rad, sin²(Δλ/2) ≤ (sin²(rad/2R) − sin²(Δφ/2)) / (cos φ cos φ′).

source
CoarseGrainingEnergyFluxes.Filtering.analyze_buffer — Function
analyze_buffer(plan, field) -> F̂ or nothing
filter_analyze!(F̂, field, plan) -> F̂
filter_synthesize!(out, F̂, plan) -> out

A spectral apply in two halves: filter_analyze!, the forward transform, and filter_synthesize!, the multiply by Ĝ(|k|, ℓ) and the inverse transform. Only the second depends on the scale, so a sweep analyzes each field once and synthesizes it at every scale: F̂ analyzed with one plan may be synthesized with the plan for any other scale over the same grid.

analyze_buffer returns a buffer for F̂, or nothing for an engine with no scale-independent half; callers then use filter_apply!.

source
CoarseGrainingEnergyFluxes.Filtering.filter_apply_batch! — Method
filter_apply_batch!(outs, fields, plan) -> outs

Apply one prebuilt plan to several separate fields on its grid, writing outs[i] from fields[i]; the result equals filter_apply! per field. The scattered footprints derive each target point's neighbourhood once for the whole batch.

outs and fields are equal-length collections of matching arrays: an NTuple{K,V} for a batch size known at compile time (stack accumulators), or an AbstractVector. Arrays with a trailing batch axis go through filter_apply_batched!. For independent fields on different grids, see filter_slices!.

source
CoarseGrainingEnergyFluxes.Filtering.filter_apply_batched! — Method
filter_apply_batched!(out, field, plan) -> out

Apply plan to each slice along a trailing batch axis: out and field are (spatial..., Nb) over the plan's grid. On a device with a fused kernel for the engine this is one launch of prod(spatial) * Nb work items; otherwise it loops over the slices. For several separate arrays on one grid, see filter_apply_batch!.

source
CoarseGrainingEnergyFluxes.Filtering.filter_fields! — Method
filter_fields!(outs, fields, grid, kernel, scale; mask_strategy = ZeroFill(), filter_plan = nothing,
               execution = AutoBackend())

Filter several fields on one grid at one kernel and scale with a single plan, filter_plan or one built by plan_filter, through filter_apply_batch!. outs and fields are indexable collections of matching arrays, such as a tuple of velocity components.

source
CoarseGrainingEnergyFluxes.Filtering.plan_filter — Method
plan_filter(grid, kernel, scale; mask_strategy = ZeroFill(), execution = AutoBackend(),
            method = _default_method(grid), transform = AutoSpectralBackend(), kwargs...)

The plan for a grid with no rectilinear or curvilinear engine of its own; method defaults to _default_method. In real space a flat-cell grid (see _is_flat_cell) has the node CSR engine over its own ball query, and any other grid raises. Under method = Spectral() the grid is filtered over its cells by the nonuniform transform of its geometry: NUFFT for a Cartesian one, NUFSHT for a spherical one.

RealSpace() applies the kernel with its compact support. A transform is exact for a band-limited field and its per-apply cost is independent of the filter scale; its support is global.

source
CoarseGrainingEnergyFluxes.Filtering.plan_filter_sweep — Method
plan_filter_sweep(grid, kernel, scales; mask_strategy = ZeroFill(), method = nothing,
                  scale_rates = NoScaleRates(), kwargs...) -> FilterPlanFamily

One plan_filter per scale in scales, all sharing one grid-determined half of the engine and one per-apply scratch: the scales' plans whose buffers have the same shapes hold one set of them. For the prefix-sum top-hat engine the shared half is the measure prefix scans, the ordered axis-1 coordinates and the mask scan. method = nothing takes the grid's default method. scale_rates = ScaleRates() also builds each real-space plan's scale_rate, which a sweep's exact filtering spectrum reads, so a family reused across calls builds them once; ScaleCurvatures() builds their second derivatives too, which the spectral slopes read.

Forwards every other plan_filter keyword.

family = plan_filter_sweep(grid, TopHatKernel(), scales)
for (s, plan) in zip(scales, family)
    filter_apply!(out, field, plan)
end
source
CoarseGrainingEnergyFluxes.Filtering.AbstractProcessShare — Type
AbstractProcessShare
_share_workspace(inner, grid, fp) -> footprint or share
_process_passes(inner, fp) -> Val(n)
_share_staging(share) -> host array or nothing

What a process of a process backend holds to run its shares on inner, and the passes it runs: the host footprint itself with its passes on a host backend; on a device backend the share the device's extension builds (an AbstractProcessShare), whose one pass runs the engine on the device. _share_staging is the host buffer a share's output passes through when it is reduced across processes.

source
CoarseGrainingEnergyFluxes.Filtering._share_pass! — Function
_share_passes(fp) -> Val(n)
_share_pass!(out, field, grid, fp, strategy, ::Val{p}, k, nk, inner) -> nothing
_share_dst(out, fp, ::Val{p}) -> Tuple of arrays
_share_local(fp, ::Val{p}) -> Bool

The n passes of fp's apply; share k of nk of pass p, run on inner, reading the whole field (and the whole output of pass p − 1) and writing its units of out or of fp's pass buffers; the arrays pass p writes, which a backend holding a separate memory per process assembles after the pass; and whether pass p costs less to run whole on every process than to assemble, O(N) work with nothing to exchange before it.

source
CoarseGrainingEnergyFluxes.Filtering._share_run — Method
_share_run(f, inner, units)

Calls f(chunk) for chunks covering units on the inner backend, each chunk one task with its own scratch: one chunk under a serial backend; the OhMyThreads extension splits them among threads.

source
CoarseGrainingEnergyFluxes.Filtering.filter_slices! — Method
filter_slices!(outs, fields, plans; execution = AutoBackend()) -> outs

Apply plans[t] to fields[t], writing outs[t], for every slice t. Slices are independent, each with its own grid and plan; for several fields on one grid, see filter_apply_batch!.

execution parallelizes over the slices. Each slice runs serially inside, whatever execution backend its own plan carries.

source
CoarseGrainingEnergyFluxes.Filtering.slice_costs — Method
slice_costs(plans) -> Vector{Int}

Per-slice work proxy for a longest-first schedule: the number of target points a physical-space plan writes, and 1 for any other plan. A slice's cost grows at least linearly in it.

source
CoarseGrainingEnergyFluxes.Filtering.AbstractFilterMethod — Type
AbstractFilterMethod

How the convolution is evaluated: RealSpace (physical-space footprint, any grid/mask) or Spectral (transform-space multiply, provided by extensions: an FFT on a uniform Cartesian grid, zero-padded along a bounded axis; spherical harmonics on a Fejér first-rule sphere; a NUFFT or NUFSHT on scattered points).

source
CoarseGrainingEnergyFluxes.Filtering.AbstractFilterPlan — Type
AbstractFilterPlan

A prebuilt filter (grid + kernel + scale + mask strategy + execution backend), applied to many fields with no repeated setup. A physical-space plan holds a precomputed footprint; a spectral plan holds its transform plans.

source
CoarseGrainingEnergyFluxes.Filtering.Deformable — Type
Deformable <: AbstractMaskStrategy

Masked cells and the exterior are excluded from both numerator and denominator, so the kernel is renormalized over the active cells in its window ("deformable kernel"), and a masked cell is zero. A constant is reproduced exactly next to a boundary, but the kernel changes shape there, so filtering neither commutes with derivatives nor conserves the domain integral.

source
CoarseGrainingEnergyFluxes.Filtering.RealSpace — Type
RealSpace <: AbstractFilterMethod

The physical-space convolution with the compact kernel, on any grid, mask and geometry. The grid and kernel decide the engine that evaluates its sum. On a host backend that includes a transform of the same sampled kernel where the grid allows one: the FFT on a uniform Cartesian grid (circular along periodic axes, zero-padded along bounded ones) and the transform along longitude on a sphere of uniform longitude, which agree with the direct sum to round-off. Spectral, which multiplies by the kernel's transfer function, is a different discretization.

source
CoarseGrainingEnergyFluxes.Filtering.Spectral — Type
Spectral <: AbstractFilterMethod

Transform-space filtering (kernel applied as a multiply on the transformed field). Requires a spectral extension and a compatible grid (e.g. using FFTW for a uniform Cartesian grid, periodic or bounded).

source
CoarseGrainingEnergyFluxes.Filtering.ZeroFill — Type
ZeroFill <: AbstractMaskStrategy

Masked cells and the domain's exterior are zero-velocity water (Aluie et al. 2018; Storer et al. 2022): they contribute nothing to the numerator, and the kernel keeps its full mass, the cells past a bounded edge included. The kernel is then the same everywhere, so filtering commutes with derivatives and conserves the integral over all space, which on a periodic grid is the grid (Aluie 2019; Grooms et al. 2021, eq. 7).

The filtered field is defined at every cell, a masked one too: within the kernel's reach of an active cell it is nonzero over land.

source
CoarseGrainingEnergyFluxes.Filtering._grid_plan — Method
_grid_plan(plan_or_footprint) -> grid plan or nothing
_with_grid_plan(plan_or_footprint, grid_plan) -> plan_or_footprint
_fresh_grid_plan(grid_plan) -> grid plan

A plan's grid plan where it holds state an apply writes, nothing otherwise; the plan rebound to another; and a grid plan sharing the tables of grid_plan with its own library plans. A grid plan holding no such state is its own.

source
CoarseGrainingEnergyFluxes.Filtering._scratch — Method
_scratch(plan_or_footprint) -> scratch or nothing
_with_scratch(plan_or_footprint, scratch) -> plan_or_footprint
_fresh(scratch) -> scratch
_alike(a, b) -> Bool

The buffers an apply writes, as one value whose identity (===) is the buffers', nothing for an apply writing none; the plan rebound to other buffers; new buffers of the same shapes, zero where an apply reads zero padding; and whether two such values serve the same plans, one type and the same shapes, so that the sequential scales of one family may share one.

source
CoarseGrainingEnergyFluxes.Filtering._worker_transforms — Function
_worker_transforms(tr) -> AbstractSpinTransforms

The spin transforms a worker holds: tr's node tables and longitude step shared, the arrays a transform writes its own; a library's transforms, whose plans hold their execution's buffers, planned anew.

source
CoarseGrainingEnergyFluxes.Filtering.worker_copy — Method
worker_copy(plan) -> plan
worker_copy(family::FilterPlanFamily) -> FilterPlanFamily

A plan that applies as plan does, sharing its read-only tables and holding its own scratch (AbstractFilterScratch), so that the two may apply concurrently. Each concurrent worker of a batch takes one: W workers hold one set of tables and W scratch sets. A family's copy shares its grid plan and the tables of every scale, gives the plans that shared one scratch one new scratch to share, and copies its held scale_rates alike. A nonuniform transform's library plan holds the state of its execution and is planned anew over the same nodes. A plan whose applies run on a device or across processes raises.

source