34#ifndef OPENSWMM_ENGINE_SUBCATCH_DATA_HPP
35#define OPENSWMM_ENGINE_SUBCATCH_DATA_HPP
693 total_load.assign(
static_cast<std::size_t
>(n_sc) *
static_cast<std::size_t
>(n_poll), 0.0);
732 auto sz =
static_cast<std::size_t
>(n_sc) *
static_cast<std::size_t
>(n_lu);
746 int count() const noexcept {
return static_cast<int>(
area.size()); }
761 const auto un =
static_cast<std::size_t
>(n);
769 area.assign(un, 0.0);
770 width.assign(un, 0.0);
771 slope.assign(un, 0.0);
816 tags.assign(un, std::string{});
844 gw_a1.assign(un, 0.0);
845 gw_b1.assign(un, 0.0);
846 gw_a2.assign(un, 0.0);
847 gw_b2.assign(un, 0.0);
848 gw_a3.assign(un, 0.0);
849 gw_tw.assign(un, 0.0);
878 const auto un =
static_cast<std::size_t
>(n);
879 auto g = [&](
auto& vec,
auto def) { vec.resize(un, def); };
930 tags.resize(un, std::string{});
1004 const auto un =
static_cast<std::size_t
>(n);
1007 auto r = [&](
auto& vec) { vec.reserve(un); };
1114 const auto ui =
static_cast<std::size_t
>(idx);
1115 auto e = [&](
auto& v) {
1117 v.erase(v.begin() +
static_cast<std::ptrdiff_t
>(idx));
1219 const auto base = ui * np;
1220 auto erase2d = [&](
auto& v) {
1221 if (base + np <= v.size())
1222 v.erase(v.begin() +
static_cast<std::ptrdiff_t
>(base),
1223 v.begin() +
static_cast<std::ptrdiff_t
>(base + np));
1237 const auto base = ui * np;
1240 total_load.begin() +
static_cast<std::ptrdiff_t
>(base + np));
1246 const auto base = ui * nlu;
1247 auto erase2d = [&](
auto& v) {
1248 if (base + nlu <= v.size())
1249 v.erase(v.begin() +
static_cast<std::ptrdiff_t
>(base),
1250 v.begin() +
static_cast<std::ptrdiff_t
>(base + nlu));
1270 if (n_pollutants > 0) {
1271 auto total =
static_cast<std::size_t
>(
count()) *
static_cast<std::size_t
>(n_pollutants);
1272 conc.assign(total, 0.0);
1291 if (n_pollutants > 0) {
1293 static_cast<std::size_t
>(
count()) *
static_cast<std::size_t
>(n_pollutants), 0.0);
1304 gage.shrink_to_fit();
1305 area.shrink_to_fit();
1306 width.shrink_to_fit();
1307 slope.shrink_to_fit();
1350 tags.shrink_to_fit();
1367 gw_a1.shrink_to_fit();
1368 gw_b1.shrink_to_fit();
1369 gw_a2.shrink_to_fit();
1370 gw_b2.shrink_to_fit();
1371 gw_a3.shrink_to_fit();
1372 gw_tw.shrink_to_fit();
1385 conc.shrink_to_fit();
1442 std::fill(
conc.begin(),
conc.end(), 0.0);
Definition ExchangeLaw.hpp:60
Structure-of-Arrays storage for all subcatchments.
Definition SubcatchData.hpp:57
std::vector< int > gage
Rain gage index for this subcatchment.
Definition SubcatchData.hpp:106
std::vector< double > total_lid_area_ft2
Total LID area for this subcatchment (ft²).
Definition SubcatchData.hpp:647
void reset_state() noexcept
Clear the subcatchment dynamic arrays visited here.
Definition SubcatchData.hpp:1418
std::vector< int > infil_model
Infiltration model: 0=HORTON, 1=MOD_HORTON, 2=GREEN_AMPT, 3=MOD_GREEN_AMPT, 4=CURVE_NUMBER.
Definition SubcatchData.hpp:235
std::vector< double > old_snow_depth
Snow depth at the previous runoff evaluation (for interpolation).
Definition SubcatchData.hpp:333
std::vector< double > gw_b2
Groundwater flow exponent B2.
Definition SubcatchData.hpp:548
std::vector< double > snow_net_perv
Snow-modified net precipitation for pervious subarea (ft/sec).
Definition SubcatchData.hpp:596
std::vector< double > stat_gw_infil_vol
Cumulative infiltration to GW (ft³)
Definition SubcatchData.hpp:513
std::vector< std::string > snowpack_name
Snow pack name string for deferred resolution.
Definition SubcatchData.hpp:91
std::vector< double > stat_runon_vol
Cumulative received runon volume (ft3).
Definition SubcatchData.hpp:493
int total_load_n_pollutants
Number of pollutants in total_load matrix.
Definition SubcatchData.hpp:679
std::vector< double > outfall_runon_vol
Gap #28: accumulated outfall-routed volume (ft³) between runoff steps.
Definition SubcatchData.hpp:360
std::vector< double > stat_precip_vol
Total precipitation volume (project volume units).
Definition SubcatchData.hpp:492
std::vector< double > gw_surf_elev
Surface elevation for groundwater calculations.
Definition SubcatchData.hpp:536
std::vector< double > gw_sw_head
Surface water head at GW receiving node (project length units).
Definition SubcatchData.hpp:368
std::vector< double > init_loading
The [LOADINGS] initial surface buildup, mass per unit AREA.
Definition SubcatchData.hpp:452
void resize_quality(int n_pollutants)
Set the pollutant stride and replace positive-sized quality arrays.
Definition SubcatchData.hpp:1268
std::vector< double > slope
Average slope of catchment (fraction).
Definition SubcatchData.hpp:124
std::vector< double > infil_p1
Infiltration param 1: f0 (Horton), suction (GA), CN (CN).
Definition SubcatchData.hpp:238
std::vector< double > old_gw_flow
GW flow at the previous runoff evaluation (for interpolation).
Definition SubcatchData.hpp:330
std::vector< int > snowpack
Snowpack index for this subcatchment (-1 = none).
Definition SubcatchData.hpp:578
std::vector< std::string > gage_name
Rain gage name string for deferred resolution.
Definition SubcatchData.hpp:100
std::vector< double > gw_tw
[GROUNDWATER] Dsw: fixed surface-water depth (project length units, 0 = live node depth).
Definition SubcatchData.hpp:554
std::vector< double > old_ponded_depth
Ponded depth at the START of the runoff step (project length).
Definition SubcatchData.hpp:291
std::vector< double > evap_loss
Current evaporation loss rate (project length/time units).
Definition SubcatchData.hpp:268
std::vector< double > gw_wt_elev
[GROUNDWATER] Wgw: initial water-table elevation override; MISSING = the aquifer's.
Definition SubcatchData.hpp:568
std::vector< double > old_runoff
Runoff at the previous timestep.
Definition SubcatchData.hpp:327
std::vector< double > gw_node_avail_flow
Available node flow for GW negative flow limit (cfs/ft2).
Definition SubcatchData.hpp:371
std::vector< double > stat_infil_vol
Cumulative infiltration volume (ft3)
Definition SubcatchData.hpp:496
std::vector< double > gw_flow
Groundwater outflow rate (project flow units).
Definition SubcatchData.hpp:308
std::vector< double > stat_evap_vol
Cumulative evaporation volume (ft3)
Definition SubcatchData.hpp:495
std::vector< double > lid_drain_flow
Total LID drain outflow (cfs) over the current runoff step.
Definition SubcatchData.hpp:320
std::vector< double > stat_gw_sum_theta
Time integral of upper-zone theta (seconds)
Definition SubcatchData.hpp:519
std::vector< unsigned char > sweep_now
Definition SubcatchData.hpp:718
std::vector< double > snow_melt_imperv
The MELT-ONLY part of snow_net_imperv (ft/sec).
Definition SubcatchData.hpp:617
std::vector< double > stat_perv_vol
Cumulative pervious runoff volume (ft3)
Definition SubcatchData.hpp:498
std::vector< double > snow_scale_factor
Subcatchment-level snowfall scale factor (default 1.0 = no scaling).
Definition SubcatchData.hpp:156
void reserve_to(int n)
Reserve capacity for n subcatchments without changing count().
Definition SubcatchData.hpp:1001
std::vector< double > area
Subcatchment area (project area units).
Definition SubcatchData.hpp:112
std::vector< double > gw_a3
Groundwater flow coefficient A3.
Definition SubcatchData.hpp:551
std::vector< double > old_lid_drain_flow
LID drain outflow at the previous runoff evaluation (for interpolation).
Definition SubcatchData.hpp:336
std::vector< int > outlet_subcatch
Index of the subcatch that receives overflow (-1 if none).
Definition SubcatchData.hpp:75
std::vector< double > gw_hstar
[GROUNDWATER] Egwt: threshold groundwater table elevation (project length units) below which no later...
Definition SubcatchData.hpp:562
int coverage_n_landuses
Number of landuses stored in the coverage and sweep matrices.
Definition SubcatchData.hpp:707
std::vector< std::string > comments
Object comment from the INP file (';'-prefixed lines immediately above this subcatchment's data row),...
Definition SubcatchData.hpp:466
std::vector< double > stat_gw_upper_evap_vol
Cumulative upper zone evap (ft³)
Definition SubcatchData.hpp:514
std::vector< double > old_runon_inflow
Previous-step runon inflow (for interpolation).
Definition SubcatchData.hpp:347
std::vector< double > stat_runoff_vol
Total runoff volume (project volume units).
Definition SubcatchData.hpp:504
std::vector< double > n_imperv
Manning's n for impervious area.
Definition SubcatchData.hpp:189
std::vector< double > lid_drain_runon_cfs
LID drain flow routed to a target subcatchment (CFS).
Definition SubcatchData.hpp:666
std::vector< double > n_perv
Manning's n for pervious area.
Definition SubcatchData.hpp:195
std::vector< double > infil_p4
Infiltration param 4: dry time (Horton), 0 (GA/CN).
Definition SubcatchData.hpp:244
void resize_coverage(int n_sc, int n_lu)
Resize the coverage and sweep matrices.
Definition SubcatchData.hpp:730
std::vector< double > lid_return_to_perv_cfs
LID surface return flow to pervious area (CFS).
Definition SubcatchData.hpp:656
std::vector< std::string > tags
Per-object tag from the INP [TAGS] section.
Definition SubcatchData.hpp:474
std::vector< double > runon_qual_rate
Incoming run-on pollutant mass RATE per (subcatch, pollutant), mg/sec.
Definition SubcatchData.hpp:421
std::vector< double > runon_inflow
Runoff inflow from upstream subcatchments (project flow units).
Definition SubcatchData.hpp:344
std::vector< double > runon_rate
Legacy Subcatch.runon: the run-on as a depth rate (ft/s).
Definition SubcatchData.hpp:355
std::vector< double > rain_scale_factor
Subcatchment-level rainfall scale factor (default 1.0 = no scaling).
Definition SubcatchData.hpp:142
std::vector< double > stat_gw_final_theta
Upper-zone theta at last GW step.
Definition SubcatchData.hpp:521
std::vector< double > gw_a2
Groundwater flow coefficient A2.
Definition SubcatchData.hpp:545
std::vector< double > stat_gw_lower_evap_vol
Cumulative lower zone evap (ft³)
Definition SubcatchData.hpp:515
int conc_n_pollutants
Number of pollutants in the quality arrays.
Definition SubcatchData.hpp:455
std::vector< std::string > outlet_name
Outlet name string for deferred resolution.
Definition SubcatchData.hpp:82
std::vector< double > stat_gw_deep_perc_vol
Cumulative deep percolation (ft³)
Definition SubcatchData.hpp:516
std::vector< double > snow_melt_age_imperv
S2b — WATER AGE of the meltwater in snow_melt_imperv (sec).
Definition SubcatchData.hpp:635
std::vector< double > stat_imperv_vol
Cumulative impervious runoff volume (ft3)
Definition SubcatchData.hpp:497
std::vector< double > ponded_qual
Ponded surface water quality mass per (subcatch, pollutant).
Definition SubcatchData.hpp:409
std::vector< double > pct_routed
Fraction of runoff routed between subareas (0–1).
Definition SubcatchData.hpp:228
std::vector< double > infil_p2
Infiltration param 2: fmin (Horton), conductivity (GA), unused (CN).
Definition SubcatchData.hpp:240
std::vector< double > snow_melt_age_perv
S2b — water age of the meltwater in snow_melt_perv (sec). See above.
Definition SubcatchData.hpp:638
std::vector< double > sweep_last_date
Definition SubcatchData.hpp:723
std::vector< double > stat_gw_max_flow
Peak lateral GW outflow (CFS)
Definition SubcatchData.hpp:518
std::vector< double > gw_a1
Groundwater flow coefficient A1.
Definition SubcatchData.hpp:539
void resize(int n)
Replace the base subcatchment store with a requested row count.
Definition SubcatchData.hpp:760
std::vector< double > stat_gw_final_depth
Water table elevation at last GW step (ft)
Definition SubcatchData.hpp:522
std::vector< double > snow_net_imperv
Snow-modified net precipitation for impervious subareas (ft/sec).
Definition SubcatchData.hpp:587
std::vector< double > ds_perv
Depression storage depth for pervious area (project length units).
Definition SubcatchData.hpp:207
std::vector< double > width
Width of overland flow path (project length units).
Definition SubcatchData.hpp:118
std::vector< double > infil_loss
Current infiltration loss rate (project length/time units).
Definition SubcatchData.hpp:274
std::vector< double > lid_drain_runon_qual
Definition SubcatchData.hpp:426
std::vector< double > frac_imperv_no_store
Fraction of impervious area with no depression storage (0–1).
Definition SubcatchData.hpp:168
std::vector< double > gw_upper_moist
[GROUNDWATER] Umc: initial upper-zone moisture override; MISSING = the aquifer's.
Definition SubcatchData.hpp:571
std::vector< double > conc_old
Previous-step quality in subcatchment runoff.
Definition SubcatchData.hpp:401
int count() const noexcept
Count subcatchment rows from the area column.
Definition SubcatchData.hpp:746
void erase_at(int idx)
Erase one subcatchment row from the columns visited by this helper.
Definition SubcatchData.hpp:1113
std::vector< double > gw_max_infil_vol
Gap #40: max infiltration volume (ft) upper GW zone can accept next step.
Definition SubcatchData.hpp:379
void resize_total_load(int n_sc, int n_poll)
Replace cumulative subcatchment pollutant-load storage.
Definition SubcatchData.hpp:691
std::vector< char > rpt_flag
Whether this subcatchment is included in report/output (0=no, 1=yes).
Definition SubcatchData.hpp:482
std::vector< double > washoff_vout1
This runoff step's PRE-LID outflow volume, ft³ (legacy vOut1).
Definition SubcatchData.hpp:302
std::vector< int > gw_aquifer
Aquifer index for this subcatchment (-1 = none).
Definition SubcatchData.hpp:530
std::vector< int > outlet_node
Index of the drain-to node or subcatchment.
Definition SubcatchData.hpp:69
void grow_to(int n)
Extend base subcatchment columns while preserving existing prefixes.
Definition SubcatchData.hpp:875
std::vector< double > gw_bot_elev
[GROUNDWATER] Ebot: aquifer bottom elevation override; MISSING = the aquifer's.
Definition SubcatchData.hpp:565
std::vector< double > runoff
Current total runoff flow rate (project flow units).
Definition SubcatchData.hpp:256
void shrink_to_fit()
Release excess vector capacity accumulated during parsing.
Definition SubcatchData.hpp:1300
std::vector< double > coverage
Coverage fraction per (subcatchment x landuse).
Definition SubcatchData.hpp:704
std::vector< double > snow_depth
Area-weighted snow pack SWE depth (ft), end of runoff step.
Definition SubcatchData.hpp:314
std::vector< double > stat_max_runoff
Maximum reported runoff rate (project flow units).
Definition SubcatchData.hpp:510
std::vector< double > infil_p5
Infiltration param 5: max infil (Horton), 0 (GA/CN).
Definition SubcatchData.hpp:246
std::vector< long > stat_gw_steps
Step count for GW averages.
Definition SubcatchData.hpp:523
std::vector< double > stat_gw_time
Elapsed groundwater time (seconds).
Definition SubcatchData.hpp:494
std::vector< double > rainfall
Current total rainfall depth rate (project length/time units).
Definition SubcatchData.hpp:262
std::vector< double > washoff_load
Washoff mass rate per (subcatch, pollutant) (mass/sec).
Definition SubcatchData.hpp:387
std::vector< double > ponded_depth
Current total ponded depth over subcatchment (project length units).
Definition SubcatchData.hpp:280
void save_state() noexcept
Snapshot runoff-step discharge, run-on, concentration and ponded depth.
Definition SubcatchData.hpp:1403
std::vector< double > snow_melt_perv
The melt-only part of snow_net_perv (ft/sec). See above.
Definition SubcatchData.hpp:620
std::vector< double > frac_imperv
Fraction of area that is impervious (0–1).
Definition SubcatchData.hpp:162
std::vector< int > gw_node
Receiving node index for groundwater flow (-1 = none).
Definition SubcatchData.hpp:533
std::vector< double > gw_b1
Groundwater flow exponent B1.
Definition SubcatchData.hpp:542
std::vector< double > infil_p3
Infiltration param 3: decay (Horton), initial deficit (GA), drying time (CN).
Definition SubcatchData.hpp:242
std::vector< double > sweep_last_swept
Gap #34: days since last swept per (subcatch x landuse).
Definition SubcatchData.hpp:714
std::vector< double > total_load
Total washoff load per (subcatchment x pollutant) (mass units).
Definition SubcatchData.hpp:676
std::vector< double > ds_imperv
Depression storage depth for impervious area (project length units).
Definition SubcatchData.hpp:201
std::vector< int > subarea_routing
Inter-subarea routing mode.
Definition SubcatchData.hpp:220
void resize_washoff_load(int n_pollutants)
Zero the washoff-load matrix for a positive pollutant count.
Definition SubcatchData.hpp:1290
std::vector< double > stat_gw_sum_depth
Time integral of water table elevation (ft-seconds)
Definition SubcatchData.hpp:520
std::vector< double > stat_gw_flow_vol
Cumulative lateral GW outflow (ft³)
Definition SubcatchData.hpp:517
std::vector< double > subarea_runoff_rate
Area-averaged subarea runoff RATE, ft/sec — legacy's subcatch_getRunoff return value (runoff / area).
Definition SubcatchData.hpp:438
std::vector< double > conc
Current quality concentration in subcatchment runoff.
Definition SubcatchData.hpp:398
std::vector< double > pct_zero
The AUTHORED [SUBAREAS] PctZero column, in percent.
Definition SubcatchData.hpp:183
std::vector< double > curb_length
Total curb length (project length units).
Definition SubcatchData.hpp:130