conspire/math/integrate/ode/dynamics/explicit/
mod.rs1pub(crate) mod stacked;
2pub(crate) mod velocity_verlet;
3
4use crate::{
5 math::{
6 Derivative, Differentiable, Quantity, Scalar, Tensor, TensorVec,
7 integrate::{IntegrationError, Spectrum, Times},
8 },
9 units::Time,
10};
11use std::fmt::Debug;
12
13pub trait ExplicitDynamics<X, UX, UV, UA, T = Time>
18where
19 Self: Debug,
20 X: Differentiable<T> + Tensor,
21 Derivative<X, T>: Differentiable<T> + Tensor,
22 UX: TensorVec<Item = X>,
23 UV: TensorVec<Item = Derivative<X, T>>,
24 UA: TensorVec<Item = Derivative<Derivative<X, T>, T>>,
25{
26 #[doc = include_str!("doc.md")]
27 fn integrate(
28 &self,
29 function: impl FnMut(
30 Quantity<T>,
31 &X,
32 &Derivative<X, T>,
33 ) -> Result<Derivative<Derivative<X, T>, T>, String>,
34 time: &[Quantity<T>],
35 initial_position: X,
36 initial_velocity: Derivative<X, T>,
37 ) -> Result<(Times<T>, UX, UV, UA), IntegrationError>;
38 #[doc = include_str!("bounded.md")]
39 fn integrate_bounded(
40 &self,
41 function: impl FnMut(
42 Quantity<T>,
43 &X,
44 &Derivative<X, T>,
45 ) -> Result<Derivative<Derivative<X, T>, T>, String>,
46 bound: impl FnMut(Quantity<T>, &X, &Derivative<X, T>) -> Result<Quantity<T>, String>,
47 safety: Scalar,
48 time: &[Quantity<T>],
49 initial_position: X,
50 initial_velocity: Derivative<X, T>,
51 ) -> Result<(Times<T>, UX, UV, UA), IntegrationError>;
52}
53
54pub trait ExplicitDynamicsCoupled<X, Y, UX, UV, UA, UY, UR, T = Time>
59where
60 Self: Debug,
61 X: Differentiable<T> + Tensor,
62 Derivative<X, T>: Differentiable<T> + Tensor,
63 Y: Differentiable<T> + Tensor,
64 UX: TensorVec<Item = X>,
65 UV: TensorVec<Item = Derivative<X, T>>,
66 UA: TensorVec<Item = Derivative<Derivative<X, T>, T>>,
67 UY: TensorVec<Item = Y>,
68 UR: TensorVec<Item = Derivative<Y, T>>,
69{
70 #[expect(clippy::type_complexity)]
78 fn integrate_coupled(
79 &self,
80 function: impl FnMut(
81 Quantity<T>,
82 &X,
83 &Derivative<X, T>,
84 &Y,
85 )
86 -> Result<(Derivative<Derivative<X, T>, T>, Derivative<Y, T>), String>,
87 time: &[Quantity<T>],
88 initial_position: X,
89 initial_velocity: Derivative<X, T>,
90 initial_state: Y,
91 ) -> Result<(Times<T>, UX, UV, UA, UY, UR), IntegrationError>;
92 #[expect(clippy::type_complexity)]
100 #[expect(clippy::too_many_arguments)]
101 fn integrate_coupled_bounded(
102 &self,
103 function: impl FnMut(
104 Quantity<T>,
105 &X,
106 &Derivative<X, T>,
107 &Y,
108 )
109 -> Result<(Derivative<Derivative<X, T>, T>, Derivative<Y, T>), String>,
110 bound: impl FnMut(Quantity<T>, &X, &Derivative<X, T>, &Y) -> Result<Spectrum<T>, String>,
111 safety: Scalar,
112 time: &[Quantity<T>],
113 initial_position: X,
114 initial_velocity: Derivative<X, T>,
115 initial_state: Y,
116 ) -> Result<(Times<T>, UX, UV, UA, UY, UR), IntegrationError>;
117}