Trait bacon_sci::ivp::IVPSolver

source ·
pub trait IVPSolver<N, const S: usize>: Sizedwhere
    N: ComplexField,{
    // Required methods
    fn step<T, F>(
        &mut self,
        f: F,
        params: &mut T
    ) -> Result<IVPStatus<N, S>, String>
       where T: Clone,
             F: FnMut(N::RealField, &[N], &mut T) -> Result<SVector<N, S>, String>;
    fn with_tolerance(self, tol: N::RealField) -> Result<Self, String>;
    fn with_dt_max(self, max: N::RealField) -> Result<Self, String>;
    fn with_dt_min(self, min: N::RealField) -> Result<Self, String>;
    fn with_start(self, t_initial: N::RealField) -> Result<Self, String>;
    fn with_end(self, t_final: N::RealField) -> Result<Self, String>;
    fn with_initial_conditions(self, start: &[N]) -> Result<Self, String>;
    fn build(self) -> Self;
    fn get_initial_conditions(&self) -> Option<SVector<N, S>>;
    fn get_time(&self) -> Option<N::RealField>;
    fn check_start(&self) -> Result<(), String>;

    // Provided method
    fn solve_ivp<T: Clone, F: FnMut(N::RealField, &[N], &mut T) -> Result<SVector<N, S>, String>>(
        self,
        f: F,
        params: &mut T
    ) -> Result<Vec<(N::RealField, SVector<N, S>)>, String> { ... }
}
Expand description

Trait defining what it means to be an IVP solver. solve_ivp is automatically implemented based on your step implementation.

Required Methods§

source

fn step<T, F>( &mut self, f: F, params: &mut T ) -> Result<IVPStatus<N, S>, String>where T: Clone, F: FnMut(N::RealField, &[N], &mut T) -> Result<SVector<N, S>, String>,

Step forward in the solver. Returns if the solver is finished, produced an acceptable state, or needs to be redone.

source

fn with_tolerance(self, tol: N::RealField) -> Result<Self, String>

Set the error tolerance for this solver.

source

fn with_dt_max(self, max: N::RealField) -> Result<Self, String>

Set the maximum time step for this solver.

source

fn with_dt_min(self, min: N::RealField) -> Result<Self, String>

Set the minimum time step for this solver.

source

fn with_start(self, t_initial: N::RealField) -> Result<Self, String>

Set the initial time for this solver.

source

fn with_end(self, t_final: N::RealField) -> Result<Self, String>

Set the end time for this solver.

source

fn with_initial_conditions(self, start: &[N]) -> Result<Self, String>

Set the initial conditions for this solver.

source

fn build(self) -> Self

Build this solver.

source

fn get_initial_conditions(&self) -> Option<SVector<N, S>>

Return the initial conditions. Called once at the very start of solving.

source

fn get_time(&self) -> Option<N::RealField>

Get the current time of the solver.

source

fn check_start(&self) -> Result<(), String>

Make sure that every value that needs to be set is set before the solver starts

Provided Methods§

source

fn solve_ivp<T: Clone, F: FnMut(N::RealField, &[N], &mut T) -> Result<SVector<N, S>, String>>( self, f: F, params: &mut T ) -> Result<Vec<(N::RealField, SVector<N, S>)>, String>

Solve an initial value problem, consuming the solver

Implementors§

source§

impl<N, const S: usize> IVPSolver<N, S> for Euler<N, S>where N: ComplexField + Copy, <N as ComplexField>::RealField: Copy,

source§

impl<N, const S: usize, const O: usize> IVPSolver<N, S> for AdamsInfo<N, S, O>where N: ComplexField + FromPrimitive + Copy, <N as ComplexField>::RealField: FromPrimitive + Copy,

source§

impl<N, const S: usize, const O: usize> IVPSolver<N, S> for BDFInfo<N, S, O>where N: ComplexField + FromPrimitive + Copy, <N as ComplexField>::RealField: FromPrimitive + Copy, Const<S>: DimMin<Const<S>, Output = Const<S>>,

source§

impl<N, const S: usize, const O: usize> IVPSolver<N, S> for RKInfo<N, S, O>where N: ComplexField + FromPrimitive + Copy, <N as ComplexField>::RealField: FromPrimitive + Copy,