1use super::BoundaryKind;
4
5#[derive(Clone, Copy, Debug, PartialEq, Eq)]
7#[non_exhaustive]
8pub enum Regime {
9 WetSubcritical,
11 Supercritical,
13 Critical,
15 Dry,
17 WetDryFront,
19 ReversalInBranch,
21 FreeWeirFlow,
23 SubmergedWeirFlow,
25 BelowCrest,
27 SubmergedOrificeFlow,
29 FreeGateAperture,
31 MixedGateAperture,
33 SubmergedGateAperture,
35 GateClosed,
37 PumpCurve,
39 PumpShutoff,
41 PumpIsolated,
43 CulvertInletControl,
45 CulvertOutletControl,
47}
48
49impl Regime {
50 pub fn id(&self) -> &'static str {
52 match self {
53 Self::WetSubcritical => "wet-subcritical",
54 Self::Supercritical => "supercritical",
55 Self::Critical => "critical",
56 Self::Dry => "dry",
57 Self::WetDryFront => "wet-dry-front",
58 Self::ReversalInBranch => "reversal-in-branch",
59 Self::FreeWeirFlow => "free-weir-flow",
60 Self::SubmergedWeirFlow => "submerged-weir-flow",
61 Self::BelowCrest => "below-crest",
62 Self::SubmergedOrificeFlow => "submerged-orifice-flow",
63 Self::FreeGateAperture => "free-gate-aperture",
64 Self::MixedGateAperture => "mixed-gate-aperture",
65 Self::SubmergedGateAperture => "submerged-gate-aperture",
66 Self::GateClosed => "gate-closed",
67 Self::PumpCurve => "pump-curve",
68 Self::PumpShutoff => "pump-shutoff",
69 Self::PumpIsolated => "pump-isolated",
70 Self::CulvertInletControl => "culvert-inlet-control",
71 Self::CulvertOutletControl => "culvert-outlet-control",
72 }
73 }
74}
75
76#[derive(Clone, Copy, Debug, PartialEq, Eq)]
78#[non_exhaustive]
79pub enum RegimeScope {
80 Boundary(BoundaryKind),
82 Interior,
84}
85
86impl RegimeScope {
87 pub fn id(&self) -> &'static str {
90 match self {
91 Self::Boundary(_) => "boundary",
92 Self::Interior => "interior",
93 }
94 }
95}
96
97#[derive(Clone, Copy, Debug, PartialEq, Eq)]
99pub struct RegimeSupport {
100 pub scope: RegimeScope,
102 pub regime: Regime,
104}
105
106#[cfg(test)]
107mod tests {
108 use super::*;
109 use crate::capability::id_check::assert_ids;
110
111 #[test]
112 fn regime_ids_are_unique_kebab_case() {
113 let all = [
114 Regime::WetSubcritical,
115 Regime::Supercritical,
116 Regime::Critical,
117 Regime::Dry,
118 Regime::WetDryFront,
119 Regime::ReversalInBranch,
120 Regime::FreeWeirFlow,
121 Regime::SubmergedWeirFlow,
122 Regime::BelowCrest,
123 Regime::SubmergedOrificeFlow,
124 Regime::FreeGateAperture,
125 Regime::MixedGateAperture,
126 Regime::SubmergedGateAperture,
127 Regime::GateClosed,
128 Regime::PumpCurve,
129 Regime::PumpShutoff,
130 Regime::PumpIsolated,
131 Regime::CulvertInletControl,
132 Regime::CulvertOutletControl,
133 ];
134 assert_ids(&all.map(|r| r.id()));
135 }
136
137 #[test]
138 fn structure_regime_ids_are_frozen() {
139 for (regime, id) in [
140 (Regime::SubmergedOrificeFlow, "submerged-orifice-flow"),
141 (Regime::FreeGateAperture, "free-gate-aperture"),
142 (Regime::MixedGateAperture, "mixed-gate-aperture"),
143 (Regime::SubmergedGateAperture, "submerged-gate-aperture"),
144 (Regime::GateClosed, "gate-closed"),
145 (Regime::PumpCurve, "pump-curve"),
146 (Regime::PumpShutoff, "pump-shutoff"),
147 (Regime::PumpIsolated, "pump-isolated"),
148 (Regime::CulvertInletControl, "culvert-inlet-control"),
149 (Regime::CulvertOutletControl, "culvert-outlet-control"),
150 ] {
151 assert_eq!(regime.id(), id);
152 }
153 }
154
155 #[test]
156 fn scope_ids_are_unique_kebab_case() {
157 let all = [
158 RegimeScope::Boundary(BoundaryKind::Wall),
159 RegimeScope::Interior,
160 ];
161 assert_ids(&all.map(|s| s.id()));
162 }
163}