![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
#include <InfilBank.hpp>
Classes | |
| struct | Factors |
Public Types | |
| enum class | Owner { BANK , EXTERNAL } |
Public Member Functions | |
| void | init (int n) |
| Clear all ownership/history and allocate n default method entries. | |
| void | setMethod (int e, InfilModel method, const double p[5], const SimulationOptions &options) |
| Select a method and convert its authored parameters for one entry. | |
| void | setOwner (int e, Owner owner) |
| Set the exclusive infiltration-state owner for one entry. | |
| Owner | owner (int e) const |
| Read the stored state-owner marker. | |
| 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. | |
| 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. | |
| void | pack (int e, int &method, double state[6]) const noexcept |
| Export one legacy dynamic-state payload without changing history. | |
| void | unpack (int e, int method, const double state[6]) noexcept |
| Restore one matching bank-owned legacy dynamic-state payload. | |
| const std::vector< double > & | cumulative () const noexcept |
| Borrow per-entry integrated infiltration depth in metres. | |
| void | clear () |
| Release all method/owner/parameter/history/cumulative entries. Invalidates all element borrows; no external solver/water store is reset. Safe for an empty bank. Call init/setMethod before further indexed rate/owner access. | |
| void | checkpoint (detail::CompletedSourceArchive &archive, bool model) |
| Stream private native infiltration model or runtime state. | |
| void | validateCheckpoint (const InfilBank &model) const |
| Check restored method/material identity and selected physical state ranges. | |
One state owner and one dispatch for subcatchments and mesh cells. Kernels retain their legacy feet arithmetic; the SI boundary converts only once. Initialize size then configure every BANK-owned entry before evaluation. Mutations are immediate and shared use must be serialized; evaluate a private copy for rejected/accepted trials. Kernels do not debit an external water store.
|
strong |
| void openswmm::surface::InfilBank::checkpoint | ( | detail::CompletedSourceArchive & | archive, |
| bool | model ) |
Stream private native infiltration model or runtime state.
| [in,out] | archive | Matching CompletedSourceArchive reader/writer at the paired schema position; can partially mutate/emit before an archive error. |
| model | True streams method/owner/constant arrays only; false streams fixed cumulative metres and model-specific native parameter/history sequences. Does not itself qualify the loaded model/state. Restore an isolated compatible bank, call validateCheckpoint(), finish the outer archive, then publish paired owners. No accepted clock/store change or portable interchange guarantee. |
| void openswmm::surface::InfilBank::clear | ( | ) |
Release all method/owner/parameter/history/cumulative entries. Invalidates all element borrows; no external solver/water store is reset. Safe for an empty bank. Call init/setMethod before further indexed rate/owner access.
|
inlinenoexcept |
Borrow per-entry integrated infiltration depth in metres.
| void openswmm::surface::InfilBank::init | ( | int | n | ) |
Clear all ownership/history and allocate n default method entries.
| n | Nonnegative entry count with allocatable storage, unchecked conversion. Methods default Horton, owners BANK, constants/cumulative zero; per-model state arrays remain empty until setMethod(). Calling a default Horton rate before its configuration is unsupported. Allocation can leave partially initialized arrays; no physical validation or external state mutation occurs. |
|
inline |
Read the stored state-owner marker.
| e | Valid initialized index, unchecked. |
|
noexcept |
Export one legacy dynamic-state payload without changing history.
| e | Entry index; invalid yields method zero and six zeros. | |
| [out] | method | Stored InfilModel integer for valid entry, including EXTERNAL. |
| [out] | state | Required writable six-double array, always zero-filled first. Horton slots tp/Fe/Fmh; Green-Ampt IMD/F/Fu/T/saturated(0 or1); CN S/Se/P/F/f/T. Native dimensions are seconds/feet/ft/s/fractions as the model fields define. EXTERNAL/CONSTANT/unknown methods leave zero payload. Assumes method state exists; parameters, cumulative metres and ownership are not encoded. noexcept is not bounds or buffer validation; caller provides compatible initialized storage. |
| double openswmm::surface::InfilBank::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.
| e | Valid configured index with matching method state and stable ownership. |
| precip_m_s | Finite nonnegative precipitation m/s. |
| runon_m_s | Finite nonnegative runon m/s; CN treats it as ponded supply. |
| depth_m | Finite nonnegative available ponded metres. |
| dt | Finite positive seconds; nonpositive returns zero without kernel advance. |
| factors | Finite physical conductivity/recovery multipliers; Green-Ampt requires a positive conductivity factor for finite upper-zone division behavior. |
| double openswmm::surface::InfilBank::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.
| e | Valid configured entry index and method state, unchecked. |
| precip | Finite nonnegative rainfall ft/s. |
| runon | Finite nonnegative incoming ft/s; CN adds runon*dt to ponded feet. |
| depth | Finite nonnegative available feet. |
| dt | Finite positive seconds; nonpositive suppresses all updates. |
| factors | Conductivity/recovery multipliers with native-kernel admissible ranges. |
| void openswmm::surface::InfilBank::setMethod | ( | int | e, |
| InfilModel | method, | ||
| const double | p[5], | ||
| const SimulationOptions & | options ) |
Select a method and convert its authored parameters for one entry.
| e | Valid initialized entry index, unchecked. |
| method | Supported InfilModel; stored even for an unknown enum, which later dispatches no kernel and yields zero. |
| p | Readable five-double authored tuple. Horton: f0/fmin project rainfall rate, decay per hour, drying days, max inches/mm. Green-Ampt: suction inches/mm, Ks project rainfall rate, moisture fraction; final slots unused. Curve Number: CN in slot zero, drying days slot two; other slots unused. CONSTANT: project rainfall rate slot zero. Arrays are borrowed only during the call. |
| options | Valid project flow-unit options for native ft/ft/s conversion. Lazily allocates a full-sized method state bank. Does not reset ownership, cumulative metres or all previously retained per-method history (e.g. Horton Fmh, Green-Ampt T follow native initializer behavior). Caller validates parameters and uses a fresh bank for fresh state; allocation failures can follow method assignment. |
|
inline |
Set the exclusive infiltration-state owner for one entry.
| e | Valid initialized index, unchecked. |
| owner | BANK enables local kernel updates; EXTERNAL suppresses rate/history and pack/unpack payloads. Does not transfer physical water or clear existing history. Caller serializes this ownership change with external solver and local evaluations. |
|
noexcept |
Restore one matching bank-owned legacy dynamic-state payload.
| e | Entry index; invalid is a no-op. |
| method | Must equal this entry's initialized method, otherwise no-op. |
| state | Readable six-double payload in pack() slot/native-unit order. Any nonzero Green-Ampt saturation slot means true; no finite/range validation occurs. EXTERNAL entries ignore input; CONSTANT/unknown dispatch nothing. Parameters, method, cumulative metres and owner remain unchanged. Caller validates a matching model/buffer and serializes restoration; noexcept does not supply rollback/checks. |
| void openswmm::surface::InfilBank::validateCheckpoint | ( | const InfilBank & | model | ) | const |
Check restored method/material identity and selected physical state ranges.
| model | Compatible independently qualified original bank. Requires equal methods/owners/constants and per-method vector sizes, exact parameter identity; checks finite nonnegative cumulative values, Horton/CN states and selected Green-Ampt moisture/depth constraints. Green-Ampt timer may be negative. |
| std::runtime_error | Any checked mismatch. Does not change either bank or validate every cross-array length, owner enum/physical model relationship; cumulative vector length equality is not checked here. Outer archive owns shape validation. |