OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
InfilBank.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2026 Caleb Buahin
3
12
13#pragma once
14#include "../Infiltration.hpp"
15#include <vector>
16
17namespace openswmm::detail {
19}
20
21namespace openswmm {
23}
24namespace openswmm::surface {
25
31class InfilBank {
32public:
33 enum class Owner { BANK, EXTERNAL };
34 struct Factors {
35 double infiltration = 1.0, recovery = 1.0;
36 };
37
43 void init(int n);
58 void setMethod(int e, InfilModel method, const double p[5], const SimulationOptions& options);
64 void setOwner(int e, Owner owner) { owners_[e] = owner; }
68 Owner owner(int e) const { return owners_[e]; }
81 double rate(int e, double precip_m_s, double runon_m_s, double depth_m, double dt,
82 Factors factors);
83 // Avoid a feet -> SI -> feet roundtrip on the existing runoff path.
94 double rateFeet(int e, double precip, double runon, double depth, double dt, Factors factors);
104 void pack(int e, int& method, double state[6]) const noexcept;
113 void unpack(int e, int method, const double state[6]) noexcept;
118 const std::vector<double>& cumulative() const noexcept { return cumulative_; }
122 void clear();
132 bool model); // internal accepted-boundary IO
141 void validateCheckpoint(const InfilBank& model) const;
142
143private:
144 std::vector<InfilModel> methods_;
145 std::vector<Owner> owners_;
146 std::vector<HortonState> horton_;
147 std::vector<GreenAmptState> grnampt_;
148 std::vector<CurveNumState> curvenum_;
149 std::vector<double> constant_, cumulative_;
162 double evaluate(int e, double precip, double runon, double depth, double dt, Factors factors);
163};
164
166
174InfilBank::Factors infiltrationFactors(const SimulationContext& ctx, double elapsed_s);
175} // namespace openswmm::surface
Infiltration models — Horton, Green-Ampt, SCS Curve Number.
Definition CompletedSourceArchive.hpp:25
Definition InfilBank.hpp:31
void pack(int e, int &method, double state[6]) const noexcept
Export one legacy dynamic-state payload without changing history.
Definition InfilBank.cpp:141
Owner
Definition InfilBank.hpp:33
@ EXTERNAL
Definition InfilBank.hpp:33
@ BANK
Definition InfilBank.hpp:33
void checkpoint(detail::CompletedSourceArchive &archive, bool model)
Stream private native infiltration model or runtime state.
Definition InfilBankCheckpoint.cpp:16
const std::vector< double > & cumulative() const noexcept
Borrow per-entry integrated infiltration depth in metres.
Definition InfilBank.hpp:118
void clear()
Release all method/owner/parameter/history/cumulative entries. Invalidates all element borrows; no ex...
Definition InfilBank.cpp:41
Owner owner(int e) const
Read the stored state-owner marker.
Definition InfilBank.hpp:68
void setMethod(int e, InfilModel method, const double p[5], const SimulationOptions &options)
Select a method and convert its authored parameters for one entry.
Definition InfilBank.cpp:50
void init(int n)
Clear all ownership/history and allocate n default method entries.
Definition InfilBank.cpp:34
void setOwner(int e, Owner owner)
Set the exclusive infiltration-state owner for one entry.
Definition InfilBank.hpp:64
void validateCheckpoint(const InfilBank &model) const
Check restored method/material identity and selected physical state ranges.
Definition InfilBankCheckpoint.cpp:33
double rateFeet(int e, double precip, double runon, double depth, double dt, Factors factors)
Advance one configured kernel without a legacy feet-to-SI-to-feet round trip.
Definition InfilBank.cpp:77
double rate(int e, double precip_m_s, double runon_m_s, double depth_m, double dt, Factors factors)
Advance one bank-owned kernel through the SI boundary.
Definition InfilBank.cpp:85
void unpack(int e, int method, const double state[6]) noexcept
Restore one matching bank-owned legacy dynamic-state payload.
Definition InfilBank.cpp:186
Definition OutfallExchange.hpp:17
Definition GroundHeat.hpp:19
InfilBank::Factors infiltrationFactors(const SimulationContext &ctx, double elapsed_s)
Resolve monthly global factors at the actual independent surface clock.
Definition InfilBank.cpp:21
Definition ExchangeLaw.hpp:60
InfilModel
Definition Infiltration.hpp:45
Central, reentrant simulation context.
Definition SimulationContext.hpp:390
All SWMM simulation options parsed from [OPTIONS] section.
Definition SimulationOptions.hpp:168
Definition InfilBank.hpp:34
double infiltration
Definition InfilBank.hpp:35
double recovery
Definition InfilBank.hpp:35