1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//! # tpt-sci-sim-core
//!
//! Multi-scale simulation orchestration for the `tpt-science` pillar: the
//! layer *above* [`tpt_sci_ode`] and [`tpt_sci_grid`] that a "multi-scale
//! computational platform" (the motivating use case for `tpt-soma` and
//! `tpt-cerebrum`) actually needs and that neither solver crate provides
//! alone.
//!
//! It provides:
//!
//! - **Time-stepping across heterogeneous sub-models.** Each [`SubModel`]
//! advances on its own internal time scale (`max_step`) while a
//! [`Simulation`] drives them all forward to a shared target time, taking
//! the largest sub-step that no model would overshoot.
//! - **Cross-scale coupling.** A [`Coupling`] maps the state of one model onto
//! the input buffer of another after every sub-step, so a fast model's
//! output can drive a slow one (or vice versa).
//! - **Checkpointing.** [`Simulation::snapshot`] / [`Simulation::restore`]
//! capture and restore every model's state and the global clock, for
//! resumable / reproducible runs.
//!
//! ## Example
//!
//! ```rust
//! use tpt_sci_sim_core::{OdeSubModel, Simulation, SubModel};
//!
//! // A single fast exponential-decay sub-model: dy/dt = -y, y(0) = 1.
//! let decay = OdeSubModel::new(
//! "decay",
//! |_t, y, dydt| dydt[0] = -y[0],
//! vec![1.0],
//! 0.0,
//! );
//! let mut sim = Simulation::new();
//! sim.add_model(decay).unwrap();
//! sim.step_until(1.0).unwrap();
//! let y = sim.model("decay").unwrap().state()[0];
//! assert!((y - std::f64::consts::E.recip()).abs() < 1e-3);
//! ```
pub use ;
pub use DiffusionSubModel;
pub use SimError;
pub use OdeSubModel;
pub use ;
pub use SubModel;