differential_equations/methods/irk/adaptive/
mod.rs1mod ordinary;
4use super::ImplicitRungeKutta;
7use crate::methods::{Adaptive, Ordinary};
8
9use crate::{
10 traits::{CallBackData, Real, State},
11 tableau::ButcherTableau,
12};
13
14macro_rules! impl_irk_adaptive_step_constructor {
16 ($method_name:ident, $order_val:expr, $s_val:expr, $m_val:expr, $doc:expr) => {
17 impl<E, T: Real, V: State<T>, D: CallBackData> ImplicitRungeKutta<E, Adaptive, T, V, D, $order_val, $s_val, $m_val> {
18 #[doc = $doc]
19 pub fn $method_name() -> Self {
20 let tableau = ButcherTableau::<T, $s_val>::$method_name();
21 let c = tableau.c;
22 let a = tableau.a;
23 let b = tableau.b;
24 let bh = tableau.bh;
25
26 ImplicitRungeKutta {
27 c,
28 a,
29 b,
30 bh,
31 order: $order_val,
32 stages: $s_val,
33 dense_stages: $m_val,
34 ..Default::default()
35 }
36 }
37 }
38 };
39}
40
41impl_irk_adaptive_step_constructor!(gauss_legendre_4, 4, 2, 2, "Creates a new Gauss-Legendre 2-stage implicit Runge-Kutta method of order 4.");
45impl_irk_adaptive_step_constructor!(gauss_legendre_6, 6, 3, 3, "Creates a new Gauss-Legendre 3-stage implicit Runge-Kutta method of order 6.");
46
47impl_irk_adaptive_step_constructor!(lobatto_iiic_2, 2, 2, 2, "Creates a new Lobatto IIIC 2-stage implicit Runge-Kutta method of order 2.");
49impl_irk_adaptive_step_constructor!(lobatto_iiic_4, 4, 3, 3, "Creates a new Lobatto IIIC 3-stage implicit Runge-Kutta method of order 4.");