OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm::surface::InfilBank Class Reference

#include <InfilBank.hpp>

Collaboration diagram for openswmm::surface::InfilBank:

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.
 

Detailed Description

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.

Member Enumeration Documentation

◆ Owner

Enumerator
BANK 
EXTERNAL 

Member Function Documentation

◆ checkpoint()

void openswmm::surface::InfilBank::checkpoint ( detail::CompletedSourceArchive & archive,
bool model )

Stream private native infiltration model or runtime state.

Parameters
[in,out]archiveMatching CompletedSourceArchive reader/writer at the paired schema position; can partially mutate/emit before an archive error.
modelTrue 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.

◆ clear()

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.

Here is the caller graph for this function:

◆ cumulative()

const std::vector< double > & openswmm::surface::InfilBank::cumulative ( ) const
inlinenoexcept

Borrow per-entry integrated infiltration depth in metres.

Returns
Owned vector, updated by either rate API and reset by init/clear. Not an infiltrated volume or a physical-store debit. Resizing/move/checkpoint may invalidate elements; serialize reading and copy snapshots needed across mutation.

◆ init()

void openswmm::surface::InfilBank::init ( int n)

Clear all ownership/history and allocate n default method entries.

Parameters
nNonnegative 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.
Here is the call graph for this function:

◆ owner()

Owner openswmm::surface::InfilBank::owner ( int e) const
inline

Read the stored state-owner marker.

Parameters
eValid initialized index, unchecked.
Returns
BANK/EXTERNAL as last set, without qualifying another solver or timestep.
Here is the caller graph for this function:

◆ pack()

void openswmm::surface::InfilBank::pack ( int e,
int & method,
double state[6] ) const
noexcept

Export one legacy dynamic-state payload without changing history.

Parameters
eEntry index; invalid yields method zero and six zeros.
[out]methodStored InfilModel integer for valid entry, including EXTERNAL.
[out]stateRequired 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.

◆ rate()

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.

Parameters
eValid configured index with matching method state and stable ownership.
precip_m_sFinite nonnegative precipitation m/s.
runon_m_sFinite nonnegative runon m/s; CN treats it as ponded supply.
depth_mFinite nonnegative available ponded metres.
dtFinite positive seconds; nonpositive returns zero without kernel advance.
factorsFinite physical conductivity/recovery multipliers; Green-Ampt requires a positive conductivity factor for finite upper-zone division behavior.
Returns
Nonnegative m/s converted from rateFeet. EXTERNAL entries return zero. Advances owned model history and cumulative infiltrated metres immediately; does not debit a donor/store or provide rollback. Caller supplies accepted/trial water and validates numerical inputs; flooring the returned SI value is not state repair.
Here is the call graph for this function:

◆ rateFeet()

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.

Parameters
eValid configured entry index and method state, unchecked.
precipFinite nonnegative rainfall ft/s.
runonFinite nonnegative incoming ft/s; CN adds runon*dt to ponded feet.
depthFinite nonnegative available feet.
dtFinite positive seconds; nonpositive suppresses all updates.
factorsConductivity/recovery multipliers with native-kernel admissible ranges.
Returns
Native kernel ft/s, unaltered; zero if EXTERNAL/nonpositive dt. Adds max(0,rate*0.3048)*dt to cumulative metres even on this feet API. No explicit finite validation, rollback, physical-water debit or failure diagnostic.
Here is the caller graph for this function:

◆ setMethod()

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.

Parameters
eValid initialized entry index, unchecked.
methodSupported InfilModel; stored even for an unknown enum, which later dispatches no kernel and yields zero.
pReadable 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.
optionsValid 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.
Here is the call graph for this function:

◆ setOwner()

void openswmm::surface::InfilBank::setOwner ( int e,
Owner owner )
inline

Set the exclusive infiltration-state owner for one entry.

Parameters
eValid initialized index, unchecked.
ownerBANK 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.
Here is the call graph for this function:

◆ unpack()

void openswmm::surface::InfilBank::unpack ( int e,
int method,
const double state[6] )
noexcept

Restore one matching bank-owned legacy dynamic-state payload.

Parameters
eEntry index; invalid is a no-op.
methodMust equal this entry's initialized method, otherwise no-op.
stateReadable 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.

◆ validateCheckpoint()

void openswmm::surface::InfilBank::validateCheckpoint ( const InfilBank & model) const

Check restored method/material identity and selected physical state ranges.

Parameters
modelCompatible 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.
Exceptions
std::runtime_errorAny 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.

The documentation for this class was generated from the following files: