IVPSolver

Trait IVPSolver 

Source
pub trait IVPSolver<'a, D: Dimension>: Sized
where DefaultAllocator: Allocator<Self::Field, D>,
{ type Error: Error + From<IVPError>; type Field: ComplexField + Copy; type RealField: RealField; type UserData: Clone; type Derivative: Derivative<Self::Field, D, Self::UserData> + 'a; type Solver: IVPStepper<D, Error = Self::Error, Field = Self::Field, RealField = Self::RealField, UserData = Self::UserData>; // Required methods fn new() -> Result<Self, Self::Error>; fn new_dyn(size: usize) -> Result<Self, Self::Error>; fn dim(&self) -> D; fn with_tolerance(self, tol: Self::RealField) -> Result<Self, Self::Error>; fn with_maximum_dt(self, max: Self::RealField) -> Result<Self, Self::Error>; fn with_minimum_dt(self, min: Self::RealField) -> Result<Self, Self::Error>; fn with_initial_time( self, initial: Self::RealField, ) -> Result<Self, Self::Error>; fn with_ending_time( self, ending: Self::RealField, ) -> Result<Self, Self::Error>; fn with_initial_conditions( self, start: BVector<Self::Field, D>, ) -> Result<Self, Self::Error>; fn with_derivative(self, derivative: Self::Derivative) -> Self; fn solve( self, data: Self::UserData, ) -> Result<IVPIterator<D, Self::Solver>, Self::Error>; // Provided method fn with_initial_conditions_slice( self, start: &[Self::Field], ) -> Result<Self, Self::Error> { ... } }
Expand description

Trait covering all initial value problem solvers. Build up the solver using the parameter builder functions and then use solve.

This is used as a builder pattern, setting parameters of the solver. IVPSolver implementations should implement a step function that returns an IVPStatus, then a blanket impl will allow it to be used as an IntoIterator for the user to iterate over the results.

Required Associated Types§

Source

type Error: Error + From<IVPError>

Error type. IVPError must be able to convert to the error type.

Source

type Field: ComplexField + Copy

The field, complex or real, that the solver is operating on.

Source

type RealField: RealField

The real field associated with the solver’s Field.

Source

type UserData: Clone

Arbitrary data provided by the user for the derivative function

Source

type Derivative: Derivative<Self::Field, D, Self::UserData> + 'a

The type signature of the derivative function to use

Source

type Solver: IVPStepper<D, Error = Self::Error, Field = Self::Field, RealField = Self::RealField, UserData = Self::UserData>

The type that actually does the solving.

Required Methods§

Source

fn new() -> Result<Self, Self::Error>

Create the solver. Will fail for dynamically sized solvers

Source

fn new_dyn(size: usize) -> Result<Self, Self::Error>

Create the solver with a run-time dimension. Will fail for statically sized solvers

Source

fn dim(&self) -> D

Gets the dimension of the solver

Source

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

Set the error tolerance for any condition needing needing a float epsilon

Source

fn with_maximum_dt(self, max: Self::RealField) -> Result<Self, Self::Error>

Source

fn with_minimum_dt(self, min: Self::RealField) -> Result<Self, Self::Error>

Source

fn with_initial_time( self, initial: Self::RealField, ) -> Result<Self, Self::Error>

Source

fn with_ending_time(self, ending: Self::RealField) -> Result<Self, Self::Error>

Source

fn with_initial_conditions( self, start: BVector<Self::Field, D>, ) -> Result<Self, Self::Error>

The initial conditions of the problem, in a BVector. Should reset any previous values.

Source

fn with_derivative(self, derivative: Self::Derivative) -> Self

Sets the derivative function to use during the solve

Source

fn solve( self, data: Self::UserData, ) -> Result<IVPIterator<D, Self::Solver>, Self::Error>

Turns the solver into an iterator over the solution, using IVPStep::step

Provided Methods§

Source

fn with_initial_conditions_slice( self, start: &[Self::Field], ) -> Result<Self, Self::Error>

The initial conditions of the problem, should reset any previous values.

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<'a, N, D, T, F> IVPSolver<'a, D> for Euler<'a, N, D, T, F>
where N: ComplexField + Copy, D: Dimension, T: Clone, F: Derivative<N, D, T> + 'a, DefaultAllocator: Allocator<N, D>,

Source§

impl<'a, N, D, const O: usize, T, F, A> IVPSolver<'a, D> for Adams<'a, N, D, O, T, F, A>
where D: Dimension, N: ComplexField + Copy, T: Clone, F: Derivative<N, D, T> + 'a, A: AdamsCoefficients<O, RealField = N::RealField>, DefaultAllocator: Allocator<N, D> + Allocator<N, Const<O>>,

Source§

impl<'a, N, D, const O: usize, T, F, B> IVPSolver<'a, D> for BDF<'a, N, D, O, T, F, B>
where N: ComplexField + Copy, D: Dimension + DimMin<D, Output = D>, T: Clone, F: Derivative<N, D, T> + 'a, B: BDFCoefficients<O, RealField = N::RealField>, DefaultAllocator: Allocator<N, D> + Allocator<N, U1, D> + Allocator<N, D, D> + Allocator<(usize, usize), D>,

Source§

impl<'a, N, D, const O: usize, T, F, R> IVPSolver<'a, D> for RungeKutta<'a, N, D, O, T, F, R>
where D: Dimension, N: ComplexField + Copy, T: Clone, F: Derivative<N, D, T> + 'a, R: RungeKuttaCoefficients<O, RealField = N::RealField>, DefaultAllocator: Allocator<N, D> + Allocator<N, Const<O>> + Allocator<N, D, Const<O>>,