moldyn_core/simulation/
args.rs1use serde::{Deserialize, Serialize};
4
5#[derive(Serialize, Deserialize, Clone, Debug, Default)]
8pub struct SimulationArgs {
9 #[serde(default)]
11 pub time_start: Option<f64>,
12
13 #[serde(default)]
15 pub time_end: Option<f64>,
16
17 #[serde(default)]
19 pub time_step: Option<f64>,
20}
21
22#[cfg(test)]
23impl SimulationArgs {
24 pub fn new(time: f64, time_step: f64) -> Self {
26 Self {
27 time_start: Some(0.0),
28 time_end: Some(time),
29 time_step: Some(time_step),
30 }
31 }
32
33 pub fn ticks(ticks: usize) -> Self {
36 const TIME_STEP: f64 = 0.01;
37
38 Self {
39 time_start: Some(0.0),
40 time_end: Some(ticks as f64 * TIME_STEP),
41 time_step: Some(TIME_STEP),
42 }
43 }
44}