conspire/math/integrate/ode/mod.rs
1use crate::math::{Norm, Quantity, Scalar, Tensor, TensorVec};
2use crate::units::Time;
3use std::fmt::Debug;
4
5pub(super) mod explicit;
6pub(super) mod implicit;
7
8/// Integrators for ordinary differential equations.
9pub trait OdeIntegrator<Y, U>
10where
11 Self: Debug,
12 Y: Tensor,
13 U: TensorVec<Item = Y>,
14{
15}
16
17/// Fixed-step integrators for ordinary differential equations.
18pub trait FixedStep<T = Time> {
19 /// Returns the time step.
20 fn dt(&self) -> Quantity<T>;
21}
22
23/// Variable-step integrators for ordinary differential equations.
24pub trait VariableStep<T = Time> {
25 /// Returns the absolute error tolerance.
26 fn abs_tol(&self) -> Scalar;
27 /// Returns the relative error tolerance.
28 fn rel_tol(&self) -> Scalar;
29 /// Returns the multiplier for adaptive time steps.
30 fn dt_beta(&self) -> Scalar;
31 /// Returns the exponent for adaptive time steps.
32 fn dt_expn(&self) -> Scalar;
33 /// Returns the cut back factor for function errors.
34 fn dt_cut(&self) -> Scalar;
35 /// Returns the growth factor ceiling for adaptive time steps.
36 fn dt_grow(&self) -> Scalar;
37 /// Returns the minimum value for the time step.
38 fn dt_min(&self) -> Quantity<T>;
39 /// Returns the norm type for error evaluation.
40 fn error_norm(&self) -> &Norm;
41}