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

Mutable strict-grid UH convolution, rainfall queues and node-flow history. Configure validated UH/decay/assignment rows before init. Serialize all access; advance mutates queues, abstraction, optional SWE and context balance totals. Stored float32 grid rows grow for the whole run; no streaming eviction/rollback. Direct public uh_params/decay_params edits require compatible layout and a fresh initialization before reuse. Exceptions can leave partial changes. More...

#include <RDII.hpp>

Collaboration diagram for openswmm::rdii::RDIISolver:

Public Types

using UhNameMap = std::unordered_map<std::string, int, CiHash, CiEqual>
 UH name → index map type; case-insensitive (legacy hash.c parity).
 

Public Member Functions

void init (SimulationContext &ctx)
 Resolve authored UH/gage/decay assignments and reset the strict-grid driver.
 
int addUnitHydParams (const std::string &name, const UnitHydParams &params)
 Copy a named monthly UH parameter table into the registry.
 
int findUnitHyd (const std::string &name) const
 Find a registered UH parameter table by case-insensitive name.
 
const UhNameMap & uhNameIndex () const
 Borrow the case-insensitive UH registry index.
 
void advance (SimulationContext &ctx, double new_elapsed_sec)
 Record current rain chunks and emit every reached fixed wet-step grid tick.
 
void applyRdiiInflows (SimulationContext &ctx, double elapsed_sec) const
 Add an emitted zero-order-held RDII row into the decomposed node inflow array.
 
const std::vector< double > & nodeFlows () const
 Borrow the latest emitted strict-grid node-flow row.
 
std::vector< int > rdiiNodeList () const
 Copy sorted unique node indices currently stored in group assignment vectors.
 

Static Public Member Functions

static int getRainInterval (const UnitHydParams &uh, double wet_step)
 Select whole-second UH rainfall processing interval.
 
static int getMaxPeriods (const UnitHydParams &uh, int response, int rainInterval)
 Size one response rainfall ring to its longest monthly base duration.
 

Public Attributes

std::vector< UnitHydParams > uh_params
 
std::vector< std::array< ExpDecayParams, 3 > > decay_params
 

Detailed Description

Mutable strict-grid UH convolution, rainfall queues and node-flow history. Configure validated UH/decay/assignment rows before init. Serialize all access; advance mutates queues, abstraction, optional SWE and context balance totals. Stored float32 grid rows grow for the whole run; no streaming eviction/rollback. Direct public uh_params/decay_params edits require compatible layout and a fresh initialization before reuse. Exceptions can leave partial changes.

Member Typedef Documentation

◆ UhNameMap

using openswmm::rdii::RDIISolver::UhNameMap = std::unordered_map<std::string, int, CiHash, CiEqual>

UH name → index map type; case-insensitive (legacy hash.c parity).

Member Function Documentation

◆ addUnitHydParams()

int openswmm::rdii::RDIISolver::addUnitHydParams ( const std::string & name,
const UnitHydParams & params )

Copy a named monthly UH parameter table into the registry.

Parameters
nameCopied case-insensitive key; existing key replaces its table in place.
paramsComplete qualified 12-month by three-response array; no validation.
Returns
Existing/new zero-based index. New insertion appends before map assignment, so allocation failure can leave an unindexed appended table. Does not rebuild active group buffers/grid or align decay_params; configure before init.
Here is the caller graph for this function:

◆ advance()

void openswmm::rdii::RDIISolver::advance ( SimulationContext & ctx,
double new_elapsed_sec )

Record current rain chunks and emit every reached fixed wet-step grid tick.

Parameters
[in,out]ctxMatching initialized model/gages/climate and balance totals. Current gage rainfall must already include monthly adjustment in project depth/hour; climate temperature must match each processed chunk's intended forcing. Accumulates RDII rainfall/produced volumes in ft3; does not mutate node inflow arrays.
new_elapsed_secFinite nonnegative, monotonically nondecreasing END seconds of a runoff substep capped at every gage boundary. Current gage rate is recorded for chunk starts strictly before this endpoint. Caller guarantees bounded run size. No-op for zero groups/nonpositive grid step. Emits inclusive grid ticks starting at zero; legacy sampling uses the first pending chunk rate for every chunk of a tick. Retains all float32 rows and latest node flow. Does not advance global simulation clocks, rescan historical gages, validate time ordering or roll back partial queues/ balances on allocation/error; repeated same time ordinarily emits nothing new.

◆ applyRdiiInflows()

void openswmm::rdii::RDIISolver::applyRdiiInflows ( SimulationContext & ctx,
double elapsed_sec ) const

