![]() |
OpenSWMM Engine
6.0.0-alpha.3
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.3)
|
Structure-of-Arrays storage for all rain gages. More...
#include <GageData.hpp>
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< RainSource > | source |
| Precipitation source (TIMESERIES or FILE). | |
| std::vector< int > | ts_index |
| Time series index (when source == TIMESERIES). | |
| std::vector< FilePathPair > | file_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< Table > | rain_series |
| Resolved rainfall series for a FILE_RAIN gage (windowed to the run). | |
| std::vector< RainFileFormat > | file_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. | |
Structure-of-Arrays storage for all rain gages.
The col_name field supports the new multi-column CSV format (R08):
|
inlinenoexcept |
|
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.
|
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.
|
inlinenoexcept |
|
inline |
|
inline |
Release excess vector capacity accumulated during parsing.
| std::vector<double> openswmm::GageData::api_rainfall |
Current API (antecedent precipitation index) rainfall.
| 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.
| 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.
| 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.
| 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.
| std::vector<double> openswmm::GageData::file_first_date |
First record date found for this gage's station (OADate, 0 = none).
| std::vector<RainFileFormat> openswmm::GageData::file_format |
Rain file format.
| std::vector<double> openswmm::GageData::file_last_date |
Last record date found for this gage's station (OADate, 0 = none).
| 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.
| std::vector<long> openswmm::GageData::file_periods_precip |
Number of records with precipitation > 0 for this station.
| std::vector<int> openswmm::GageData::interval_sec |
Recording interval in seconds.
| std::vector<bool> openswmm::GageData::is_raining |
Current state flag (0 = no rain, 1 = raining).
|
staticconstexpr |
Max past hours tracked per gage.
| std::vector<double> openswmm::GageData::next_rain_date |
Simulation time of the next recorded value (decimal days).
| std::vector<double> openswmm::GageData::next_rainfall |
Rainfall rate at the next recorded interval (for interpolation).
| std::vector<double> openswmm::GageData::past_rain |
Flat 2D: [gage * MAXPASTRAIN + hour]. Hourly rain totals.
| std::vector<double> openswmm::GageData::past_rain_accum |
Per-gage accumulator for the current partial hour.
| std::vector<double> openswmm::GageData::past_rain_time |
Per-gage time (seconds) of last past-rain shift.
| 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.
| std::vector<int> openswmm::GageData::rain_type |
Rain data type: 0=INTENSITY, 1=VOLUME, 2=CUMULATIVE.
| 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.
| std::vector<double> openswmm::GageData::rainfall |
| 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.
| std::vector<double> openswmm::GageData::snow_factor |
Snow catch deficiency correction factor (1.0 = no correction).
| std::vector<RainSource> openswmm::GageData::source |
Precipitation source (TIMESERIES or FILE).
| 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".
| std::vector<int> openswmm::GageData::ts_index |
Time series index (when source == TIMESERIES).
| std::vector<std::string> openswmm::GageData::ts_name |
Timeseries name (for deferred resolution when TS parsed after gages).