Skip to main content

hydr_structures/structures/
applicability.rs

1//! Explicit coefficient and physical-regime evidence without inferred defaults.
2
3/// Applicability evidence for a fully submerged opening.
4#[derive(Clone, Debug, PartialEq, Eq)]
5pub struct OrificeApplicability {
6    /// Coefficient source, calibration, or declared assumption.
7    pub coefficient_provenance: String,
8    /// Evidence supporting the fully submerged law and quiescent approach assumptions.
9    pub fully_submerged_applicability: String,
10    /// Explicit coefficient applicability under reversed flow.
11    pub symmetric_reversal: bool,
12}
13impl OrificeApplicability {
14    pub(crate) fn check(&self) -> Result<(), super::StructureError> {
15        super::definition::text(&self.coefficient_provenance, "coefficient_provenance")?;
16        super::definition::text(
17            &self.fully_submerged_applicability,
18            "fully_submerged_applicability",
19        )
20    }
21}
22
23/// Applicability evidence for an HDS-5 culvert.
24#[derive(Clone, Debug, PartialEq, Eq)]
25pub struct CulvertApplicability {
26    /// Source of the inlet coefficients, entrance losses and Manning `n`.
27    pub coefficient_provenance: String,
28    /// Evidence that the barrel is clean and unobstructed, and that its stored water is negligible.
29    pub barrel_condition_assertion: String,
30}
31impl CulvertApplicability {
32    pub(crate) fn check(&self) -> Result<(), super::StructureError> {
33        super::definition::text(&self.coefficient_provenance, "coefficient_provenance")?;
34        super::definition::text(
35            &self.barrel_condition_assertion,
36            "barrel_condition_assertion",
37        )
38    }
39}
40
41/// Applicability evidence for a suppressed sharp-crested rectangular weir only.
42#[derive(Clone, Debug, PartialEq, Eq)]
43pub struct WeirApplicability {
44    /// Coefficient source, calibration, or declared assumption.
45    pub coefficient_provenance: String,
46    /// Explicit suppressed-crest, free-nappe, and approach-flow assumptions.
47    pub free_nappe_and_approach_assertion: String,
48    /// Applicability evidence for the adopted Villemonte correction.
49    pub submergence_correction_assertion: String,
50    /// Explicit coefficient applicability under reversed flow.
51    pub symmetric_reversal: bool,
52}
53impl WeirApplicability {
54    pub(crate) fn check(&self) -> Result<(), super::StructureError> {
55        for (value, field) in [
56            (&self.coefficient_provenance, "coefficient_provenance"),
57            (
58                &self.free_nappe_and_approach_assertion,
59                "free_nappe_and_approach_assertion",
60            ),
61            (
62                &self.submergence_correction_assertion,
63                "submergence_correction_assertion",
64            ),
65        ] {
66            super::definition::text(value, field)?;
67        }
68        Ok(())
69    }
70}