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

Structure-of-Arrays storage for all rain gages. More...

#include <GageData.hpp>

Collaboration diagram for openswmm::GageData:

Public Member Functions

int count () const noexcept
 
void resize (int n)
 
void grow_to (int n)
 Append one new gage with defaults, preserving existing data.
 
void erase_at (int idx)
 Erase the rain gage at index idx from every parallel array.
 
void shrink_to_fit ()
 Release excess vector capacity accumulated during parsing.
 
void reset_state () noexcept
 

Public Attributes

std::vector< int > rain_type
 Rain data type: 0=INTENSITY, 1=VOLUME, 2=CUMULATIVE.
 
std::vector< RainSourcesource
 Precipitation source (TIMESERIES or FILE).
 
std::vector< int > ts_index
 Time series index (when source == TIMESERIES).
 
std::vector< FilePathPairfile_path
 External rain file path (when source == FILE_RAIN).
 
std::vector< std::string > ts_name
 Timeseries name (for deferred resolution when TS parsed after gages).
 
std::vector< std::string > col_name
 Column name in the external CSV (when source == FILE_RAIN).
 
std::vector< std::string > station_id
 Station ID for a standard SWMM rain file (when source == FILE_RAIN).
 
std::vector< int > rain_units
 Rain depth units declared in the [RAINGAGES] FILE row: 0 = IN, 1 = MM.
 
std::vector< double > file_first_date
 First record date found for this gage's station (OADate, 0 = none).
 
std::vector< double > file_last_date
 Last record date found for this gage's station (OADate, 0 = none).
 
std::vector< long > file_periods_precip
 Number of records with precipitation > 0 for this station.
 
std::vector< Tablerain_series
 Resolved rainfall series for a FILE_RAIN gage (windowed to the run).
 
std::vector< RainFileFormatfile_format
 Rain file format.
 
std::vector< int > interval_sec
 Recording interval in seconds.
 
std::vector< double > snow_factor
 Snow catch deficiency correction factor (1.0 = no correction).
 
std::vector< double > scale_factor
 Rainfall scaling factor (1.0 = no scaling).
 
std::vector< double > rainfall
 Current rainfall rate (project length/time units — inches or mm/hr).
 
std::vector< double > next_rainfall
 Rainfall rate at the next recorded interval (for interpolation).
 
std::vector< double > api_rainfall
 Current API (antecedent precipitation index) rainfall.
 
std::vector< double > next_rain_date
 Simulation time of the next recorded value (decimal days).
 
std::vector< bool > is_raining
 Current state flag (0 = no rain, 1 = raining).
 
std::vector< double > past_rain
 Flat 2D: [gage * MAXPASTRAIN + hour]. Hourly rain totals.
 
std::vector< double > past_rain_accum
 Per-gage accumulator for the current partial hour.
 
std::vector< double > past_rain_time
 Per-gage time (seconds) of last past-rain shift.
 
std::vector< double > cumul_rain_accum
 Gap #31: Cumulative rainfall accumulator (project rain units).
 
