Trait OrdinaryNumericalMethod

Source
pub trait OrdinaryNumericalMethod<T, V, D = String>
where T: Real, V: State<T>, D: CallBackData,
{ // Required methods fn init<F>( &mut self, ode: &F, t0: T, tf: T, y: &V, ) -> Result<Evals, Error<T, V>> where F: ODE<T, V, D>; fn step<F>(&mut self, ode: &F) -> Result<Evals, Error<T, V>> where F: ODE<T, V, D>; fn t(&self) -> T; fn y(&self) -> &V; fn t_prev(&self) -> T; fn y_prev(&self) -> &V; fn h(&self) -> T; fn set_h(&mut self, h: T); fn status(&self) -> &Status<T, V, D>; fn set_status(&mut self, status: Status<T, V, D>); }
Expand description

OrdinaryNumericalMethod Trait for ODE NumericalMethods

ODE NumericalMethods implement this trait to solve ordinary differential equations. This step function is called iteratively to solve the ODE. By implementing this trait, different functions can use a user provided ODE solver to solve the ODE that fits their requirements.

Required Methods§

Source

fn init<F>( &mut self, ode: &F, t0: T, tf: T, y: &V, ) -> Result<Evals, Error<T, V>>
where F: ODE<T, V, D>,

Initialize OrdinaryNumericalMethod before solving ODE

§Arguments
  • system - System of ODEs to solve.
  • t0 - Initial time.
  • tf - Final time.
  • y - Initial state.
§Returns
  • Result<Evals, Error<T, V>> - Ok if initialization is successful,
Source

fn step<F>(&mut self, ode: &F) -> Result<Evals, Error<T, V>>
where F: ODE<T, V, D>,

Step through solving the ODE by one step

§Arguments
  • system - System of ODEs to solve.
§Returns
  • Result<Evals, Errors<T, V>> - Ok if step is successful with the number of function evaluations,
Source

fn t(&self) -> T

Access time of last accepted step

Source

fn y(&self) -> &V

Access solution of last accepted step

Source

fn t_prev(&self) -> T

Access time of previous accepted step

Source

fn y_prev(&self) -> &V

Access solution of previous accepted step

Source

fn h(&self) -> T

Access step size of next step

Source

fn set_h(&mut self, h: T)

Set step size of next step

Source

fn status(&self) -> &Status<T, V, D>

Status of solver

Source

fn set_status(&mut self, status: Status<T, V, D>)

Set status of solver

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T: Real, V: State<T>, D: CallBackData> OrdinaryNumericalMethod<T, V, D> for AdamsPredictorCorrector<Ordinary, Adaptive, T, V, D, 4>

Source§

impl<T: Real, V: State<T>, D: CallBackData> OrdinaryNumericalMethod<T, V, D> for AdamsPredictorCorrector<Ordinary, Fixed, T, V, D, 4>

Source§

impl<T: Real, V: State<T>, D: CallBackData, const O: usize, const S: usize, const I: usize> OrdinaryNumericalMethod<T, V, D> for ExplicitRungeKutta<Ordinary, Adaptive, T, V, D, O, S, I>

Source§

impl<T: Real, V: State<T>, D: CallBackData, const O: usize, const S: usize, const I: usize> OrdinaryNumericalMethod<T, V, D> for ExplicitRungeKutta<Ordinary, DormandPrince, T, V, D, O, S, I>

Source§

impl<T: Real, V: State<T>, D: CallBackData, const O: usize, const S: usize, const I: usize> OrdinaryNumericalMethod<T, V, D> for ExplicitRungeKutta<Ordinary, Fixed, T, V, D, O, S, I>

Source§

impl<T: Real, V: State<T>, D: CallBackData, const O: usize, const S: usize, const I: usize> OrdinaryNumericalMethod<T, V, D> for ImplicitRungeKutta<Ordinary, Adaptive, T, V, D, O, S, I>

Source§

impl<T: Real, V: State<T>, D: CallBackData, const O: usize, const S: usize, const I: usize> OrdinaryNumericalMethod<T, V, D> for ImplicitRungeKutta<Ordinary, Fixed, T, V, D, O, S, I>