pub trait AdaptiveIntegrator {
// Required method
fn adaptive_step<R: Real, S: VectorSpace<R>, M: Metric<S, R>, F: Fn(R, S) -> S>(
&self,
state: &mut [(R, S)],
ds: R,
force: F,
d: M,
) -> (R, S);
// Provided method
fn adaptive_init<R: Real, S: VectorSpace<R>, M: Metric<S, R>, F: Fn(R, S) -> S>(
&self,
t0: R,
state: S,
_ds: R,
_force: F,
_d: M,
) -> Box<[(R, S)]> { ... }
}
Required Methods§
fn adaptive_step<R: Real, S: VectorSpace<R>, M: Metric<S, R>, F: Fn(R, S) -> S>( &self, state: &mut [(R, S)], ds: R, force: F, d: M, ) -> (R, S)
Provided Methods§
Sourcefn adaptive_init<R: Real, S: VectorSpace<R>, M: Metric<S, R>, F: Fn(R, S) -> S>(
&self,
t0: R,
state: S,
_ds: R,
_force: F,
_d: M,
) -> Box<[(R, S)]>
fn adaptive_init<R: Real, S: VectorSpace<R>, M: Metric<S, R>, F: Fn(R, S) -> S>( &self, t0: R, state: S, _ds: R, _force: F, _d: M, ) -> Box<[(R, S)]>
Examples found in repository?
examples/adaptive.rs (line 16)
8fn main() {
9
10 fn f(_t: f64, y: f64) -> f64 { y }
11
12 let ds = 0.5;
13 // let mut s1 = EULER_HEUN.adaptive_init(0.0, 1.0, ds, &f, InnerProductMetric);
14 // let mut s2 = BOGACKI_SHAMPINE.adaptive_init(0.0, 1.0, ds, &f, InnerProductMetric);
15 // let mut s3 = RK_FELBERG.adaptive_init(0.0, 1.0, ds, &f, InnerProductMetric);
16 let mut s4 = DORMAND_PRINCE.adaptive_init(0.0, 1.0, ds, &f, InnerProductMetric);
17
18 for _ in 0..100 {
19 // let (t, y) = EULER_HEUN.adaptive_step(s1.as_mut(), ds, &f, InnerProductMetric);
20 // let (t, y) = BOGACKI_SHAMPINE.adaptive_step(s3.as_mut(), ds, &f, InnerProductMetric);
21 // let (t, y) = RK_FELBERG.adaptive_step(s3.as_mut(), ds, &f, InnerProductMetric);
22 let (t, y) = DORMAND_PRINCE.adaptive_step(s4.as_mut(), ds, &f, InnerProductMetric);
23 println!("t={} y={} exp(t)={}", t, y, t.exp());
24 // println!("{:?} ", RK_FELBERG.adaptive_step(s2.as_mut(), ds, &f));
25 }
26
27
28}
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.