pub trait SlabHooks:
Send
+ Sync
+ 'static {
// Provided methods
fn post_h_slab(
&self,
_i: &mut SlabMut<'_>,
_u: &SlabRef<'_>,
_ctx: &SlabContext<'_>,
) { ... }
fn post_e_slab(
&self,
_u: &mut SlabMut<'_>,
_i: &SlabRef<'_>,
_ctx: &SlabContext<'_>,
) { ... }
}Expand description
The slab-parallel part of an Operator: bulk
corrections (CPML) run by the worker pool inside the half-step, right
after the kernel on each x-slab.
An operator that touches whole regions of the grid can hand the engine
a SlabHooks object from
Operator::slab_hooks. The engine calls
it once per x-slab and half-step, on the thread that owns the slab,
after that slab’s kernel update and before the serial post_h /
post_e hooks of any operator. The call sees exactly what the kernel of
that slab sees: write access to the updated field type in the slab’s own
x-planes (SlabMut), read access to the other field type in its own
planes plus one neighbour plane (SlabRef: the next plane for H, the
previous one for E). No barrier is added.
Determinism. The slab partition must not change the arithmetic:
work for a node must be computed by the same expression whichever slab
it falls in, and state (e.g. ψ arrays) is kept per slab
(SlabPartition is passed at registration for that purpose). Then
results are bit-identical for any thread count.
Methods take &self because the slabs run concurrently: keep any
mutable state per slab, e.g. one Mutex per slab (each is only ever
locked by the thread of its slab, so it is uncontended). Both methods
default to doing nothing.
Provided Methods§
Sourcefn post_h_slab(
&self,
_i: &mut SlabMut<'_>,
_u: &SlabRef<'_>,
_ctx: &SlabContext<'_>,
)
fn post_h_slab( &self, _i: &mut SlabMut<'_>, _u: &SlabRef<'_>, _ctx: &SlabContext<'_>, )
After the H kernel on slab ctx.slab: i (written, own planes)
is at (n + ½)·dt, u (read, own planes plus the first plane of the
next slab) at n·dt.
Sourcefn post_e_slab(
&self,
_u: &mut SlabMut<'_>,
_i: &SlabRef<'_>,
_ctx: &SlabContext<'_>,
)
fn post_e_slab( &self, _u: &mut SlabMut<'_>, _i: &SlabRef<'_>, _ctx: &SlabContext<'_>, )
After the E kernel on slab ctx.slab: u (written, own planes) is
at (n + 1)·dt, i (read, own planes plus the last plane of the
previous slab) at (n + ½)·dt.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".