fips_md/runtime/
builder.rs1use anyhow::Result;
4
5use crate::{ parser::Unit, runtime::{ Domain, Runtime }};
6
7pub struct RuntimeBuilder {
9 start_time: f64,
10 time_step: f64,
11 domain: Domain,
12 unit: Unit
13}
14
15impl RuntimeBuilder {
16 pub fn new(unit: Unit, domain: Domain) -> Self {
17 Self {
18 start_time: 0.0,
19 time_step: 1e-4,
20 domain,
21 unit
22 }
23 }
24
25 pub fn with_start_time(mut self, time: f64) -> Self {
26 self.start_time = time;
27 self
28 }
29
30 pub fn with_time_step(mut self, time_step: f64) -> Self {
31 self.time_step = time_step;
32 self
33 }
34
35 pub fn build(self) -> Result<Runtime> {
36 Runtime::new(self.unit, self.domain, self.start_time, self.time_step)
37 }
38}