34#ifndef OPENSWMM_ENGINE_SUBCATCH_DATA_HPP
35#define OPENSWMM_ENGINE_SUBCATCH_DATA_HPP
580 static_cast<std::size_t
>(n_sc) *
static_cast<std::size_t
>(n_poll), 0.0);
610 auto sz =
static_cast<std::size_t
>(n_sc) *
static_cast<std::size_t
>(n_lu);
619 int count() const noexcept {
return static_cast<int>(
area.size()); }
622 const auto un =
static_cast<std::size_t
>(n);
630 area.assign(un, 0.0);
631 width.assign(un, 0.0);
632 slope.assign(un, 0.0);
672 tags.assign(un, std::string{});
698 gw_a1.assign(un, 0.0);
699 gw_b1.assign(un, 0.0);
700 gw_a2.assign(un, 0.0);
701 gw_b2.assign(un, 0.0);
702 gw_a3.assign(un, 0.0);
703 gw_tw.assign(un, 0.0);
721 if (n <=
count())
return;
722 const auto un =
static_cast<std::size_t
>(n);
723 auto g = [&](
auto& vec,
auto def) { vec.resize(un, def); };
747 tags.resize(un, std::string{});
797 const auto un =
static_cast<std::size_t
>(n);
799 auto r = [&](
auto& vec) { vec.reserve(un); };
833 const auto ui =
static_cast<std::size_t
>(idx);
834 auto e = [&](
auto& v) {
if (ui < v.size()) v.erase(v.begin() +
static_cast<std::ptrdiff_t
>(idx)); };
868 const auto base = ui * np;
869 auto erase2d = [&](
auto& v) {
870 if (base + np <= v.size())
871 v.erase(v.begin() +
static_cast<std::ptrdiff_t
>(base),
872 v.begin() +
static_cast<std::ptrdiff_t
>(base + np));
880 const auto base = ui * np;
883 total_load.begin() +
static_cast<std::ptrdiff_t
>(base),
884 total_load.begin() +
static_cast<std::ptrdiff_t
>(base + np));
890 const auto base = ui * nlu;
891 auto erase2d = [&](
auto& v) {
892 if (base + nlu <= v.size())
893 v.erase(v.begin() +
static_cast<std::ptrdiff_t
>(base),
894 v.begin() +
static_cast<std::ptrdiff_t
>(base + nlu));
905 if (n_pollutants > 0) {
906 auto total =
static_cast<std::size_t
>(
count()) *
907 static_cast<std::size_t
>(n_pollutants);
908 conc.assign(total, 0.0);
916 if (n_pollutants > 0) {
918 static_cast<std::size_t
>(
count()) *
919 static_cast<std::size_t
>(n_pollutants), 0.0);
930 gage.shrink_to_fit();
931 area.shrink_to_fit();
932 width.shrink_to_fit();
933 slope.shrink_to_fit();
973 tags.shrink_to_fit();
988 gw_a1.shrink_to_fit();
989 gw_b1.shrink_to_fit();
990 gw_a2.shrink_to_fit();
991 gw_b2.shrink_to_fit();
992 gw_a3.shrink_to_fit();
993 gw_tw.shrink_to_fit();
1003 conc.shrink_to_fit();
1041 std::fill(
conc.begin(),
conc.end(), 0.0);
Definition NodeCoupling.cpp:16
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:543
void reset_state() noexcept
Definition SubcatchData.hpp:1018
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:220
std::vector< double > old_snow_depth
Snow depth at the previous runoff evaluation (for interpolation).
Definition SubcatchData.hpp:296
std::vector< double > gw_b2
Groundwater flow exponent B2.
Definition SubcatchData.hpp:458
std::vector< double > snow_net_perv
Snow-modified net precipitation for pervious subarea (ft/sec).
Definition SubcatchData.hpp:492
std::vector< double > stat_gw_infil_vol
Cumulative infiltration to GW (ft³)
Definition SubcatchData.hpp:423
std::vector< std::string > snowpack_name
Snow pack name string for deferred resolution.
Definition SubcatchData.hpp:91
int total_load_n_pollutants
Number of pollutants in total_load matrix.
Definition SubcatchData.hpp:575
std::vector< double > outfall_runon_vol
Gap #28: accumulated outfall-routed volume (ft³) between runoff steps.
Definition SubcatchData.hpp:315
std::vector< double > stat_precip_vol
Total precipitation volume (project volume units).
Definition SubcatchData.hpp:404
std::vector< double > gw_surf_elev
Surface elevation for groundwater calculations.
Definition SubcatchData.hpp:446
std::vector< double > gw_sw_head
Surface water head at GW receiving node (project length units).
Definition SubcatchData.hpp:323
void resize_quality(int n_pollutants)
Resize per-subcatch quality arrays after pollutant count is known.
Definition SubcatchData.hpp:903
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:223
std::vector< double > old_gw_flow
GW flow at the previous runoff evaluation (for interpolation).
Definition SubcatchData.hpp:293
std::vector< int > snowpack
Snowpack index for this subcatchment (-1 = none).
Definition SubcatchData.hpp:474
std::vector< std::string > gage_name
Rain gage name string for deferred resolution.
Definition SubcatchData.hpp:100
std::vector< double > gw_tw
Threshold groundwater table elevation.
Definition SubcatchData.hpp:464
std::vector< double > evap_loss
Current evaporation loss rate (project length/time units).
Definition SubcatchData.hpp:253
std::vector< double > old_runoff
Runoff at the previous timestep.
Definition SubcatchData.hpp:290
std::vector< double > gw_node_avail_flow
Available node flow for GW negative flow limit (cfs/ft2).
Definition SubcatchData.hpp:326
std::vector< double > stat_infil_vol
Cumulative infiltration volume (ft3)
Definition SubcatchData.hpp:406
std::vector< double > gw_flow
Groundwater outflow rate (project flow units).
Definition SubcatchData.hpp:271
std::vector< double > stat_evap_vol
Cumulative evaporation volume (ft3)
Definition SubcatchData.hpp:405
std::vector< double > lid_drain_flow
Total LID drain outflow (cfs) over the current runoff step.
Definition SubcatchData.hpp:283
std::vector< double > stat_gw_sum_theta
Sum of upper-zone theta (for time-avg)
Definition SubcatchData.hpp:429
std::vector< double > snow_melt_imperv
The MELT-ONLY part of snow_net_imperv (ft/sec).
Definition SubcatchData.hpp:513
std::vector< double > stat_perv_vol
Cumulative pervious runoff volume (ft3)
Definition SubcatchData.hpp:408
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:795
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:461
std::vector< double > old_lid_drain_flow
LID drain outflow at the previous runoff evaluation (for interpolation).
Definition SubcatchData.hpp:299
std::vector< int > outlet_subcatch
Index of the subcatch that receives overflow (-1 if none).
Definition SubcatchData.hpp:75
std::vector< double > gw_hstar
Water table elevation at which lateral GW flow ceases.
Definition SubcatchData.hpp:467
int coverage_n_landuses
Number of landuses stored in the coverage and sweep matrices.
Definition SubcatchData.hpp:594
std::vector< std::string > comments
Object comment from the INP file (';'-prefixed lines immediately above this subcatchment's data row),...
Definition SubcatchData.hpp:378
std::vector< double > stat_gw_upper_evap_vol
Cumulative upper zone evap (ft³)
Definition SubcatchData.hpp:424
std::vector< double > old_runon_inflow
Previous-step runon inflow (for interpolation).
Definition SubcatchData.hpp:310
std::vector< double > stat_runoff_vol
Total runoff volume (project volume units).
Definition SubcatchData.hpp:414
std::vector< double > n_imperv
Manning's n for impervious area.
Definition SubcatchData.hpp:174
std::vector< double > lid_drain_runon_cfs
LID drain flow routed to a target subcatchment (CFS).
Definition SubcatchData.hpp:562
std::vector< double > n_perv
Manning's n for pervious area.
Definition SubcatchData.hpp:180
std::vector< double > infil_p4
Infiltration param 4: dry time (Horton), 0 (GA/CN).
Definition SubcatchData.hpp:229
void resize_coverage(int n_sc, int n_lu)
Resize the coverage and sweep matrices.
Definition SubcatchData.hpp:608
std::vector< double > lid_return_to_perv_cfs
LID surface return flow to pervious area (CFS).
Definition SubcatchData.hpp:552
std::vector< std::string > tags
Per-object tag from the INP [TAGS] section.
Definition SubcatchData.hpp:386
std::vector< double > runon_inflow
Runoff inflow from upstream subcatchments (project flow units).
Definition SubcatchData.hpp:307
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:431
std::vector< double > gw_a2
Groundwater flow coefficient A2.
Definition SubcatchData.hpp:455
std::vector< double > stat_gw_lower_evap_vol
Cumulative lower zone evap (ft³)
Definition SubcatchData.hpp:425
int conc_n_pollutants
Number of pollutants in the quality arrays.
Definition SubcatchData.hpp:367
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:426
std::vector< double > snow_melt_age_imperv
S2b — WATER AGE of the meltwater in snow_melt_imperv (sec).
Definition SubcatchData.hpp:531
std::vector< double > stat_imperv_vol
Cumulative impervious runoff volume (ft3)
Definition SubcatchData.hpp:407
std::vector< double > ponded_qual
Ponded surface water quality mass per (subcatch, pollutant).
Definition SubcatchData.hpp:364
std::vector< double > pct_routed
Fraction of runoff routed between subareas (0–1).
Definition SubcatchData.hpp:213
std::vector< double > infil_p2
Infiltration param 2: fmin (Horton), conductivity (GA), unused (CN).
Definition SubcatchData.hpp:225
std::vector< double > snow_melt_age_perv
S2b — water age of the meltwater in snow_melt_perv (sec). See above.
Definition SubcatchData.hpp:534
std::vector< double > stat_gw_max_flow
Peak lateral GW outflow (CFS)
Definition SubcatchData.hpp:428
std::vector< double > gw_a1
Groundwater flow coefficient A1.
Definition SubcatchData.hpp:449
void resize(int n)
Definition SubcatchData.hpp:621
std::vector< double > stat_gw_final_depth
Water table height at last GW step (ft)
Definition SubcatchData.hpp:432
std::vector< double > snow_net_imperv
Snow-modified net precipitation for impervious subareas (ft/sec).
Definition SubcatchData.hpp:483
std::vector< double > ds_perv
Depression storage depth for pervious area (project length units).
Definition SubcatchData.hpp:192
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:259
std::vector< double > frac_imperv_no_store
Fraction of impervious area with no depression storage (0–1).
Definition SubcatchData.hpp:168
std::vector< double > conc_old
Previous-step quality in subcatchment runoff.
Definition SubcatchData.hpp:356
int count() const noexcept
Definition SubcatchData.hpp:619
void erase_at(int idx)
Erase the subcatchment at index idx from every parallel array.
Definition SubcatchData.hpp:832
std::vector< double > gw_max_infil_vol
Gap #40: max infiltration volume (ft) upper GW zone can accept next step.
Definition SubcatchData.hpp:334
void resize_total_load(int n_sc, int n_poll)
Definition SubcatchData.hpp:577
std::vector< char > rpt_flag
Whether this subcatchment is included in report/output (0=no, 1=yes).
Definition SubcatchData.hpp:394
std::vector< int > gw_aquifer
Aquifer index for this subcatchment (-1 = none).
Definition SubcatchData.hpp:440
std::vector< int > outlet_node
Index of the drain-to node or subcatchment.
Definition SubcatchData.hpp:69
void grow_to(int n)
Grow all arrays to hold at least n subcatchments, preserving existing data.
Definition SubcatchData.hpp:720
std::vector< double > runoff
Current total runoff flow rate (project flow units).
Definition SubcatchData.hpp:241
void shrink_to_fit()
Release excess vector capacity accumulated during parsing.
Definition SubcatchData.hpp:926
std::vector< double > coverage
Coverage fraction per (subcatchment x landuse).
Definition SubcatchData.hpp:591
std::vector< double > snow_depth
Area-weighted snow pack SWE depth (ft), end of runoff step.
Definition SubcatchData.hpp:277
std::vector< double > stat_max_runoff
Maximum reported runoff rate (project flow units).
Definition SubcatchData.hpp:420
std::vector< double > infil_p5
Infiltration param 5: max infil (Horton), 0 (GA/CN).
Definition SubcatchData.hpp:231
std::vector< long > stat_gw_steps
Step count for GW averages.
Definition SubcatchData.hpp:433
std::vector< double > rainfall
Current total rainfall depth rate (project length/time units).
Definition SubcatchData.hpp:247
std::vector< double > washoff_load
Washoff mass rate per (subcatch, pollutant) (mass/sec).
Definition SubcatchData.hpp:342
std::vector< double > ponded_depth
Current total ponded depth over subcatchment (project length units).
Definition SubcatchData.hpp:265
void save_state() noexcept
Definition SubcatchData.hpp:1012
std::vector< double > snow_melt_perv
The melt-only part of snow_net_perv (ft/sec). See above.
Definition SubcatchData.hpp:516
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:443
std::vector< double > gw_b1
Groundwater flow exponent B1.
Definition SubcatchData.hpp:452
std::vector< double > infil_p3
Infiltration param 3: decay (Horton), initial deficit (GA), drying time (CN).
Definition SubcatchData.hpp:227
std::vector< double > sweep_last_swept
Gap #34: days since last swept per (subcatch x landuse).
Definition SubcatchData.hpp:601
std::vector< double > total_load
Total washoff load per (subcatchment x pollutant) (mass units).
Definition SubcatchData.hpp:572
std::vector< double > ds_imperv
Depression storage depth for impervious area (project length units).
Definition SubcatchData.hpp:186
std::vector< int > subarea_routing
Inter-subarea routing mode.
Definition SubcatchData.hpp:205
void resize_washoff_load(int n_pollutants)
Definition SubcatchData.hpp:915
std::vector< double > stat_gw_sum_depth
Sum of water table height (ft, for time-avg)
Definition SubcatchData.hpp:430
std::vector< double > stat_gw_flow_vol
Cumulative lateral GW outflow (ft³)
Definition SubcatchData.hpp:427
std::vector< double > conc
Current quality concentration in subcatchment runoff.
Definition SubcatchData.hpp:353
std::vector< double > curb_length
Total curb length (project length units).
Definition SubcatchData.hpp:130