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
use serde::{Deserialize, Serialize};

#[allow(clippy::module_name_repetitions)]
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(default)]
pub struct RestartFixUpStrategy {
    #[serde(alias = "deme", alias = "ood")]
    pub out_of_deme: OutOfDemeStrategy,
    #[serde(alias = "habitat", alias = "ooh")]
    pub out_of_habitat: OutOfHabitatStrategy,
    #[serde(alias = "dup", alias = "coa")]
    pub coalescence: CoalescenceStrategy,
}

impl Default for RestartFixUpStrategy {
    fn default() -> Self {
        Self {
            out_of_deme: OutOfDemeStrategy::Abort,
            out_of_habitat: OutOfHabitatStrategy::Abort,
            coalescence: CoalescenceStrategy::Abort,
        }
    }
}

#[allow(clippy::module_name_repetitions)]
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum OutOfDemeStrategy {
    Abort,
    Dispersal,
}

#[allow(clippy::module_name_repetitions)]
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum OutOfHabitatStrategy {
    Abort,
    #[serde(alias = "Uniform")]
    UniformDispersal,
}

#[allow(clippy::module_name_repetitions)]
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum CoalescenceStrategy {
    Abort,
    Coalescence,
}