![]() |
OpenSWMM Engine
6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
|
Structure-of-Arrays storage for all subcatchments. More...
#include <SubcatchData.hpp>
Public Member Functions | |
| void | resize_total_load (int n_sc, int n_poll) |
| void | resize_coverage (int n_sc, int n_lu) |
| Resize the coverage and sweep matrices. | |
| int | count () const noexcept |
| void | resize (int n) |
| void | grow_to (int n) |
Grow all arrays to hold at least n subcatchments, preserving existing data. | |
| void | erase_at (int idx) |
Erase the subcatchment at index idx from every parallel array. | |
| void | resize_quality (int n_pollutants) |
| Resize per-subcatch quality arrays after pollutant count is known. | |
| void | resize_washoff_load (int n_pollutants) |
| void | shrink_to_fit () |
| Release excess vector capacity accumulated during parsing. | |
| void | save_state () noexcept |
| void | reset_state () noexcept |
Public Attributes | |
| std::vector< int > | outlet_node |
| Index of the drain-to node or subcatchment. | |
| std::vector< int > | outlet_subcatch |
| Index of the subcatch that receives overflow (-1 if none). | |
| std::vector< std::string > | outlet_name |
| Outlet name string for deferred resolution. | |
| std::vector< int > | gage |
| Rain gage index for this subcatchment. | |
| std::vector< double > | area |
| Subcatchment area (project area units). | |
| std::vector< double > | width |
| Width of overland flow path (project length units). | |
| std::vector< double > | slope |
| Average slope of catchment (fraction). | |
| std::vector< double > | curb_length |
| Total curb length (project length units). | |
| std::vector< double > | frac_imperv |
| Fraction of area that is impervious (0–1). | |
| std::vector< double > | frac_imperv_no_store |
| Fraction of impervious area with no depression storage (0–1). | |
| std::vector< double > | n_imperv |
| Manning's n for impervious area. | |
| std::vector< double > | n_perv |
| Manning's n for pervious area. | |
| std::vector< double > | ds_imperv |
| Depression storage depth for impervious area (project length units). | |
| std::vector< double > | ds_perv |
| Depression storage depth for pervious area (project length units). | |
| std::vector< int > | subarea_routing |
| Inter-subarea routing mode. | |
| std::vector< double > | pct_routed |
| Fraction of runoff routed between subareas (0–1). | |
| std::vector< int > | infil_model |
| Infiltration model: 0=HORTON, 1=MOD_HORTON, 2=GREEN_AMPT, 3=MOD_GREEN_AMPT, 4=CURVE_NUMBER. | |
| std::vector< double > | infil_p1 |
| Infiltration param 1: f0 (Horton), suction (GA), CN (CN). | |
| std::vector< double > | infil_p2 |
| Infiltration param 2: fmin (Horton), conductivity (GA), 0 (CN). | |
| std::vector< double > | infil_p3 |
| Infiltration param 3: decay (Horton), initial deficit (GA), 0 (CN). | |
| std::vector< double > | infil_p4 |
| Infiltration param 4: dry time (Horton), 0 (GA/CN). | |
| std::vector< double > | infil_p5 |
| Infiltration param 5: max infil (Horton), 0 (GA/CN). | |
| std::vector< double > | runoff |
| Current total runoff flow rate (project flow units). | |
| std::vector< double > | rainfall |
| Current total rainfall depth rate (project length/time units). | |
| std::vector< double > | evap_loss |
| Current evaporation loss rate (project length/time units). | |
| std::vector< double > | infil_loss |
| Current infiltration loss rate (project length/time units). | |
| std::vector< double > | ponded_depth |
| Current total ponded depth over subcatchment (project length units). | |
| std::vector< double > | gw_flow |
| Groundwater outflow rate (project flow units). | |
| std::vector< double > | old_runoff |
| Runoff at the previous timestep. | |
| std::vector< double > | old_gw_flow |
| GW flow at the previous runoff evaluation (for interpolation). | |
| std::vector< double > | runon_inflow |
| Runoff inflow from upstream subcatchments (project flow units). | |
| std::vector< double > | old_runon_inflow |
| Previous-step runon inflow (for interpolation). | |
| std::vector< double > | outfall_runon_vol |
| Gap #28: accumulated outfall-routed volume (ft³) between runoff steps. | |
| std::vector< double > | gw_sw_head |
| Surface water head at GW receiving node (project length units). | |
| std::vector< double > | gw_node_avail_flow |
| Available node flow for GW negative flow limit (cfs/ft2). | |
| std::vector< double > | gw_max_infil_vol |
| Gap #40: max infiltration volume (ft) upper GW zone can accept next step. | |
| std::vector< double > | washoff_load |
| Washoff mass rate per (subcatch, pollutant) (mass/sec). | |
| std::vector< double > | conc |
| Current quality concentration in subcatchment runoff. | |
| std::vector< double > | conc_old |
| Previous-step quality in subcatchment runoff. | |
| std::vector< double > | ponded_qual |
| Ponded surface water quality mass per (subcatch, pollutant). | |
| int | conc_n_pollutants = 0 |
| Number of pollutants in the quality arrays. | |
| std::vector< std::string > | comments |
| Object comment from the INP file (';'-prefixed lines immediately above this subcatchment's data row), joined by literal "\\n". Empty string means no comment. | |
| std::vector< std::string > | tags |
Per-object tag from the INP [TAGS] section. | |
| std::vector< char > | rpt_flag |
| Whether this subcatchment is included in report/output (0=no, 1=yes). | |
| std::vector< double > | stat_precip_vol |
| Total precipitation volume (project volume units). | |
| std::vector< double > | stat_evap_vol |
| Cumulative evaporation volume (ft3) | |
| std::vector< double > | stat_infil_vol |
| Cumulative infiltration volume (ft3) | |
| std::vector< double > | stat_imperv_vol |
| Cumulative impervious runoff volume (ft3) | |
| std::vector< double > | stat_perv_vol |
| Cumulative pervious runoff volume (ft3) | |
| std::vector< double > | stat_runoff_vol |
| Total runoff volume (project volume units). | |
| std::vector< double > | stat_max_runoff |
| Maximum reported runoff rate (project flow units). | |
| std::vector< double > | stat_gw_infil_vol |
| Cumulative infiltration to GW (ft³) | |
| std::vector< double > | stat_gw_upper_evap_vol |
| Cumulative upper zone evap (ft³) | |
| std::vector< double > | stat_gw_lower_evap_vol |
| Cumulative lower zone evap (ft³) | |
| std::vector< double > | stat_gw_deep_perc_vol |
| Cumulative deep percolation (ft³) | |
| std::vector< double > | stat_gw_flow_vol |
| Cumulative lateral GW outflow (ft³) | |
| std::vector< double > | stat_gw_max_flow |
| Peak lateral GW outflow (CFS) | |
| std::vector< double > | stat_gw_sum_theta |
| Sum of upper-zone theta (for time-avg) | |
| std::vector< double > | stat_gw_sum_depth |
| Sum of water table height (ft, for time-avg) | |
| std::vector< double > | stat_gw_final_theta |
| Upper-zone theta at last GW step. | |
| std::vector< double > | stat_gw_final_depth |
| Water table height at last GW step (ft) | |
| std::vector< long > | stat_gw_steps |
| Step count for GW averages. | |
| std::vector< int > | gw_aquifer |
| Aquifer index for this subcatchment (-1 = none). | |
| std::vector< int > | gw_node |
| Receiving node index for groundwater flow (-1 = none). | |
| std::vector< double > | gw_surf_elev |
| Surface elevation for groundwater calculations. | |
| std::vector< double > | gw_a1 |
| Groundwater flow coefficient A1. | |
| std::vector< double > | gw_b1 |
| Groundwater flow exponent B1. | |
| std::vector< double > | gw_a2 |
| Groundwater flow coefficient A2. | |
| std::vector< double > | gw_b2 |
| Groundwater flow exponent B2. | |
| std::vector< double > | gw_a3 |
| Groundwater flow coefficient A3. | |
| std::vector< double > | gw_tw |
| Threshold groundwater table elevation. | |
| std::vector< double > | gw_hstar |
| Water table elevation at which lateral GW flow ceases. | |
| std::vector< int > | snowpack |
| Snowpack index for this subcatchment (-1 = none). | |
| std::vector< double > | snow_net_imperv |
| Snow-modified net precipitation for impervious subareas (ft/sec). | |
| std::vector< double > | snow_net_perv |
| Snow-modified net precipitation for pervious subarea (ft/sec). | |
| std::vector< double > | total_lid_area_ft2 |
| Total LID area for this subcatchment (ft²). | |
| std::vector< double > | lid_return_to_perv_cfs |
| LID surface return flow to pervious area (CFS). | |
| std::vector< double > | lid_drain_runon_cfs |
| LID drain flow routed to a target subcatchment (CFS). | |
| std::vector< double > | total_load |
| Total washoff load per (subcatchment x pollutant) (mass units). | |
| int | total_load_n_pollutants = 0 |
| Number of pollutants in total_load matrix. | |
| std::vector< double > | coverage |
| Coverage fraction per (subcatchment x landuse). | |
| int | coverage_n_landuses = 0 |
| Number of landuses stored in the coverage and sweep matrices. | |
| std::vector< double > | sweep_last_swept |
| Gap #34: days since last swept per (subcatch x landuse). | |
Structure-of-Arrays storage for all subcatchments.
Pollutant-related arrays are stored separately in PollutantData, indexed as [subcatch_idx * n_pollutants + pollutant_idx].
|
inlinenoexcept |
|
inline |
Erase the subcatchment at index idx from every parallel array.
Removes element idx from every SoA vector. Flat-2D arrays (conc/ponded_qual/washoff_load, coverage/sweep, total_load) have their full stride for idx removed. Spatial arrays are erased separately by ObjectDeleter.
|
inline |
Grow all arrays to hold at least n subcatchments, preserving existing data.
|
inlinenoexcept |
|
inline |
|
inline |
Resize the coverage and sweep matrices.
| n_sc | Number of subcatchments. |
| n_lu | Number of landuses. |
|
inline |
Resize per-subcatch quality arrays after pollutant count is known.
|
inline |
|
inline |
|
inlinenoexcept |
|
inline |
Release excess vector capacity accumulated during parsing.
| std::vector<double> openswmm::SubcatchData::area |
| std::vector<std::string> openswmm::SubcatchData::comments |
Object comment from the INP file (';'-prefixed lines immediately above this subcatchment's data row), joined by literal "\\n". Empty string means no comment.
| std::vector<double> openswmm::SubcatchData::conc |
Current quality concentration in subcatchment runoff.
Size = n_subcatches * n_pollutants.
| int openswmm::SubcatchData::conc_n_pollutants = 0 |
Number of pollutants in the quality arrays.
| std::vector<double> openswmm::SubcatchData::conc_old |
Previous-step quality in subcatchment runoff.
| std::vector<double> openswmm::SubcatchData::coverage |
Coverage fraction per (subcatchment x landuse).
Indexed as [sc_idx * n_landuses + lu_idx]. Values are 0–1.
| int openswmm::SubcatchData::coverage_n_landuses = 0 |
Number of landuses stored in the coverage and sweep matrices.
| std::vector<double> openswmm::SubcatchData::curb_length |
Total curb length (project length units).
| std::vector<double> openswmm::SubcatchData::ds_imperv |
| std::vector<double> openswmm::SubcatchData::ds_perv |
| std::vector<double> openswmm::SubcatchData::evap_loss |
Current evaporation loss rate (project length/time units).
| std::vector<double> openswmm::SubcatchData::frac_imperv |
Fraction of area that is impervious (0–1).
| std::vector<double> openswmm::SubcatchData::frac_imperv_no_store |
Fraction of impervious area with no depression storage (0–1).
| std::vector<int> openswmm::SubcatchData::gage |
| std::vector<double> openswmm::SubcatchData::gw_a1 |
Groundwater flow coefficient A1.
| std::vector<double> openswmm::SubcatchData::gw_a2 |
Groundwater flow coefficient A2.
| std::vector<double> openswmm::SubcatchData::gw_a3 |
Groundwater flow coefficient A3.
| std::vector<int> openswmm::SubcatchData::gw_aquifer |
Aquifer index for this subcatchment (-1 = none).
| std::vector<double> openswmm::SubcatchData::gw_b1 |
Groundwater flow exponent B1.
| std::vector<double> openswmm::SubcatchData::gw_b2 |
Groundwater flow exponent B2.
| std::vector<double> openswmm::SubcatchData::gw_flow |
Groundwater outflow rate (project flow units).
| std::vector<double> openswmm::SubcatchData::gw_hstar |
Water table elevation at which lateral GW flow ceases.
| std::vector<double> openswmm::SubcatchData::gw_max_infil_vol |
Gap #40: max infiltration volume (ft) upper GW zone can accept next step.
= (total_depth - lower_depth) * (porosity - theta) / frac_perv. Updated after each GW step; used by Runoff to cap infil rate (vol/dt). DBL_MAX (no constraint) when no GW is active.
| std::vector<int> openswmm::SubcatchData::gw_node |
Receiving node index for groundwater flow (-1 = none).
| std::vector<double> openswmm::SubcatchData::gw_node_avail_flow |
Available node flow for GW negative flow limit (cfs/ft2).
| std::vector<double> openswmm::SubcatchData::gw_surf_elev |
Surface elevation for groundwater calculations.
| std::vector<double> openswmm::SubcatchData::gw_sw_head |
Surface water head at GW receiving node (project length units).
Assembled from nodes.depth + nodes.invert_elev - aquifer bottom.
| std::vector<double> openswmm::SubcatchData::gw_tw |
Threshold groundwater table elevation.
| std::vector<double> openswmm::SubcatchData::infil_loss |
Current infiltration loss rate (project length/time units).
| std::vector<int> openswmm::SubcatchData::infil_model |
Infiltration model: 0=HORTON, 1=MOD_HORTON, 2=GREEN_AMPT, 3=MOD_GREEN_AMPT, 4=CURVE_NUMBER.
| std::vector<double> openswmm::SubcatchData::infil_p1 |
Infiltration param 1: f0 (Horton), suction (GA), CN (CN).
| std::vector<double> openswmm::SubcatchData::infil_p2 |
Infiltration param 2: fmin (Horton), conductivity (GA), 0 (CN).
| std::vector<double> openswmm::SubcatchData::infil_p3 |
Infiltration param 3: decay (Horton), initial deficit (GA), 0 (CN).
| std::vector<double> openswmm::SubcatchData::infil_p4 |
Infiltration param 4: dry time (Horton), 0 (GA/CN).
| std::vector<double> openswmm::SubcatchData::infil_p5 |
Infiltration param 5: max infil (Horton), 0 (GA/CN).
| std::vector<double> openswmm::SubcatchData::lid_drain_runon_cfs |
LID drain flow routed to a target subcatchment (CFS).
Accumulated each runoff step when drain_subcatch >= 0. Drained into runon_inflow[] by assembleRunon() (after the clear), then reset, so the drain reaches the target as runon next step. Matches legacy lid_addDrainRunon() in lid.c.
| std::vector<double> openswmm::SubcatchData::lid_return_to_perv_cfs |
LID surface return flow to pervious area (CFS).
Set by LIDSolver output routing when to_perv==1. Consumed by RunoffSolver as additional pervious-subarea inflow next step. Matches legacy lid_getFlowToPerv() called in subcatch_getRunon().
| std::vector<double> openswmm::SubcatchData::n_imperv |
| std::vector<double> openswmm::SubcatchData::n_perv |
| std::vector<double> openswmm::SubcatchData::old_gw_flow |
GW flow at the previous runoff evaluation (for interpolation).
| std::vector<double> openswmm::SubcatchData::old_runoff |
Runoff at the previous timestep.
| std::vector<double> openswmm::SubcatchData::old_runon_inflow |
Previous-step runon inflow (for interpolation).
| std::vector<double> openswmm::SubcatchData::outfall_runon_vol |
Gap #28: accumulated outfall-routed volume (ft³) between runoff steps.
Matches legacy Outfall[i].vRouted. Drained to runon_inflow at each assembleRunon() call, then reset to 0.
| std::vector<std::string> openswmm::SubcatchData::outlet_name |
Outlet name string for deferred resolution.
Stored during parsing so PostParseResolver can re-resolve outlet_node / outlet_subcatch when sections appear out of order.
| std::vector<int> openswmm::SubcatchData::outlet_node |
| std::vector<int> openswmm::SubcatchData::outlet_subcatch |
Index of the subcatch that receives overflow (-1 if none).
| std::vector<double> openswmm::SubcatchData::pct_routed |
Fraction of runoff routed between subareas (0–1).
The remainder (1 - pct_routed) goes to the outlet. fOutlet = 1 - pct_routed for the routed subarea.
| std::vector<double> openswmm::SubcatchData::ponded_depth |
Current total ponded depth over subcatchment (project length units).
| std::vector<double> openswmm::SubcatchData::ponded_qual |
Ponded surface water quality mass per (subcatch, pollutant).
Persists between wet/dry events. Updated each timestep as: wPonded = pondedQual + rain_deposition + runon_load cPonded = wPonded / V_inflow pondedQual_new = cPonded * ponded_depth * non_lid_area
| std::vector<double> openswmm::SubcatchData::rainfall |
| std::vector<char> openswmm::SubcatchData::rpt_flag |
Whether this subcatchment is included in report/output (0=no, 1=yes).
| std::vector<double> openswmm::SubcatchData::runoff |
Current total runoff flow rate (project flow units).
| std::vector<double> openswmm::SubcatchData::runon_inflow |
Runoff inflow from upstream subcatchments (project flow units).
Assembled by assembleRunon(); zero if no upstream subcatch.
| std::vector<double> openswmm::SubcatchData::slope |
| std::vector<double> openswmm::SubcatchData::snow_net_imperv |
Snow-modified net precipitation for impervious subareas (ft/sec).
Set by SWMMEngine after each snow execute step. Combines plowable + non-plowable imperv: imelt + rainfall*(1-asc). -1.0 means no snowpack active (use raw rainfall instead).
| std::vector<double> openswmm::SubcatchData::snow_net_perv |
| std::vector<int> openswmm::SubcatchData::snowpack |
Snowpack index for this subcatchment (-1 = none).
| std::vector<double> openswmm::SubcatchData::stat_evap_vol |
Cumulative evaporation volume (ft3)
| std::vector<double> openswmm::SubcatchData::stat_gw_deep_perc_vol |
Cumulative deep percolation (ft³)
| std::vector<double> openswmm::SubcatchData::stat_gw_final_depth |
Water table height at last GW step (ft)
| std::vector<double> openswmm::SubcatchData::stat_gw_final_theta |
Upper-zone theta at last GW step.
| std::vector<double> openswmm::SubcatchData::stat_gw_flow_vol |
Cumulative lateral GW outflow (ft³)
| std::vector<double> openswmm::SubcatchData::stat_gw_infil_vol |
Cumulative infiltration to GW (ft³)
| std::vector<double> openswmm::SubcatchData::stat_gw_lower_evap_vol |
Cumulative lower zone evap (ft³)
| std::vector<double> openswmm::SubcatchData::stat_gw_max_flow |
Peak lateral GW outflow (CFS)
| std::vector<long> openswmm::SubcatchData::stat_gw_steps |
Step count for GW averages.
| std::vector<double> openswmm::SubcatchData::stat_gw_sum_depth |
Sum of water table height (ft, for time-avg)
| std::vector<double> openswmm::SubcatchData::stat_gw_sum_theta |
Sum of upper-zone theta (for time-avg)
| std::vector<double> openswmm::SubcatchData::stat_gw_upper_evap_vol |
Cumulative upper zone evap (ft³)
| std::vector<double> openswmm::SubcatchData::stat_imperv_vol |
Cumulative impervious runoff volume (ft3)
| std::vector<double> openswmm::SubcatchData::stat_infil_vol |
Cumulative infiltration volume (ft3)
| std::vector<double> openswmm::SubcatchData::stat_max_runoff |
Maximum reported runoff rate (project flow units).
| std::vector<double> openswmm::SubcatchData::stat_perv_vol |
Cumulative pervious runoff volume (ft3)
| std::vector<double> openswmm::SubcatchData::stat_precip_vol |
Total precipitation volume (project volume units).
| std::vector<double> openswmm::SubcatchData::stat_runoff_vol |
Total runoff volume (project volume units).
| std::vector<int> openswmm::SubcatchData::subarea_routing |
Inter-subarea routing mode.
0 = TO_OUTLET (all runoff goes to outlet), 1 = TO_IMPERV (pervious → impervious), 2 = TO_PERV (impervious → pervious).
| std::vector<double> openswmm::SubcatchData::sweep_last_swept |
Gap #34: days since last swept per (subcatch x landuse).
Flat 2D: [sc_idx * n_landuses + lu_idx]. Matches legacy Subcatch[i].landFactor[j].lastSwept. Per-(subcatch,landuse) tracking so each subcatchment sweeps independently on its own schedule.
| std::vector<std::string> openswmm::SubcatchData::tags |
Per-object tag from the INP [TAGS] section.
Free-form string label. Index-keyed so swmm_subcatch_rename keeps the tag attached.
| std::vector<double> openswmm::SubcatchData::total_lid_area_ft2 |
| std::vector<double> openswmm::SubcatchData::total_load |
Total washoff load per (subcatchment x pollutant) (mass units).
| int openswmm::SubcatchData::total_load_n_pollutants = 0 |
Number of pollutants in total_load matrix.
| std::vector<double> openswmm::SubcatchData::washoff_load |
Washoff mass rate per (subcatch, pollutant) (mass/sec).
Flat 2D: [subcatch * n_pollutants + pollutant].
| std::vector<double> openswmm::SubcatchData::width |