pub struct OdeSolverEquations<M, Rhs, Init, Mass, Root, Out, Reset = UnitCallable<M>>where
M: Matrix,{ /* private fields */ }Expand description
This struct implements the ODE equation trait OdeEquations for a given right-hand side op, mass op, optional root op, and initial condition function.
While the crate::OdeBuilder struct is the easiest way to define an ODE problem, occasionally a user might want to use their own structs that define the equations instead of closures or the DiffSL languave, and this can be done using OdeSolverEquations.
The main traits that you need to implement are the crate::Op and NonLinearOp trait,
which define a nonlinear operator or function F that maps an input vector x to an output vector y, (i.e. y = F(x)).
Once you have implemented this trait, you can then pass an instance of your struct to the rhs argument of the Self::new method.
Once you have created an instance of OdeSolverEquations, you can then use crate::OdeBuilder::build_from_eqn to create a problem.
Implementations§
Trait Implementations§
Source§impl<M, Rhs, Init, Mass, Root, Out, Reset> OdeEquations for OdeSolverEquations<M, Rhs, Init, Mass, Root, Out, Reset>where
M: Matrix,
Rhs: Op<M = M, V = M::V, T = M::T, C = M::C>,
Init: Op<M = M, V = M::V, T = M::T, C = M::C>,
Mass: Op<M = M, V = M::V, T = M::T, C = M::C>,
Root: Op<M = M, V = M::V, T = M::T, C = M::C>,
Out: Op<M = M, V = M::V, T = M::T, C = M::C>,
Reset: Op<M = M, V = M::V, T = M::T, C = M::C>,
for<'a> ParameterisedOp<'a, Rhs>: NonLinearOp<M = M, V = M::V, T = M::T, C = M::C>,
for<'a> ParameterisedOp<'a, Init>: ConstantOp<M = M, V = M::V, T = M::T, C = M::C>,
for<'a> ParameterisedOp<'a, Mass>: LinearOp<M = M, V = M::V, T = M::T, C = M::C>,
for<'a> ParameterisedOp<'a, Root>: NonLinearOp<M = M, V = M::V, T = M::T, C = M::C>,
for<'a> ParameterisedOp<'a, Out>: NonLinearOp<M = M, V = M::V, T = M::T, C = M::C>,
for<'a> ParameterisedOp<'a, Reset>: NonLinearOp<M = M, V = M::V, T = M::T, C = M::C>,
impl<M, Rhs, Init, Mass, Root, Out, Reset> OdeEquations for OdeSolverEquations<M, Rhs, Init, Mass, Root, Out, Reset>where
M: Matrix,
Rhs: Op<M = M, V = M::V, T = M::T, C = M::C>,
Init: Op<M = M, V = M::V, T = M::T, C = M::C>,
Mass: Op<M = M, V = M::V, T = M::T, C = M::C>,
Root: Op<M = M, V = M::V, T = M::T, C = M::C>,
Out: Op<M = M, V = M::V, T = M::T, C = M::C>,
Reset: Op<M = M, V = M::V, T = M::T, C = M::C>,
for<'a> ParameterisedOp<'a, Rhs>: NonLinearOp<M = M, V = M::V, T = M::T, C = M::C>,
for<'a> ParameterisedOp<'a, Init>: ConstantOp<M = M, V = M::V, T = M::T, C = M::C>,
for<'a> ParameterisedOp<'a, Mass>: LinearOp<M = M, V = M::V, T = M::T, C = M::C>,
for<'a> ParameterisedOp<'a, Root>: NonLinearOp<M = M, V = M::V, T = M::T, C = M::C>,
for<'a> ParameterisedOp<'a, Out>: NonLinearOp<M = M, V = M::V, T = M::T, C = M::C>,
for<'a> ParameterisedOp<'a, Reset>: NonLinearOp<M = M, V = M::V, T = M::T, C = M::C>,
Source§fn rhs(&self) -> ParameterisedOp<'_, Rhs>
fn rhs(&self) -> ParameterisedOp<'_, Rhs>
F(t, y) as a NonLinearOpSource§fn root(&self) -> Option<ParameterisedOp<'_, Root>>
fn root(&self) -> Option<ParameterisedOp<'_, Root>>
G(t, y) as a NonLinearOpSource§fn reset(&self) -> Option<ParameterisedOp<'_, Reset>>
fn reset(&self) -> Option<ParameterisedOp<'_, Reset>>
R(y) as a NonLinearOp.
When provided, this is called after a root event at index 0 to reset the state.Source§fn init(&self) -> ParameterisedOp<'_, Init>
fn init(&self) -> ParameterisedOp<'_, Init>
y(t), where t is the initial timeSource§fn out(&self) -> Option<ParameterisedOp<'_, Out>>
fn out(&self) -> Option<ParameterisedOp<'_, Out>>
H(t, y) as a NonLinearOpSource§fn set_params(&mut self, p: &Self::V)
fn set_params(&mut self, p: &Self::V)
Source§fn get_params(&self, p: &mut Self::V)
fn get_params(&self, p: &mut Self::V)
Source§fn set_model_index(&mut self, _m: usize)
fn set_model_index(&mut self, _m: usize)
Source§impl<'a, M, Rhs, Init, Mass, Root, Out, Reset> OdeEquationsRef<'a> for OdeSolverEquations<M, Rhs, Init, Mass, Root, Out, Reset>where
M: Matrix,
Rhs: Op<M = M, V = M::V, T = M::T, C = M::C>,
Init: Op<M = M, V = M::V, T = M::T, C = M::C>,
Mass: Op<M = M, V = M::V, T = M::T, C = M::C>,
Root: Op<M = M, V = M::V, T = M::T, C = M::C>,
Out: Op<M = M, V = M::V, T = M::T, C = M::C>,
Reset: Op<M = M, V = M::V, T = M::T, C = M::C>,
ParameterisedOp<'a, Rhs>: NonLinearOp<M = M, V = M::V, T = M::T, C = M::C>,
ParameterisedOp<'a, Init>: ConstantOp<M = M, V = M::V, T = M::T, C = M::C>,
ParameterisedOp<'a, Mass>: LinearOp<M = M, V = M::V, T = M::T, C = M::C>,
ParameterisedOp<'a, Root>: NonLinearOp<M = M, V = M::V, T = M::T, C = M::C>,
ParameterisedOp<'a, Out>: NonLinearOp<M = M, V = M::V, T = M::T, C = M::C>,
ParameterisedOp<'a, Reset>: NonLinearOp<M = M, V = M::V, T = M::T, C = M::C>,
impl<'a, M, Rhs, Init, Mass, Root, Out, Reset> OdeEquationsRef<'a> for OdeSolverEquations<M, Rhs, Init, Mass, Root, Out, Reset>where
M: Matrix,
Rhs: Op<M = M, V = M::V, T = M::T, C = M::C>,
Init: Op<M = M, V = M::V, T = M::T, C = M::C>,
Mass: Op<M = M, V = M::V, T = M::T, C = M::C>,
Root: Op<M = M, V = M::V, T = M::T, C = M::C>,
Out: Op<M = M, V = M::V, T = M::T, C = M::C>,
Reset: Op<M = M, V = M::V, T = M::T, C = M::C>,
ParameterisedOp<'a, Rhs>: NonLinearOp<M = M, V = M::V, T = M::T, C = M::C>,
ParameterisedOp<'a, Init>: ConstantOp<M = M, V = M::V, T = M::T, C = M::C>,
ParameterisedOp<'a, Mass>: LinearOp<M = M, V = M::V, T = M::T, C = M::C>,
ParameterisedOp<'a, Root>: NonLinearOp<M = M, V = M::V, T = M::T, C = M::C>,
ParameterisedOp<'a, Out>: NonLinearOp<M = M, V = M::V, T = M::T, C = M::C>,
ParameterisedOp<'a, Reset>: NonLinearOp<M = M, V = M::V, T = M::T, C = M::C>,
type Rhs = ParameterisedOp<'a, Rhs>
type Mass = ParameterisedOp<'a, Mass>
type Root = ParameterisedOp<'a, Root>
type Init = ParameterisedOp<'a, Init>
type Out = ParameterisedOp<'a, Out>
type Reset = ParameterisedOp<'a, Reset>
Source§impl<M, Rhs, Init, Mass, Root, Out, Reset> Op for OdeSolverEquations<M, Rhs, Init, Mass, Root, Out, Reset>
impl<M, Rhs, Init, Mass, Root, Out, Reset> Op for OdeSolverEquations<M, Rhs, Init, Mass, Root, Out, Reset>
type T = <M as MatrixCommon>::T
type V = <M as MatrixCommon>::V
type M = M
type C = <M as MatrixCommon>::C
Source§fn statistics(&self) -> OpStatistics
fn statistics(&self) -> OpStatistics
Auto Trait Implementations§
impl<M, Rhs, Init, Mass, Root, Out, Reset> Freeze for OdeSolverEquations<M, Rhs, Init, Mass, Root, Out, Reset>
impl<M, Rhs, Init, Mass, Root, Out, Reset> RefUnwindSafe for OdeSolverEquations<M, Rhs, Init, Mass, Root, Out, Reset>where
Rhs: RefUnwindSafe,
Init: RefUnwindSafe,
<M as MatrixCommon>::V: RefUnwindSafe,
Mass: RefUnwindSafe,
Root: RefUnwindSafe,
Out: RefUnwindSafe,
Reset: RefUnwindSafe,
impl<M, Rhs, Init, Mass, Root, Out, Reset> Send for OdeSolverEquations<M, Rhs, Init, Mass, Root, Out, Reset>
impl<M, Rhs, Init, Mass, Root, Out, Reset> Sync for OdeSolverEquations<M, Rhs, Init, Mass, Root, Out, Reset>
impl<M, Rhs, Init, Mass, Root, Out, Reset> Unpin for OdeSolverEquations<M, Rhs, Init, Mass, Root, Out, Reset>
impl<M, Rhs, Init, Mass, Root, Out, Reset> UnsafeUnpin for OdeSolverEquations<M, Rhs, Init, Mass, Root, Out, Reset>where
Rhs: UnsafeUnpin,
Init: UnsafeUnpin,
<M as MatrixCommon>::V: UnsafeUnpin,
Mass: UnsafeUnpin,
Root: UnsafeUnpin,
Out: UnsafeUnpin,
Reset: UnsafeUnpin,
impl<M, Rhs, Init, Mass, Root, Out, Reset> UnwindSafe for OdeSolverEquations<M, Rhs, Init, Mass, Root, Out, Reset>where
Rhs: UnwindSafe,
Init: UnwindSafe,
<M as MatrixCommon>::V: UnwindSafe,
Mass: UnwindSafe,
Root: UnwindSafe,
Out: UnwindSafe,
Reset: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
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.