pub struct Simulation { /* private fields */ }Expand description
A set of domains sharing a clock.
Implementations§
Source§impl Simulation
impl Simulation
Sourcepub fn new(schedule: Schedule) -> Simulation
pub fn new(schedule: Schedule) -> Simulation
Domains are stepped in the order they are added. That order is part of the physics under a staggered schedule — put the quasi-static producers before the evolving consumers — and it is fixed rather than discovered, so two runs take the same path.
Sourcepub fn with(self, domain: impl Domain + 'static) -> Simulation
pub fn with(self, domain: impl Domain + 'static) -> Simulation
Add a domain. Order matters for Schedule::Staggered and its relatives: a domain
sees the output of those declared before it from this step, and of those after it from
the last one.
Sourcepub fn transfer_tolerance(self, tol: f64) -> Simulation
pub fn transfer_tolerance(self, tol: f64) -> Simulation
Absolute tolerance on the bus audit, in SI units of whatever is on the channel. Default 1e-12.
Sourcepub fn conservation_tolerance(self, tol: f64) -> Simulation
pub fn conservation_tolerance(self, tol: f64) -> Simulation
Relative tolerance on the whole-simulation conservation audit across a step. Default 1e-9.
Sourcepub fn domain(&self, name: &str) -> Option<&dyn Domain>
pub fn domain(&self, name: &str) -> Option<&dyn Domain>
A domain by name, through the trait. For the concrete type, see
Simulation::domain_as.
Sourcepub fn domain_as<T: Any>(&self, name: &str) -> Option<&T>
pub fn domain_as<T: Any>(&self, name: &str) -> Option<&T>
A domain by name and concrete type, for a caller that needs more than the
Domain trait exposes — a temperature profile, a body’s position.
Returns None if the name is not here, if the type is wrong, or if that domain did
not implement Domain::as_any. Three different reasons for the same answer, which
is a wart; the alternative was a required method on every implementor of a trait whose
value is being cheap to implement.