Skip to main content

State

Trait State 

Source
pub trait State: Clone {
    // Required methods
    fn axpy(&mut self, a: f64, other: &Self);
    fn scale(&mut self, a: f64);
    fn zeros_like(&self) -> Self;
}
Expand description

A state vector that an integrator can do arithmetic on.

Deliberately tiny: an integrator needs to scale a state and add a multiple of another to it, and nothing else. Anything a domain wants to keep alongside its numbers — a mesh, a material table, a name — stays out of the state and lives on the Dynamics instead, where it costs nothing to carry.

Required Methods§

Source

fn axpy(&mut self, a: f64, other: &Self)

self += a * other, the one operation every explicit integrator is made of. Implementations must visit their elements in a fixed order.

Source

fn scale(&mut self, a: f64)

self *= a.

Source

fn zeros_like(&self) -> Self

A zero of the same shape as this state.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§