Add an emitted zero-order-held RDII row into the decomposed node inflow array.

Parameters
[in,out]ctxMatching initialized node indices/rdii_inflow; existing values are incremented, so caller clears decomposition once per routing interval.
elapsed_secFinite routing START seconds, with floor(time/grid_step) safely representable. Negative or beyond emitted coverage contributes nothing. Uses stored float32 cfs and skips abs(q)<FLOW_TOL. Does not generate missing rows, write nodes.lat_flow, advance clocks or update RDII continuity; caller assembles lateral totals afterward. Serial read relative to advance/init is required.

◆ findUnitHyd()

int openswmm::rdii::RDIISolver::findUnitHyd ( const std::string & name) const

Find a registered UH parameter table by case-insensitive name.

Parameters
nameBorrowed key; does not insert.
Returns
Zero-based stored index or -1. No table/active-group layout validation.
Here is the caller graph for this function:

◆ getMaxPeriods()

int openswmm::rdii::RDIISolver::getMaxPeriods ( const UnitHydParams & uh,
int response,
int rainInterval )
static

Size one response rainfall ring to its longest monthly base duration.

Parameters
uhQualified nonnegative finite base seconds fitting integer conversions.
responseNonnegative response index, reduced modulo three.
rainIntervalWhole seconds; nonpositive returns zero before response lookup.
Returns
max over months of int(base/rainInterval)+1, with initial lower bound zero. No allocation/parameter validation; caller supplies a compatible ring afterward.
Here is the caller graph for this function:

◆ getRainInterval()

int openswmm::rdii::RDIISolver::getRainInterval ( const UnitHydParams & uh,
double wet_step )
static

Select whole-second UH rainfall processing interval.

Parameters
uhQualified monthly peak/base seconds; values must fit integer conversions.
wet_stepFinite wet-step seconds fitting int; truncated, nonpositive falls back to 300 before comparing positive truncated rise/fall limbs.
Returns
Minimum positive whole-second wet-step/limb duration, at least one second. Scans all months/responses, skipping nonpositive limbs; no model mutation.
Here is the caller graph for this function:

◆ init()

void openswmm::rdii::RDIISolver::init ( SimulationContext & ctx)

Resolve authored UH/gage/decay assignments and reset the strict-grid driver.

Parameters
[in,out]ctxValid parsed monthly response indices, assignments/gages/node indices, unit enums, start date and finite positive wet_step. Appends warnings for repeated rows/missing temperature/degenerate decay; hydraulic arrays are not filled. Copies rows into existing UH registry (does not clear previously registered groups or unassigned monthly slots), truncates peak/base hours to whole seconds, resets decay rows and builds per-assignment rainfall buffers with starting-month IA. Resets emitted grid, tick clock and selected-node columns. With no assignments it only sets group count zero, retaining old group vectors/latest node-flow buffer; with invalid/no-period responses some prior response storage may remain unused. Requires fresh/compatible lifetime and prevalidated extents; no failure rollback. Does not call climate/gage updates, emit time zero or advance simulation clocks.
Here is the call graph for this function:

◆ nodeFlows()

const std::vector< double > & openswmm::rdii::RDIISolver::nodeFlows ( ) const
inline

Borrow the latest emitted strict-grid node-flow row.

Returns
Member per-node cfs values quantized through float32; not a lookup at a caller-selected routing time. init without assignments can retain old values. Reference lasts until destruction, buffers/elements can change on init/advance; serialize access and copy before retaining a snapshot.

◆ rdiiNodeList()

std::vector< int > openswmm::rdii::RDIISolver::rdiiNodeList ( ) const

Copy sorted unique node indices currently stored in group assignment vectors.

Returns
Independent sorted vector, including negative invalid indices if present. Uses the vectors rather than group count, so init with no new assignments can retain an old list. Does not filter/check current context node membership; inputs should already be validated before use as an RDII interface-file header.

◆ uhNameIndex()

const UhNameMap & openswmm::rdii::RDIISolver::uhNameIndex ( ) const
inline

Borrow the case-insensitive UH registry index.

Returns
Member map reference until destruction; init/add can change/reallocate entries. Serialize with mutation and copy a snapshot before retaining iterators. The map alone does not certify active response/grid initialization.

Member Data Documentation

◆ decay_params

std::vector<std::array<ExpDecayParams, 3> > openswmm::rdii::RDIISolver::decay_params

Exponential decay params per UH group × response. Same indexing as uh_params; each entry holds [SHORT, MEDIUM, LONG]. active == false means the response uses the legacy linear IA model.

◆ uh_params

std::vector<UnitHydParams> openswmm::rdii::RDIISolver::uh_params

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