std::vector< std::string > comments
 Object comment from the INP file (';'-prefixed lines immediately above this gage's data row), joined by literal "\\n". Empty string means no comment.
 
std::vector< int > co_gage_index
 Gap #53: Co-gage index — index of the primary gage sharing the same timeseries, or -1 if this gage reads independently.
 

Static Public Attributes

static constexpr int MAXPASTRAIN = 48
 Max past hours tracked per gage.
 

Detailed Description

Structure-of-Arrays storage for all rain gages.

The col_name field supports the new multi-column CSV format (R08):

[RAINGAGES]
;; Name Format Interval SCF Source
RG1 VOLUME 0:15 1.0 FILE "rain.csv:EAST_STATION"
@ VOLUME
Volume.
Definition enums.h:309
int Interval
Definition rain.c:75

Member Function Documentation

◆ count()

int openswmm::GageData::count ( ) const
inlinenoexcept
Here is the caller graph for this function:

◆ erase_at()

void openswmm::GageData::erase_at ( int idx)
inline

Erase the rain gage at index idx from every parallel array.

Removes element idx from every SoA vector. The flat-2D past_rain array ([gage * MAXPASTRAIN + hour]) has its full stride for idx removed. Spatial arrays are erased separately.

Here is the caller graph for this function:

◆ grow_to()

void openswmm::GageData::grow_to ( int n)
inline

Append one new gage with defaults, preserving existing data.

Uses std::vector::resize (extend-only) so existing gages are not overwritten. Call instead of resize() when adding a single gage interactively.

Here is the call graph for this function:

◆ reset_state()

void openswmm::GageData::reset_state ( )
inlinenoexcept

◆ resize()

void openswmm::GageData::resize ( int n)
inline
Here is the caller graph for this function:

◆ shrink_to_fit()

void openswmm::GageData::shrink_to_fit ( )
inline

Release excess vector capacity accumulated during parsing.

Member Data Documentation

◆ api_rainfall

std::vector<double> openswmm::GageData::api_rainfall

Current API (antecedent precipitation index) rainfall.

See also
Legacy: Gage[i].apiRainfall

◆ co_gage_index

std::vector<int> openswmm::GageData::co_gage_index

Gap #53: Co-gage index — index of the primary gage sharing the same timeseries, or -1 if this gage reads independently.

When two gages use the same TIMESERIES source and the same ts_index, the later gage copies its rainfall from the earlier one (the primary). Matches legacy Gage[i].coGage.

◆ col_name

std::vector<std::string> openswmm::GageData::col_name

Column name in the external CSV (when source == FILE_RAIN).

New in 6.0.0 — supports "FILE path.csv:COLUMN_NAME" syntax (R08). Empty string means use the first/only data column.

◆ comments

std::vector<std::string> openswmm::GageData::comments

Object comment from the INP file (';'-prefixed lines immediately above this gage's data row), joined by literal "\\n". Empty string means no comment.

◆ cumul_rain_accum

std::vector<double> openswmm::GageData::cumul_rain_accum

Gap #31: Cumulative rainfall accumulator (project rain units).

Tracks the previous raw cumulative value so the delta can be computed each timestep. Initialised to 0. Matches legacy Gage[i].rainAccum.

◆ file_first_date

std::vector<double> openswmm::GageData::file_first_date

First record date found for this gage's station (OADate, 0 = none).

◆ file_format

std::vector<RainFileFormat> openswmm::GageData::file_format

Rain file format.

See also
Legacy: Gage[i].fileFormat

◆ file_last_date

std::vector<double> openswmm::GageData::file_last_date

Last record date found for this gage's station (OADate, 0 = none).

◆ file_path

std::vector<FilePathPair> openswmm::GageData::file_path

External rain file path (when source == FILE_RAIN).

Per-gage {absolute, original} carrier — see core/FilePathPair.hpp. Implicit std::string interface keeps existing readers/writers working unchanged.

See also
Legacy: Gage[i].fname

◆ file_periods_precip

std::vector<long> openswmm::GageData::file_periods_precip

Number of records with precipitation > 0 for this station.

◆ interval_sec

std::vector<int> openswmm::GageData::interval_sec

Recording interval in seconds.

See also
Legacy: Gage[i].rainInterval

◆ is_raining

std::vector<bool> openswmm::GageData::is_raining

Current state flag (0 = no rain, 1 = raining).

See also
Legacy: Gage[i].currentHour / isUsed logic

◆ MAXPASTRAIN

int openswmm::GageData::MAXPASTRAIN = 48
staticconstexpr

Max past hours tracked per gage.

◆ next_rain_date

std::vector<double> openswmm::GageData::next_rain_date

Simulation time of the next recorded value (decimal days).

See also
Legacy: Gage[i].nextRainDate

◆ next_rainfall

std::vector<double> openswmm::GageData::next_rainfall

Rainfall rate at the next recorded interval (for interpolation).

See also
Legacy: Gage[i].nextRainfall

◆ past_rain

std::vector<double> openswmm::GageData::past_rain

Flat 2D: [gage * MAXPASTRAIN + hour]. Hourly rain totals.

◆ past_rain_accum

std::vector<double> openswmm::GageData::past_rain_accum

Per-gage accumulator for the current partial hour.

◆ past_rain_time

std::vector<double> openswmm::GageData::past_rain_time

Per-gage time (seconds) of last past-rain shift.

◆ rain_series

std::vector<Table> openswmm::GageData::rain_series

Resolved rainfall series for a FILE_RAIN gage (windowed to the run).

Populated by load_external_rain_files() with the station's records that fall inside the simulation window, already converted to the project's rain depth units. Reusing a Table gives the runtime the same cursor/step-function lookup as an inline [TIMESERIES] gage, without polluting ctx.tables (so INP round-trips still emit FILE). Empty unless source == FILE_RAIN.

◆ rain_type

std::vector<int> openswmm::GageData::rain_type

Rain data type: 0=INTENSITY, 1=VOLUME, 2=CUMULATIVE.

See also
Legacy: Gage[i].rainType

◆ rain_units

std::vector<int> openswmm::GageData::rain_units

Rain depth units declared in the [RAINGAGES] FILE row: 0 = IN, 1 = MM.

Used to convert the file's raw depths into the project's rain units when the file units differ from the unit system.

See also
Legacy: Gage[i].rainUnits

◆ rainfall

std::vector<double> openswmm::GageData::rainfall

Current rainfall rate (project length/time units — inches or mm/hr).

See also
Legacy: Gage[i].rainfall

◆ scale_factor

std::vector<double> openswmm::GageData::scale_factor

Rainfall scaling factor (1.0 = no scaling).

Multiplies the gage's converted rainfall intensity after the rain-type conversion (INTENSITY/VOLUME/CUMULATIVE) and unit conversion. For co-gages sharing a timeseries, the secondary gage's rainfall is scaled by scale_factor[secondary] / scale_factor[primary] so the primary's already-applied factor is removed and the secondary's substituted.

See also
Legacy: Gage[i].scaleFactor (Build 5.3.0+)

◆ snow_factor

std::vector<double> openswmm::GageData::snow_factor

Snow catch deficiency correction factor (1.0 = no correction).

See also
Legacy: Gage[i].snowFactor

◆ source

std::vector<RainSource> openswmm::GageData::source

Precipitation source (TIMESERIES or FILE).

◆ station_id

std::vector<std::string> openswmm::GageData::station_id

Station ID for a standard SWMM rain file (when source == FILE_RAIN).

The [RAINGAGES] FILE grammar is Name Format Interval SCF FILE Fname Station Units [Start] [SCF]. A single rain file may hold many stations; this ID selects the rows whose first token matches. Empty means "accept all rows".

See also
Legacy: Gage[i].staID

◆ ts_index

std::vector<int> openswmm::GageData::ts_index

Time series index (when source == TIMESERIES).

See also
Legacy: Gage[i].tSeries

◆ ts_name

std::vector<std::string> openswmm::GageData::ts_name

Timeseries name (for deferred resolution when TS parsed after gages).


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