pub struct StencilOperators { /* private fields */ }Expand description
Stencil operators
Implementations§
Source§impl StencilOperators
impl StencilOperators
pub fn new() -> Self
Sourcepub fn register_operator(&mut self, name: &str, stencil: StencilOperator)
pub fn register_operator(&mut self, name: &str, stencil: StencilOperator)
Register a named stencil operator.
Sourcepub fn register_boundary_stencil(
&mut self,
name: &str,
stencil: BoundaryStencil,
)
pub fn register_boundary_stencil( &mut self, name: &str, stencil: BoundaryStencil, )
Register a named boundary stencil.
Sourcepub fn apply_derivative(
&self,
name: &str,
field: &[f64],
dx: f64,
index: usize,
) -> Result<f64, PhysicsError>
pub fn apply_derivative( &self, name: &str, field: &[f64], dx: f64, index: usize, ) -> Result<f64, PhysicsError>
Apply a registered stencil to compute the spatial derivative at index.
The derivative is computed as:
sum_i( coefficients[i] * field[index + offset_i] ) / dxwhere offset_i is taken from stencil_points[i].relative_position[0].
The coefficients are expected to already include the normalisation factor
(e.g. [-0.5, 0.0, 0.5] for a 2nd-order central difference).
Sourcepub fn central_difference_2nd_order() -> StencilOperator
pub fn central_difference_2nd_order() -> StencilOperator
Create a 3-point 2nd-order central difference stencil.
Coefficients [-0.5, 0.0, 0.5] at offsets [-1, 0, +1] give
(field[i+1] - field[i-1]) / (2*dx).
Sourcepub fn forward_difference_1st_order() -> StencilOperator
pub fn forward_difference_1st_order() -> StencilOperator
Create a 2-point 1st-order forward difference stencil.
Coefficients [-1.0, 1.0] at offsets [0, +1] give
(field[i+1] - field[i]) / dx.
Auto Trait Implementations§
impl Freeze for StencilOperators
impl RefUnwindSafe for StencilOperators
impl Send for StencilOperators
impl Sync for StencilOperators
impl Unpin for StencilOperators
impl UnsafeUnpin for StencilOperators
impl UnwindSafe for StencilOperators
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Aggregate shares in an MPC protocol.
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
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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 more