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§
sourcefn 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 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.
sourcefn with_tolerance(self, tol: N::RealField) -> Result<Self, String>
fn with_tolerance(self, tol: N::RealField) -> Result<Self, String>
Set the error tolerance for this solver.
sourcefn with_dt_max(self, max: N::RealField) -> Result<Self, String>
fn with_dt_max(self, max: N::RealField) -> Result<Self, String>
Set the maximum time step for this solver.
sourcefn with_dt_min(self, min: N::RealField) -> Result<Self, String>
fn with_dt_min(self, min: N::RealField) -> Result<Self, String>
Set the minimum time step for this solver.
sourcefn with_start(self, t_initial: N::RealField) -> Result<Self, String>
fn with_start(self, t_initial: N::RealField) -> Result<Self, String>
Set the initial time for this solver.
sourcefn with_end(self, t_final: N::RealField) -> Result<Self, String>
fn with_end(self, t_final: N::RealField) -> Result<Self, String>
Set the end time for this solver.
sourcefn with_initial_conditions(self, start: &[N]) -> Result<Self, String>
fn with_initial_conditions(self, start: &[N]) -> Result<Self, String>
Set the initial conditions for this solver.
sourcefn get_initial_conditions(&self) -> Option<SVector<N, S>>
fn get_initial_conditions(&self) -> Option<SVector<N, S>>
Return the initial conditions. Called once at the very start of solving.
sourcefn check_start(&self) -> Result<(), String>
fn check_start(&self) -> Result<(), String>
Make sure that every value that needs to be set is set before the solver starts