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

Per-(unit, layer, species) state for every LID unit in the model. More...

#include <LidLayerSpeciesData.hpp>

Collaboration diagram for openswmm::LidLayerSpeciesState:

Public Member Functions

bool active () const noexcept
 Test whether both LID-unit and species counts are positive.
 
std::size_t layer_index (int unit, LidLayer layer, int species) const noexcept
 Calculate the flat unit/layer/species value index.
 
void resize (int units, int species, const std::vector< int > &offsets)
 Replace LID layer state with a zeroed shape and copied group offsets.
 
void ensureSized (int units, int species, const std::vector< int > &offsets)
 Resize LID state only when its main shape differs.
 
void clear ()
 Release all LID layer species state and reset counts.
 

Public Attributes

int n_units = 0
 
int n_species = 0
 
std::vector< int > group_offset
 
std::vector< double > value
 [(unit * kLayerCount + layer) * n_species + species]
 
std::vector< double > vol_prev
 
std::vector< double > drain_value
 
std::vector< double > inflow_value
 

Static Public Attributes

static constexpr int kLayerCount = static_cast<int>(LidLayer::COUNT_)
 

Detailed Description

Per-(unit, layer, species) state for every LID unit in the model.

Values are whatever the species means — seconds for AGE. The update is complete-mix per layer: what is held ages, what arrives mixes in by volume, and what leaves does so at the layer's own value, which is why only the INFLOW is needed.

Member Function Documentation

◆ active()

bool openswmm::LidLayerSpeciesState::active ( ) const
inlinenoexcept

Test whether both LID-unit and species counts are positive.

Returns
n_units>0 && n_species>0; does not validate allocated arrays or offsets.
Here is the caller graph for this function:

◆ clear()

void openswmm::LidLayerSpeciesState::clear ( )
inline

Release all LID layer species state and reset counts.

Restores empty offsets/value/history/workspace arrays; invalidates borrowed elements and leaves the LID manager definitions unchanged.

◆ ensureSized()

void openswmm::LidLayerSpeciesState::ensureSized ( int units,
int species,
const std::vector< int > & offsets )
inline

Resize LID state only when its main shape differs.

Returns immediately when counts and value length match, preserving values and existing offsets. Does not verify offsets, vol_prev/drain/inflow lengths or refresh changed group topology in that case. Otherwise delegates to resize() and zeroes all state before species-specific seeding.

Parameters
[in]unitsNonnegative total LID-unit count.
[in]speciesNonnegative species stride; all size_t products must fit.
[in]offsetsBorrowed group-prefix offsets copied into owned storage when resizing. Caller provides monotone group-count+1 entries ending at units; not checked.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ layer_index()

std::size_t openswmm::LidLayerSpeciesState::layer_index ( int unit,
LidLayer layer,
int species ) const
inlinenoexcept

Calculate the flat unit/layer/species value index.

Parameters
[in]unitExisting unit index in [0,n_units); unchecked.
[in]layerExisting layer enum excluding COUNT_; unchecked.
[in]speciesExisting species index in [0,n_species); unchecked.
Returns
(unit*kLayerCount+layer)*n_species+species; caller ensures size arithmetic and array bounds.

◆ resize()

void openswmm::LidLayerSpeciesState::resize ( int units,
int species,
const std::vector< int > & offsets )
inline

Replace LID layer state with a zeroed shape and copied group offsets.

Zero values mean seconds for AGE and degC for TEMPERATURE; caller then seeds each enabled species appropriately. Replaces prior values, volume history (ft water depth), drain and inflow arrays. Independent assignments can leave partial state on allocation failure; both explicit counts are required to avoid silently dropping a species dimension.

Parameters
[in]unitsNonnegative total LID-unit count.
[in]speciesNonnegative species stride; all size_t products must fit.
[in]offsetsBorrowed group-prefix offsets copied into owned storage when resizing. Caller provides monotone group-count+1 entries ending at units; not checked.
Here is the caller graph for this function:

Member Data Documentation

◆ drain_value

std::vector<double> openswmm::LidLayerSpeciesState::drain_value

[unit * n_species + species] — what leaves through the underdrain. Decision (2026-08-18): the drain draws from the STORAGE layer, so this is the storage row for every type that has one.

◆ group_offset

std::vector<int> openswmm::LidLayerSpeciesState::group_offset

[type] flat index of that group's first unit; size = numGroups() + 1, so group_offset.back() == n_units.

◆ inflow_value

std::vector<double> openswmm::LidLayerSpeciesState::inflow_value

[unit * n_species + species] — the value of the water arriving at the unit from its subcatchment (rainfall, captured subarea runoff, and run-on where the LID occupies the whole subcatchment), flow-weighted at the point those terms are assembled.

◆ kLayerCount

int openswmm::LidLayerSpeciesState::kLayerCount = static_cast<int>(LidLayer::COUNT_)
staticconstexpr

◆ n_species

int openswmm::LidLayerSpeciesState::n_species = 0

◆ n_units

int openswmm::LidLayerSpeciesState::n_units = 0

◆ value

std::vector<double> openswmm::LidLayerSpeciesState::value

[(unit * kLayerCount + layer) * n_species + species]

◆ vol_prev

std::vector<double> openswmm::LidLayerSpeciesState::vol_prev

[unit * kLayerCount + layer] — the layer's stored water at the END of the previous step, as a depth per unit area (ft), void-weighted the way LIDSolver::storedVolume() weights it. Kept because the solver overwrites its depths in place, so the old volume is otherwise gone by the time the age update runs.


The documentation for this struct was generated from the following file: