pub struct RhsProgram { /* private fields */ }Expand description
A compiled right-hand side, possibly restricted to one operator’s terms
and writes (API_SPEC §5.8). Made by rhs_program.
Built once and immutable: Send + Sync, and cheap to clone (every clone
shares one program). Evaluate it concurrently with one RhsWorkspace
per thread; a call never starts a thread of its own.
Implementations§
Source§impl RhsProgram
impl RhsProgram
Sourcepub fn aux(&self) -> &[String]
pub fn aux(&self) -> &[String]
The states the program reads but does not write (aux), in
flat-layout order.
Sourcepub fn layout(&self) -> &TileLayout
pub fn layout(&self) -> &TileLayout
The whole-domain layout of u and aux.
Sourcepub fn state_layout(&self) -> &[StateBlock]
pub fn state_layout(&self) -> &[StateBlock]
u’s blocks in flat order, each column-major (first index fastest):
the u half of Self::layout.
Sourcepub fn parameters(&self) -> &[ParamSlot]
pub fn parameters(&self) -> &[ParamSlot]
The parameters p holds, in its order: the order the program’s tape
reads them in (sorted flattened names).
Sourcepub fn parameter_vector(
&self,
overrides: &HashMap<String, f64>,
) -> Result<Vec<f64>, SimulateError>
pub fn parameter_vector( &self, overrides: &HashMap<String, f64>, ) -> Result<Vec<f64>, SimulateError>
The parameter vector with overrides applied over the declared
defaults. Strict: a key naming no parameter, or a parameter with
neither an override nor a default, is an error naming it.
Sourcepub fn forcing_slots(&self) -> &[ForcingSlot]
pub fn forcing_slots(&self) -> &[ForcingSlot]
The buffers a ForcingSet for this program holds, in its order.
Sourcepub fn default_forcing(&self) -> ForcingSet
pub fn default_forcing(&self) -> ForcingSet
The Problem’s forcing when the program was built: provider data, a
caller’s array, or the declared default, and for an array-parameter
slot the parameter’s value. Every call returns the same set (the same
buffers and epoch). A slot none of these fills holds NaN.
Sourcepub fn default_state(&self) -> (Vec<f64>, Vec<f64>)
pub fn default_state(&self) -> (Vec<f64>, Vec<f64>)
The declared default of every state cell, as (u, aux) in this
program’s whole-domain layout (NaN where none is declared).
Sourcepub fn flattened(&self) -> &FlattenedSystem
pub fn flattened(&self) -> &FlattenedSystem
The flattened system this program was compiled from.
Sourcepub fn select(&self, sel: &RhsSelection) -> Result<RhsProgram, SimulateError>
pub fn select(&self, sel: &RhsSelection) -> Result<RhsProgram, SimulateError>
The program for one operator: the summands of each D(x) whose
provenance is in sel.terms, writing only sel.writes (API_SPEC
§5.8). range_selection_writes_incomplete when writes omits a
variable a kept summand writes. It takes the same forcing sets.
Sourcepub fn halo(&self, dec: &Decomposition) -> Result<HaloReport, SimulateError>
pub fn halo(&self, dec: &Decomposition) -> Result<HaloReport, SimulateError>
How far the owned output reaches into each state along each decomposed
or face index set of dec (RFC U3 §3). native only.
Sourcepub fn tile(
&self,
dec: &Decomposition,
bx: &TileBox,
) -> Result<TileProgram, SimulateError>
pub fn tile( &self, dec: &Decomposition, bx: &TileBox, ) -> Result<TileProgram, SimulateError>
This program restricted to one tile of dec (RFC U3 §4). native only.
Sourcepub fn lanes(
&self,
kind: LaneKind,
capacity: usize,
) -> Result<LaneProgram, SimulateError>
pub fn lanes( &self, kind: LaneKind, capacity: usize, ) -> Result<LaneProgram, SimulateError>
This program over a run-time list of at most capacity cells or
columns (RFC U3 §6). native only.
Sourcepub fn new_workspace(&self) -> RhsWorkspace
pub fn new_workspace(&self) -> RhsWorkspace
Buffers for Self::eval_into.
Sourcepub fn eval_into(
&self,
u: &[f64],
aux: &[f64],
p: &[f64],
t: f64,
forcing: &ForcingSet,
du: &mut [f64],
ws: &mut RhsWorkspace,
) -> Result<(), RhsError>
pub fn eval_into( &self, u: &[f64], aux: &[f64], p: &[f64], t: f64, forcing: &ForcingSet, du: &mut [f64], ws: &mut RhsWorkspace, ) -> Result<(), RhsError>
Evaluate the program over the whole domain: du = f(u, aux, p, t) in
Self::layout, reading forcing. Every element of du is written
(zero for a state with no D equation). This is the reference every
tile and lane of the program is bitwise against.
The result depends only on the program and the arguments’ values: not on the thread, the workspace’s history, or any other call.
Trait Implementations§
Source§impl Clone for RhsProgram
impl Clone for RhsProgram
Auto Trait Implementations§
impl Freeze for RhsProgram
impl RefUnwindSafe for RhsProgram
impl Send for RhsProgram
impl Sync for RhsProgram
impl Unpin for RhsProgram
impl UnsafeUnpin for RhsProgram
impl UnwindSafe for RhsProgram
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.