18#ifndef OPENSWMM_ENGINE_SUBCATCH_DATA_HPP
19#define OPENSWMM_ENGINE_SUBCATCH_DATA_HPP
460 static_cast<std::size_t
>(n_sc) *
static_cast<std::size_t
>(n_poll), 0.0);
490 auto sz =
static_cast<std::size_t
>(n_sc) *
static_cast<std::size_t
>(n_lu);
499 int count() const noexcept {
return static_cast<int>(
area.size()); }
502 const auto un =
static_cast<std::size_t
>(n);
508 area.assign(un, 0.0);
509 width.assign(un, 0.0);
510 slope.assign(un, 0.0);
544 tags.assign(un, std::string{});
570 gw_a1.assign(un, 0.0);
571 gw_b1.assign(un, 0.0);
572 gw_a2.assign(un, 0.0);
573 gw_b2.assign(un, 0.0);
574 gw_a3.assign(un, 0.0);
575 gw_tw.assign(un, 0.0);
589 if (n <=
count())
return;
590 const auto un =
static_cast<std::size_t
>(n);
591 auto g = [&](
auto& vec,
auto def) { vec.resize(un, def); };
611 tags.resize(un, std::string{});
646 const auto ui =
static_cast<std::size_t
>(idx);
647 auto e = [&](
auto& v) {
if (ui < v.size()) v.erase(v.begin() +
static_cast<std::ptrdiff_t
>(idx)); };
677 const auto base = ui * np;
678 auto erase2d = [&](
auto& v) {
679 if (base + np <= v.size())
680 v.erase(v.begin() +
static_cast<std::ptrdiff_t
>(base),
681 v.begin() +
static_cast<std::ptrdiff_t
>(base + np));
689 const auto base = ui * np;
692 total_load.begin() +
static_cast<std::ptrdiff_t
>(base),
693 total_load.begin() +
static_cast<std::ptrdiff_t
>(base + np));
699 const auto base = ui * nlu;
700 auto erase2d = [&](
auto& v) {
701 if (base + nlu <= v.size())
702 v.erase(v.begin() +
static_cast<std::ptrdiff_t
>(base),
703 v.begin() +
static_cast<std::ptrdiff_t
>(base + nlu));
714 if (n_pollutants > 0) {
715 auto total =
static_cast<std::size_t
>(
count()) *
716 static_cast<std::size_t
>(n_pollutants);
717 conc.assign(total, 0.0);
725 if (n_pollutants > 0) {
727 static_cast<std::size_t
>(
count()) *
728 static_cast<std::size_t
>(n_pollutants), 0.0);
739 gage.shrink_to_fit();
740 area.shrink_to_fit();
741 width.shrink_to_fit();
742 slope.shrink_to_fit();
776 tags.shrink_to_fit();
791 gw_a1.shrink_to_fit();
792 gw_b1.shrink_to_fit();
793 gw_a2.shrink_to_fit();
794 gw_b2.shrink_to_fit();
795 gw_a3.shrink_to_fit();
796 gw_tw.shrink_to_fit();
802 conc.shrink_to_fit();
832 std::fill(
conc.begin(),
conc.end(), 0.0);
Definition NodeCoupling.cpp:15
Structure-of-Arrays storage for all subcatchments.
Definition SubcatchData.hpp:41
std::vector< int > gage
Rain gage index for this subcatchment.
Definition SubcatchData.hpp:72
std::vector< double > total_lid_area_ft2
Total LID area for this subcatchment (ft²).
Definition SubcatchData.hpp:423
void reset_state() noexcept
Definition SubcatchData.hpp:817
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:160
std::vector< double > gw_b2
Groundwater flow exponent B2.
Definition SubcatchData.hpp:380
std::vector< double > snow_net_perv
Snow-modified net precipitation for pervious subarea (ft/sec).
Definition SubcatchData.hpp:414
std::vector< double > stat_gw_infil_vol
Cumulative infiltration to GW (ft³)
Definition SubcatchData.hpp:345
int total_load_n_pollutants
Number of pollutants in total_load matrix.
Definition SubcatchData.hpp:455
std::vector< double > outfall_runon_vol
Gap #28: accumulated outfall-routed volume (ft³) between runoff steps.
Definition SubcatchData.hpp:237
std::vector< double > stat_precip_vol
Total precipitation volume (project volume units).
Definition SubcatchData.hpp:326
std::vector< double > gw_surf_elev
Surface elevation for groundwater calculations.
Definition SubcatchData.hpp:368
std::vector< double > gw_sw_head
Surface water head at GW receiving node (project length units).
Definition SubcatchData.hpp:245
void resize_quality(int n_pollutants)
Resize per-subcatch quality arrays after pollutant count is known.
Definition SubcatchData.hpp:712
std::vector< double > slope
Average slope of catchment (fraction).
Definition SubcatchData.hpp:90
std::vector< double > infil_p1
Infiltration param 1: f0 (Horton), suction (GA), CN (CN).
Definition SubcatchData.hpp:163
std::vector< double > old_gw_flow
GW flow at the previous runoff evaluation (for interpolation).
Definition SubcatchData.hpp:221
std::vector< int > snowpack
Snowpack index for this subcatchment (-1 = none).
Definition SubcatchData.hpp:396
std::vector< double > gw_tw
Threshold groundwater table elevation.
Definition SubcatchData.hpp:386
std::vector< double > evap_loss
Current evaporation loss rate (project length/time units).
Definition SubcatchData.hpp:193
std::vector< double > old_runoff
Runoff at the previous timestep.
Definition SubcatchData.hpp:218
std::vector< double > gw_node_avail_flow
Available node flow for GW negative flow limit (cfs/ft2).
Definition SubcatchData.hpp:248
std::vector< double > stat_infil_vol
Cumulative infiltration volume (ft3)
Definition SubcatchData.hpp:328
std::vector< double > gw_flow
Groundwater outflow rate (project flow units).
Definition SubcatchData.hpp:211
std::vector< double > stat_evap_vol
Cumulative evaporation volume (ft3)
Definition SubcatchData.hpp:327
std::vector< double > stat_gw_sum_theta
Sum of upper-zone theta (for time-avg)
Definition SubcatchData.hpp:351
std::vector< double > stat_perv_vol
Cumulative pervious runoff volume (ft3)
Definition SubcatchData.hpp:330
std::vector< double > area
Subcatchment area (project area units).
Definition SubcatchData.hpp:78
std::vector< double > gw_a3
Groundwater flow coefficient A3.
Definition SubcatchData.hpp:383
std::vector< int > outlet_subcatch
Index of the subcatch that receives overflow (-1 if none).
Definition SubcatchData.hpp:59
std::vector< double > gw_hstar
Water table elevation at which lateral GW flow ceases.
Definition SubcatchData.hpp:389
int coverage_n_landuses
Number of landuses stored in the coverage and sweep matrices.
Definition SubcatchData.hpp:474
std::vector< std::string > comments
Object comment from the INP file (';'-prefixed lines immediately above this subcatchment's data row),...
Definition SubcatchData.hpp:300
std::vector< double > stat_gw_upper_evap_vol
Cumulative upper zone evap (ft³)
Definition SubcatchData.hpp:346
std::vector< double > old_runon_inflow
Previous-step runon inflow (for interpolation).
Definition SubcatchData.hpp:232
std::vector< double > stat_runoff_vol
Total runoff volume (project volume units).
Definition SubcatchData.hpp:336
std::vector< double > n_imperv
Manning's n for impervious area.
Definition SubcatchData.hpp:114
std::vector< double > lid_drain_runon_cfs
LID drain flow routed to a target subcatchment (CFS).
Definition SubcatchData.hpp:442
std::vector< double > n_perv
Manning's n for pervious area.
Definition SubcatchData.hpp:120
std::vector< double > infil_p4
Infiltration param 4: dry time (Horton), 0 (GA/CN).
Definition SubcatchData.hpp:169
void resize_coverage(int n_sc, int n_lu)
Resize the coverage and sweep matrices.
Definition SubcatchData.hpp:488
std::vector< double > lid_return_to_perv_cfs
LID surface return flow to pervious area (CFS).
Definition SubcatchData.hpp:432
std::vector< std::string > tags
Per-object tag from the INP [TAGS] section.
Definition SubcatchData.hpp:308
std::vector< double > runon_inflow
Runoff inflow from upstream subcatchments (project flow units).
Definition SubcatchData.hpp:229
std::vector< double > stat_gw_final_theta
Upper-zone theta at last GW step.
Definition SubcatchData.hpp:353
std::vector< double > gw_a2
Groundwater flow coefficient A2.
Definition SubcatchData.hpp:377
std::vector< double > stat_gw_lower_evap_vol
Cumulative lower zone evap (ft³)
Definition SubcatchData.hpp:347
int conc_n_pollutants
Number of pollutants in the quality arrays.
Definition SubcatchData.hpp:289
std::vector< std::string > outlet_name
Outlet name string for deferred resolution.
Definition SubcatchData.hpp:66
std::vector< double > stat_gw_deep_perc_vol
Cumulative deep percolation (ft³)
Definition SubcatchData.hpp:348
std::vector< double > stat_imperv_vol
Cumulative impervious runoff volume (ft3)
Definition SubcatchData.hpp:329
std::vector< double > ponded_qual
Ponded surface water quality mass per (subcatch, pollutant).
Definition SubcatchData.hpp:286
std::vector< double > pct_routed
Fraction of runoff routed between subareas (0–1).
Definition SubcatchData.hpp:153
std::vector< double > infil_p2
Infiltration param 2: fmin (Horton), conductivity (GA), 0 (CN).
Definition SubcatchData.hpp:165
std::vector< double > stat_gw_max_flow
Peak lateral GW outflow (CFS)
Definition SubcatchData.hpp:350
std::vector< double > gw_a1
Groundwater flow coefficient A1.
Definition SubcatchData.hpp:371
void resize(int n)
Definition SubcatchData.hpp:501
std::vector< double > stat_gw_final_depth
Water table height at last GW step (ft)
Definition SubcatchData.hpp:354
std::vector< double > snow_net_imperv
Snow-modified net precipitation for impervious subareas (ft/sec).
Definition SubcatchData.hpp:405
std::vector< double > ds_perv
Depression storage depth for pervious area (project length units).
Definition SubcatchData.hpp:132
std::vector< double > width
Width of overland flow path (project length units).
Definition SubcatchData.hpp:84
std::vector< double > infil_loss
Current infiltration loss rate (project length/time units).
Definition SubcatchData.hpp:199
std::vector< double > frac_imperv_no_store
Fraction of impervious area with no depression storage (0–1).
Definition SubcatchData.hpp:108
std::vector< double > conc_old
Previous-step quality in subcatchment runoff.
Definition SubcatchData.hpp:278
int count() const noexcept
Definition SubcatchData.hpp:499
void erase_at(int idx)
Erase the subcatchment at index idx from every parallel array.
Definition SubcatchData.hpp:645
std::vector< double > gw_max_infil_vol
Gap #40: max infiltration volume (ft) upper GW zone can accept next step.
Definition SubcatchData.hpp:256
void resize_total_load(int n_sc, int n_poll)
Definition SubcatchData.hpp:457
std::vector< char > rpt_flag
Whether this subcatchment is included in report/output (0=no, 1=yes).
Definition SubcatchData.hpp:316
std::vector< int > gw_aquifer
Aquifer index for this subcatchment (-1 = none).
Definition SubcatchData.hpp:362
std::vector< int > outlet_node
Index of the drain-to node or subcatchment.
Definition SubcatchData.hpp:53
void grow_to(int n)
Grow all arrays to hold at least n subcatchments, preserving existing data.
Definition SubcatchData.hpp:588
std::vector< double > runoff
Current total runoff flow rate (project flow units).
Definition SubcatchData.hpp:181
void shrink_to_fit()
Release excess vector capacity accumulated during parsing.
Definition SubcatchData.hpp:735
std::vector< double > coverage
Coverage fraction per (subcatchment x landuse).
Definition SubcatchData.hpp:471
std::vector< double > stat_max_runoff
Maximum reported runoff rate (project flow units).
Definition SubcatchData.hpp:342
std::vector< double > infil_p5
Infiltration param 5: max infil (Horton), 0 (GA/CN).
Definition SubcatchData.hpp:171
std::vector< long > stat_gw_steps
Step count for GW averages.
Definition SubcatchData.hpp:355
std::vector< double > rainfall
Current total rainfall depth rate (project length/time units).
Definition SubcatchData.hpp:187
std::vector< double > washoff_load
Washoff mass rate per (subcatch, pollutant) (mass/sec).
Definition SubcatchData.hpp:264
std::vector< double > ponded_depth
Current total ponded depth over subcatchment (project length units).
Definition SubcatchData.hpp:205
void save_state() noexcept
Definition SubcatchData.hpp:811
std::vector< double > frac_imperv
Fraction of area that is impervious (0–1).
Definition SubcatchData.hpp:102
std::vector< int > gw_node
Receiving node index for groundwater flow (-1 = none).
Definition SubcatchData.hpp:365
std::vector< double > gw_b1
Groundwater flow exponent B1.
Definition SubcatchData.hpp:374
std::vector< double > infil_p3
Infiltration param 3: decay (Horton), initial deficit (GA), 0 (CN).
Definition SubcatchData.hpp:167
std::vector< double > sweep_last_swept
Gap #34: days since last swept per (subcatch x landuse).
Definition SubcatchData.hpp:481
std::vector< double > total_load
Total washoff load per (subcatchment x pollutant) (mass units).
Definition SubcatchData.hpp:452
std::vector< double > ds_imperv
Depression storage depth for impervious area (project length units).
Definition SubcatchData.hpp:126
std::vector< int > subarea_routing
Inter-subarea routing mode.
Definition SubcatchData.hpp:145
void resize_washoff_load(int n_pollutants)
Definition SubcatchData.hpp:724
std::vector< double > stat_gw_sum_depth
Sum of water table height (ft, for time-avg)
Definition SubcatchData.hpp:352
std::vector< double > stat_gw_flow_vol
Cumulative lateral GW outflow (ft³)
Definition SubcatchData.hpp:349
std::vector< double > conc
Current quality concentration in subcatchment runoff.
Definition SubcatchData.hpp:275
std::vector< double > curb_length
Total curb length (project length units).
Definition SubcatchData.hpp:96