pub struct IVP<EqType, T: Real, Y: State<T>, Method, SoloutType> { /* private fields */ }Expand description
Unified builder for initial value problems (IVPs).
Consolidates solver configurations, output configurations, and events.
Implementations§
Source§impl<F, T: Real, Y: State<T>> IVP<OdeEqOwned<OdeFnWrapper<F>>, T, Y, (), DefaultSolout>
impl<F, T: Real, Y: State<T>> IVP<OdeEqOwned<OdeFnWrapper<F>>, T, Y, (), DefaultSolout>
Sourcepub fn ode_from_fn(f: F, t0: T, tf: T, y0: Y) -> Self
pub fn ode_from_fn(f: F, t0: T, tf: T, y0: Y) -> Self
Create a new initial value problem for an ordinary differential equation from a closure.
§Example
use differential_equations::prelude::*;
let t0 = 0.0;
let tf = 1.0;
let y0 = 1.0;
let ivp = IVP::ode_from_fn(|t, y, dydt| { *dydt = t * y; }, t0, tf, y0);Source§impl<F, M, T: Real, Y: State<T>> IVP<DaeEqOwned<DaeFnWrapper<F, M>>, T, Y, (), DefaultSolout>
impl<F, M, T: Real, Y: State<T>> IVP<DaeEqOwned<DaeFnWrapper<F, M>>, T, Y, (), DefaultSolout>
Sourcepub fn dae_from_fn(f: F, m: M, t0: T, tf: T, y0: Y) -> Self
pub fn dae_from_fn(f: F, m: M, t0: T, tf: T, y0: Y) -> Self
Create a new initial value problem for a differential algebraic equation from closures.
Source§impl<Drift, Diff, Noise, T: Real, Y: State<T>> IVP<SdeEqOwned<SdeFnWrapper<Drift, Diff, Noise>>, T, Y, (), DefaultSolout>
impl<Drift, Diff, Noise, T: Real, Y: State<T>> IVP<SdeEqOwned<SdeFnWrapper<Drift, Diff, Noise>>, T, Y, (), DefaultSolout>
Sourcepub fn sde_from_fn(
drift: Drift,
diffusion: Diff,
noise: Noise,
t0: T,
tf: T,
y0: Y,
) -> Self
pub fn sde_from_fn( drift: Drift, diffusion: Diff, noise: Noise, t0: T, tf: T, y0: Y, ) -> Self
Create a new initial value problem for a stochastic differential equation from closures.
Source§impl<'a, F, H, T: Real, Y: State<T>, const L: usize> IVP<DdeEq<'a, L, F, H>, T, Y, (), DefaultSolout>
impl<'a, F, H, T: Real, Y: State<T>, const L: usize> IVP<DdeEq<'a, L, F, H>, T, Y, (), DefaultSolout>
Source§impl<const L: usize, Diff, Lags, H, T: Real, Y: State<T>> IVP<DdeEqOwned<L, DdeFnWrapper<L, Diff, Lags>, H>, T, Y, (), DefaultSolout>
impl<const L: usize, Diff, Lags, H, T: Real, Y: State<T>> IVP<DdeEqOwned<L, DdeFnWrapper<L, Diff, Lags>, H>, T, Y, (), DefaultSolout>
Sourcepub fn dde_from_fn(
diff: Diff,
lags: Lags,
t0: T,
tf: T,
y0: Y,
history_function: H,
) -> Self
pub fn dde_from_fn( diff: Diff, lags: Lags, t0: T, tf: T, y0: Y, history_function: H, ) -> Self
Create a new initial value problem for a delay differential equation from closures.
Source§impl<EqType, T: Real, Y: State<T>, Method, SoloutType> IVP<EqType, T, Y, Method, SoloutType>
impl<EqType, T: Real, Y: State<T>, Method, SoloutType> IVP<EqType, T, Y, Method, SoloutType>
Sourcepub fn method<SNew>(self, method: SNew) -> IVP<EqType, T, Y, SNew, SoloutType>
pub fn method<SNew>(self, method: SNew) -> IVP<EqType, T, Y, SNew, SoloutType>
Set the numerical method to be used.
The builder owns the method because solving mutates method state. Construct
a fresh method for each solve, or use the low-level solve_* functions when
you need to manage a mutable solver reference directly.
Sourcepub fn solout<ONew>(self, solout: ONew) -> IVP<EqType, T, Y, Method, ONew>
pub fn solout<ONew>(self, solout: ONew) -> IVP<EqType, T, Y, Method, ONew>
Set a custom solout function.
Sourcepub fn even(self, dt: T) -> IVP<EqType, T, Y, Method, EvenSolout<T>>
pub fn even(self, dt: T) -> IVP<EqType, T, Y, Method, EvenSolout<T>>
Output evenly spaced points between the initial and final time. Note that this does not include the solution of the calculated steps.
Sourcepub fn dense(self, n: usize) -> IVP<EqType, T, Y, Method, DenseSolout>
pub fn dense(self, n: usize) -> IVP<EqType, T, Y, Method, DenseSolout>
Use the Dense Output method to output n number of interpolation points between each step. Note this includes the solution of the calculated steps.
Sourcepub fn t_eval(
self,
points: impl AsRef<[T]>,
) -> IVP<EqType, T, Y, Method, TEvalSolout<T>>
pub fn t_eval( self, points: impl AsRef<[T]>, ) -> IVP<EqType, T, Y, Method, TEvalSolout<T>>
Use the provided time points for evaluation instead of the default method. Note this does not include the solution of the calculated steps.
Sourcepub fn event<'a, E>(
self,
event: &'a E,
) -> IVP<EqType, T, Y, Method, EventWrappedSolout<'a, T, Y, SoloutType, E>>
pub fn event<'a, E>( self, event: &'a E, ) -> IVP<EqType, T, Y, Method, EventWrappedSolout<'a, T, Y, SoloutType, E>>
Wrap current solout with event detection while preserving original output strategy.
Sourcepub fn crossing(
self,
component_idx: usize,
threshold: T,
direction: CrossingDirection,
) -> IVP<EqType, T, Y, Method, CrossingSolout<T>>
pub fn crossing( self, component_idx: usize, threshold: T, direction: CrossingDirection, ) -> IVP<EqType, T, Y, Method, CrossingSolout<T>>
Uses the CrossingSolout method to output points when a specific component crosses a threshold. Note this does not include the solution of the calculated steps.
Sourcepub fn hyperplane_crossing<Y1: State<T>>(
self,
point: Y1,
normal: Y1,
extractor: fn(&Y) -> Y1,
direction: CrossingDirection,
) -> IVP<EqType, T, Y, Method, HyperplaneCrossingSolout<T, Y1, Y>>
pub fn hyperplane_crossing<Y1: State<T>>( self, point: Y1, normal: Y1, extractor: fn(&Y) -> Y1, direction: CrossingDirection, ) -> IVP<EqType, T, Y, Method, HyperplaneCrossingSolout<T, Y1, Y>>
Uses the HyperplaneCrossingSolout method to output points when a specific hyperplane is crossed. Note this does not include the solution of the calculated steps.
Source§impl<EqType, T: Real, Y: State<T>, Method, SoloutType> IVP<EqType, T, Y, Method, SoloutType>where
Method: ToleranceConfig<T>,
impl<EqType, T: Real, Y: State<T>, Method, SoloutType> IVP<EqType, T, Y, Method, SoloutType>where
Method: ToleranceConfig<T>,
Source§impl<'a, F, T: Real, Y: State<T>, Method, SoloutType> IVP<OdeEq<'a, F>, T, Y, Method, SoloutType>where
F: ODE<T, Y>,
Method: OrdinaryNumericalMethod<T, Y> + Interpolation<T, Y>,
SoloutType: Solout<T, Y>,
impl<'a, F, T: Real, Y: State<T>, Method, SoloutType> IVP<OdeEq<'a, F>, T, Y, Method, SoloutType>where
F: ODE<T, Y>,
Method: OrdinaryNumericalMethod<T, Y> + Interpolation<T, Y>,
SoloutType: Solout<T, Y>,
Source§impl<F, T: Real, Y: State<T>, Method, SoloutType> IVP<OdeEqOwned<F>, T, Y, Method, SoloutType>where
F: ODE<T, Y>,
Method: OrdinaryNumericalMethod<T, Y> + Interpolation<T, Y>,
SoloutType: Solout<T, Y>,
impl<F, T: Real, Y: State<T>, Method, SoloutType> IVP<OdeEqOwned<F>, T, Y, Method, SoloutType>where
F: ODE<T, Y>,
Method: OrdinaryNumericalMethod<T, Y> + Interpolation<T, Y>,
SoloutType: Solout<T, Y>,
Source§impl<'a, F, T: Real, Y: State<T>, Method, SoloutType> IVP<DaeEq<'a, F>, T, Y, Method, SoloutType>where
F: DAE<T, Y>,
Method: AlgebraicNumericalMethod<T, Y> + Interpolation<T, Y>,
SoloutType: Solout<T, Y>,
impl<'a, F, T: Real, Y: State<T>, Method, SoloutType> IVP<DaeEq<'a, F>, T, Y, Method, SoloutType>where
F: DAE<T, Y>,
Method: AlgebraicNumericalMethod<T, Y> + Interpolation<T, Y>,
SoloutType: Solout<T, Y>,
Source§impl<F, T: Real, Y: State<T>, Method, SoloutType> IVP<DaeEqOwned<F>, T, Y, Method, SoloutType>where
F: DAE<T, Y>,
Method: AlgebraicNumericalMethod<T, Y> + Interpolation<T, Y>,
SoloutType: Solout<T, Y>,
impl<F, T: Real, Y: State<T>, Method, SoloutType> IVP<DaeEqOwned<F>, T, Y, Method, SoloutType>where
F: DAE<T, Y>,
Method: AlgebraicNumericalMethod<T, Y> + Interpolation<T, Y>,
SoloutType: Solout<T, Y>,
Source§impl<'a, F, T: Real, Y: State<T>, Method, SoloutType> IVP<SdeEq<'a, F>, T, Y, Method, SoloutType>where
F: SDE<T, Y>,
Method: StochasticNumericalMethod<T, Y> + Interpolation<T, Y>,
SoloutType: Solout<T, Y>,
impl<'a, F, T: Real, Y: State<T>, Method, SoloutType> IVP<SdeEq<'a, F>, T, Y, Method, SoloutType>where
F: SDE<T, Y>,
Method: StochasticNumericalMethod<T, Y> + Interpolation<T, Y>,
SoloutType: Solout<T, Y>,
Source§impl<F, T: Real, Y: State<T>, Method, SoloutType> IVP<SdeEqOwned<F>, T, Y, Method, SoloutType>where
F: SDE<T, Y>,
Method: StochasticNumericalMethod<T, Y> + Interpolation<T, Y>,
SoloutType: Solout<T, Y>,
impl<F, T: Real, Y: State<T>, Method, SoloutType> IVP<SdeEqOwned<F>, T, Y, Method, SoloutType>where
F: SDE<T, Y>,
Method: StochasticNumericalMethod<T, Y> + Interpolation<T, Y>,
SoloutType: Solout<T, Y>,
Source§impl<'a, const L: usize, F, H, T: Real, Y: State<T>, Method, SoloutType> IVP<DdeEq<'a, L, F, H>, T, Y, Method, SoloutType>where
F: DDE<L, T, Y>,
H: Fn(T) -> Y + Clone,
Method: DelayNumericalMethod<L, T, Y, H> + Interpolation<T, Y>,
SoloutType: Solout<T, Y>,
impl<'a, const L: usize, F, H, T: Real, Y: State<T>, Method, SoloutType> IVP<DdeEq<'a, L, F, H>, T, Y, Method, SoloutType>where
F: DDE<L, T, Y>,
H: Fn(T) -> Y + Clone,
Method: DelayNumericalMethod<L, T, Y, H> + Interpolation<T, Y>,
SoloutType: Solout<T, Y>,
Source§impl<const L: usize, F, H, T: Real, Y: State<T>, Method, SoloutType> IVP<DdeEqOwned<L, F, H>, T, Y, Method, SoloutType>where
F: DDE<L, T, Y>,
H: Fn(T) -> Y + Clone,
Method: DelayNumericalMethod<L, T, Y, H> + Interpolation<T, Y>,
SoloutType: Solout<T, Y>,
impl<const L: usize, F, H, T: Real, Y: State<T>, Method, SoloutType> IVP<DdeEqOwned<L, F, H>, T, Y, Method, SoloutType>where
F: DDE<L, T, Y>,
H: Fn(T) -> Y + Clone,
Method: DelayNumericalMethod<L, T, Y, H> + Interpolation<T, Y>,
SoloutType: Solout<T, Y>,
Trait Implementations§
Auto Trait Implementations§
impl<EqType, T, Y, Method, SoloutType> Freeze for IVP<EqType, T, Y, Method, SoloutType>
impl<EqType, T, Y, Method, SoloutType> RefUnwindSafe for IVP<EqType, T, Y, Method, SoloutType>where
EqType: RefUnwindSafe,
T: RefUnwindSafe,
Y: RefUnwindSafe,
Method: RefUnwindSafe,
SoloutType: RefUnwindSafe,
impl<EqType, T, Y, Method, SoloutType> Send for IVP<EqType, T, Y, Method, SoloutType>
impl<EqType, T, Y, Method, SoloutType> Sync for IVP<EqType, T, Y, Method, SoloutType>
impl<EqType, T, Y, Method, SoloutType> Unpin for IVP<EqType, T, Y, Method, SoloutType>
impl<EqType, T, Y, Method, SoloutType> UnsafeUnpin for IVP<EqType, T, Y, Method, SoloutType>where
EqType: UnsafeUnpin,
T: UnsafeUnpin,
Y: UnsafeUnpin,
Method: UnsafeUnpin,
SoloutType: UnsafeUnpin,
impl<EqType, T, Y, Method, SoloutType> UnwindSafe for IVP<EqType, T, Y, Method, SoloutType>
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.