differential_equations/methods/irk/adaptive/
mod.rs1mod ordinary;
4
5use crate::{
6 methods::{Adaptive, ImplicitRungeKutta},
7 tableau::ButcherTableau,
8 traits::{Real, State},
9};
10
11macro_rules! impl_irk_adaptive_step_constructor {
13 ($method_name:ident, $order_val:expr, $s_val:expr, $m_val:expr, $doc:expr) => {
14 impl<E, T: Real, Y: State<T>>
15 ImplicitRungeKutta<E, Adaptive, T, Y, $order_val, $s_val, $m_val>
16 {
17 #[doc = $doc]
18 pub fn $method_name() -> Self {
19 let tableau = ButcherTableau::<T, $s_val>::$method_name();
20 let c = tableau.c;
21 let a = tableau.a;
22 let b = tableau.b;
23 let bh = tableau.bh;
24
25 ImplicitRungeKutta {
26 c,
27 a,
28 b,
29 bh,
30 order: $order_val,
31 stages: $s_val,
32 dense_stages: $m_val,
33 ..Default::default()
34 }
35 }
36 }
37 };
38}
39
40impl_irk_adaptive_step_constructor!(
42 gauss_legendre_4,
43 4,
44 2,
45 2,
46 "Creates a new Gauss-Legendre 2-stage implicit Runge-Kutta method of order 4."
47);
48impl_irk_adaptive_step_constructor!(
49 gauss_legendre_6,
50 6,
51 3,
52 3,
53 "Creates a new Gauss-Legendre 3-stage implicit Runge-Kutta method of order 6."
54);
55
56impl_irk_adaptive_step_constructor!(
58 lobatto_iiic_2,
59 2,
60 2,
61 2,
62 "Creates a new Lobatto IIIC 2-stage implicit Runge-Kutta method of order 2."
63);
64impl_irk_adaptive_step_constructor!(
65 lobatto_iiic_4,
66 4,
67 3,
68 3,
69 "Creates a new Lobatto IIIC 3-stage implicit Runge-Kutta method of order 4."
70);