use crate::{
tolerance::Tolerance,
traits::{Real, State},
};
mod h_init;
mod apc;
mod bdf;
mod dirk;
mod erk;
mod irk;
mod milstein;
pub mod bvp;
pub use apc::AdamsPredictorCorrector;
pub use bdf::BackwardDifferentiationFormula;
pub use dirk::DiagonallyImplicitRungeKutta;
pub use erk::ExplicitRungeKutta;
pub use irk::ImplicitRungeKutta;
pub use milstein::Milstein;
#[derive(Clone)]
pub struct Ordinary;
#[derive(Clone)]
pub struct Delay;
#[derive(Clone)]
pub struct Stochastic;
#[derive(Clone)]
pub struct Algebraic;
#[derive(Clone)]
pub struct Fixed;
#[derive(Clone)]
pub struct Adaptive;
#[derive(Clone)]
pub struct DormandPrince;
#[derive(Clone)]
pub struct Radau;
pub trait ToleranceConfig<T: Real> {
fn rtol<V: Into<Tolerance<T>>>(self, rtol: V) -> Self;
fn atol<V: Into<Tolerance<T>>>(self, atol: V) -> Self;
}
impl<E, F, T: Real, Y: State<T>, const O: usize, const S: usize, const I: usize> ToleranceConfig<T>
for ExplicitRungeKutta<E, F, T, Y, O, S, I>
{
fn rtol<V: Into<Tolerance<T>>>(self, rtol: V) -> Self {
self.rtol(rtol)
}
fn atol<V: Into<Tolerance<T>>>(self, atol: V) -> Self {
self.atol(atol)
}
}
impl<E, F, T: Real, Y: State<T>, const O: usize, const S: usize, const I: usize> ToleranceConfig<T>
for ImplicitRungeKutta<E, F, T, Y, O, S, I>
{
fn rtol<V: Into<Tolerance<T>>>(self, rtol: V) -> Self {
self.rtol(rtol)
}
fn atol<V: Into<Tolerance<T>>>(self, atol: V) -> Self {
self.atol(atol)
}
}
impl<E, F, T: Real, Y: State<T>, const O: usize, const S: usize, const I: usize> ToleranceConfig<T>
for DiagonallyImplicitRungeKutta<E, F, T, Y, O, S, I>
{
fn rtol<V: Into<Tolerance<T>>>(self, rtol: V) -> Self {
self.rtol(rtol)
}
fn atol<V: Into<Tolerance<T>>>(self, atol: V) -> Self {
self.atol(atol)
}
}