25#ifndef OPENSWMM_ENGINE_NODE_DATA_HPP
26#define OPENSWMM_ENGINE_NODE_DATA_HPP
97 std::vector<NodeType>
type;
614 int count() const noexcept {
return static_cast<int>(
type.size()); }
624 const auto un =
static_cast<std::size_t
>(n);
662 depth.assign(un, 0.0);
663 head.assign(un, 0.0);
691 tags.assign(un, std::string{});
726 if (n <=
count())
return;
727 const auto un =
static_cast<std::size_t
>(n);
728 auto g = [&](
auto& vec,
auto def) { vec.resize(un, def); };
757 tags.resize(un, std::string{});
785 const auto ui =
static_cast<std::size_t
>(idx);
786 auto e = [&](
auto& v) {
if (ui < v.size()) v.erase(v.begin() +
static_cast<std::ptrdiff_t
>(idx)); };
824 const auto base = ui * np;
825 auto erase2d = [&](
auto& v) {
826 if (base + np <= v.size())
827 v.erase(v.begin() +
static_cast<std::ptrdiff_t
>(base),
828 v.begin() +
static_cast<std::ptrdiff_t
>(base + np));
832 if (ui <
hrt.size())
hrt.erase(
hrt.begin() +
static_cast<std::ptrdiff_t
>(idx));
838 const auto base = ui * np;
851 if (n_pollutants > 0) {
852 auto total =
static_cast<std::size_t
>(
count()) *
853 static_cast<std::size_t
>(n_pollutants);
863 if (n_pollutants > 0) {
864 auto total =
static_cast<std::size_t
>(
count()) *
865 static_cast<std::size_t
>(n_pollutants);
866 conc.assign(total, 0.0);
868 hrt.assign(
static_cast<std::size_t
>(
count()), 0.0);
883 type.shrink_to_fit();
920 depth.shrink_to_fit();
921 head.shrink_to_fit();
934 conc.shrink_to_fit();
950 tags.shrink_to_fit();
984 for (std::size_t i = 0; i <
inflow.size(); ++i) {
997 const auto n =
depth.size();
999 for (std::size_t i = 0; i < n; ++i) {
1020 std::fill(
conc.begin(),
conc.end(), 0.0);
Definition NodeCoupling.cpp:15
OutfallType
Outfall boundary condition type.
Definition NodeData.hpp:54
NodeType
Node type codes.
Definition NodeData.hpp:43
DividerType
Flow divider type.
Definition NodeData.hpp:66
@ OVERFLOW_DIV
Renamed from OVERFLOW to avoid macOS math.h macro collision.
@ TIMESERIES
Data from an in-file [TIMESERIES].
Structure-of-Arrays storage for all nodes.
Definition NodeData.hpp:90
std::vector< double > coupling_inflow
2D ↔ 1D coupling exchange flow at the node (project flow units).
Definition NodeData.hpp:330
std::vector< double > stat_lat_inflow_vol
Definition NodeData.hpp:562
int count() const noexcept
Number of nodes.
Definition NodeData.hpp:614
std::vector< double > depth
Current water depth above invert (project length units).
Definition NodeData.hpp:256
std::vector< double > invert_elev
Invert elevation (project length units).
Definition NodeData.hpp:103
std::vector< double > ext_inflow
External (timeseries/baseline) inflows (project flow units).
Definition NodeData.hpp:298
std::vector< double > exfil_imd
Green-Ampt initial moisture deficit for exfiltration (0-1).
Definition NodeData.hpp:218
std::vector< double > conc_old
Previous-step quality at each node.
Definition NodeData.hpp:375
std::vector< int > outfall_route_to
Subcatchment index to route outfall discharge to (-1 = none).
Definition NodeData.hpp:148
std::vector< double > iface_inflow
Interface file (upstream model coupling) inflows (project flow units).
Definition NodeData.hpp:307
std::vector< double > qual_mass_in
Accumulated quality mass inflow rate per (node, pollutant).
Definition NodeData.hpp:339
std::vector< double > outfall_2d_head
Cached 2D surface head at the outfall coupling point (project length).
Definition NodeData.hpp:179
std::vector< std::string > divider_link_name
Diversion link name (for deferred resolution).
Definition NodeData.hpp:243
std::vector< double > stat_vol_flooded
Total volume of water lost as overflow (project volume units).
Definition NodeData.hpp:499
std::vector< double > storage_b
Functional storage area parameter B.
Definition NodeData.hpp:197
std::vector< double > stat_time_courant_critical
CFL time-step critical count per node.
Definition NodeData.hpp:598
std::vector< int > divider_curve
Diversion curve index for TABULAR dividers (-1 = none).
Definition NodeData.hpp:237
void erase_at(int idx)
Erase the node at index idx from every parallel array.
Definition NodeData.hpp:784
std::vector< std::string > divider_curve_name
Diversion curve name (for deferred resolution, TABULAR only).
Definition NodeData.hpp:246
std::vector< double > hrt
Hydraulic residence time for storage nodes (seconds).
Definition NodeData.hpp:378
std::vector< uint8_t > outfall_has_flap_gate
True if the outfall has a gated flap (uint8_t: 0=no, 1=yes).
Definition NodeData.hpp:144
std::vector< double > old_depth
Depth at the previous timestep.
Definition NodeData.hpp:447
void reset_state() noexcept
Reset state variables, applying init_depth from input.
Definition NodeData.hpp:996
std::vector< double > divider_cd
Weir discharge coefficient for WEIR dividers.
Definition NodeData.hpp:231
std::vector< double > qual_vol_in
Accumulated volume inflow rate per node (ft3/sec).
Definition NodeData.hpp:342
std::vector< double > old_volume
Volume at the previous timestep.
Definition NodeData.hpp:450
std::vector< double > exfil_suction
Green-Ampt suction head for exfiltration (in or mm, converted to ft).
Definition NodeData.hpp:214
std::vector< double > outfall_param
Fixed outfall stage or tidal curve / time series index.
Definition NodeData.hpp:141
std::vector< double > stat_total_outflow_vol
Definition NodeData.hpp:569
std::vector< double > user_conc_mass_flux
User-forced quality mass flux at each node (mass/sec).
Definition NodeData.hpp:389
std::vector< double > storage_a
Functional storage area parameter A (area = A * depth^B + C).
Definition NodeData.hpp:195
void shrink_to_fit()
Release excess vector capacity accumulated during parsing.
Definition NodeData.hpp:882
std::vector< double > stat_max_surcharge_height
Definition NodeData.hpp:544
std::vector< double > stat_max_overflow
Maximum reported overflow rate (project flow units).
Definition NodeData.hpp:517
std::vector< int > divider_link
Diversion link index (-1 = not set).
Definition NodeData.hpp:240
std::vector< char > rpt_flag
Whether this node is included in report/output (0=no, 1=yes).
Definition NodeData.hpp:489
std::vector< double > outflow
Current total outflow from the node (project flow units).
Definition NodeData.hpp:404
void clearInflowSources() noexcept
Zero routing-phase inflow source arrays.
Definition NodeData.hpp:1034
std::vector< double > overflow
Current overflow / ponded flow (project flow units).
Definition NodeData.hpp:410
std::vector< double > old_net_inflow
Net inflow from previous timestep (inflow - outflow) for averaging.
Definition NodeData.hpp:434
std::vector< double > stat_max_depth_date
Definition NodeData.hpp:528
std::vector< double > stat_max_lat_inflow
Definition NodeData.hpp:554
std::vector< double > stat_outfall_max_flow
Outfall maximum flow (project flow units).
Definition NodeData.hpp:575
std::vector< double > volume
Current water volume (project volume units).
Definition NodeData.hpp:268
int conc_n_pollutants
Number of pollutants in the quality arrays.
Definition NodeData.hpp:392
std::vector< double > lat_flow
Current lateral inflow (project flow units).
Definition NodeData.hpp:274
std::vector< double > ponded_area
Ponding area at the surface (sq project length units).
Definition NodeData.hpp:127
std::vector< double > stat_total_inflow_vol
Cumulative total inflow volume at each node (ft3).
Definition NodeData.hpp:565
std::vector< double > sur_depth
Maximum depth allowed at the node (ponding or surcharge limit).
Definition NodeData.hpp:121
std::vector< double > crown_elev
Crown elevation — top of highest connecting conduit (project length units).
Definition NodeData.hpp:422
std::vector< double > stat_max_inflow_date
Definition NodeData.hpp:536
std::vector< double > old_lat_flow
Lateral flow at the previous timestep.
Definition NodeData.hpp:453
std::vector< double > stat_outfall_avg_flow
Outfall cumulative average flow (flow units × reporting periods).
Definition NodeData.hpp:550
std::vector< double > inflow
Current total inflow to the node (project flow units).
Definition NodeData.hpp:398
void save_state() noexcept
Snapshot current state into old-step arrays before solving.
Definition NodeData.hpp:979
std::vector< double > stat_time_surcharged
Definition NodeData.hpp:540
std::vector< double > stat_max_depth
Maximum reported depth (project length units).
Definition NodeData.hpp:511
std::vector< long > stat_outfall_periods
Outfall number of non-zero flow periods.
Definition NodeData.hpp:581
std::vector< int > storage_curve
Storage curve index into TableData (CURVE_STORAGE).
Definition NodeData.hpp:189
void resize_loads(int n_pollutants)
Resize pollutant load arrays after pollutant count is known.
Definition NodeData.hpp:849
std::vector< double > conc
Current quality concentration at each node.
Definition NodeData.hpp:372
std::vector< DividerType > divider_type
Divider method (DividerType enum value).
Definition NodeData.hpp:225
std::vector< double > divider_max_depth
Weir max depth for WEIR dividers.
Definition NodeData.hpp:234
std::vector< int > degree
Node degree — number of connecting links (+ve downstream, -ve upstream terminal).
Definition NodeData.hpp:428
std::vector< double > lid_drain_qual_vol
LID drain volume inflow rate per node (ft3/sec).
Definition NodeData.hpp:361
std::vector< double > storage_exfil_loss
Storage node exfiltration loss this timestep (ft3).
Definition NodeData.hpp:211
std::vector< double > runoff_inflow
Interpolated surface runoff from subcatchments (project flow units).
Definition NodeData.hpp:292
std::vector< double > dwf_inflow
Dry weather flow inflows (project flow units).
Definition NodeData.hpp:301
std::vector< double > stat_time_flooded
Total duration the node was flooded (seconds).
Definition NodeData.hpp:505
std::vector< std::string > tags
Per-object tag from the INP [TAGS] section.
Definition NodeData.hpp:481
std::vector< double > lid_drain_qual_load
LID drain quality mass rate per (node, pollutant) (mass/sec).
Definition NodeData.hpp:353
std::vector< double > stat_sum_depth
Definition NodeData.hpp:524
std::vector< double > stat_max_rpt_depth
Definition NodeData.hpp:532
std::vector< double > init_depth
Initial water depth (project length units).
Definition NodeData.hpp:115
std::vector< double > stat_total_load
Cumulative pollutant loads at each node.
Definition NodeData.hpp:606
void resize(int n)
Resize all arrays to hold exactly n nodes.
Definition NodeData.hpp:623
std::vector< double > storage_seep_rate
Seepage rate from storage node (project units/day).
Definition NodeData.hpp:202
std::vector< double > exfil_ksat
Green-Ampt saturated hydraulic conductivity for exfiltration (in/hr or mm/hr, converted to ft/sec).
Definition NodeData.hpp:216
std::vector< double > outfall_link_offset
Conduit offset at the outfall end (ft), matching the link stored in outfall_link_idx....
Definition NodeData.hpp:160
std::vector< int > stat_non_converged_count
Count of non-converging steps per node.
Definition NodeData.hpp:589
std::vector< double > full_volume
Full volume at node (project volume units).
Definition NodeData.hpp:440
std::vector< double > storage_evap_frac
Fraction of potential evaporation realized at storage node (0-1).
Definition NodeData.hpp:205
std::vector< std::string > storage_curve_name
Curve name for deferred resolution (populated during parsing).
Definition NodeData.hpp:192
std::vector< double > stat_max_overflow_date
Date/time when maximum overflow occurred (OADate (days since 12/30/1899)).
Definition NodeData.hpp:520
std::vector< std::string > comments
Object comment from the INP file (lines with a single ';' prefix immediately above this object's data...
Definition NodeData.hpp:468
std::vector< double > losses
Node losses (evaporation + seepage) (project flow units).
Definition NodeData.hpp:416
void grow_to(int n)
Grow all arrays to hold at least n nodes, preserving existing data.
Definition NodeData.hpp:725
std::vector< NodeType > type
Node type for each node.
Definition NodeData.hpp:97
std::vector< double > full_depth
Full depth of the node (project length units).
Definition NodeData.hpp:109
std::vector< double > stat_max_total_inflow
Definition NodeData.hpp:558
std::vector< double > rdii_inflow
RDII unit hydrograph inflows (project flow units).
Definition NodeData.hpp:304
void resize_quality(int n_pollutants)
Resize per-node quality arrays after pollutant count is known.
Definition NodeData.hpp:861
std::vector< int > outfall_link_idx
Cached index of the conduit connected to this outfall (-1 if none).
Definition NodeData.hpp:156
std::vector< double > storage_c
Functional storage area parameter C (baseline area).
Definition NodeData.hpp:199
std::vector< double > head
Current water surface head (project length units = invert + depth).
Definition NodeData.hpp:262
std::vector< OutfallType > outfall_type
Outfall boundary condition type.
Definition NodeData.hpp:134
std::vector< double > divider_cutoff
Cutoff flow for CUTOFF dividers.
Definition NodeData.hpp:228
std::vector< double > storage_evap_loss
Storage node evaporation loss this timestep (ft3).
Definition NodeData.hpp:208
std::vector< double > gw_inflow
Interpolated groundwater flow from subcatchments (project flow units).
Definition NodeData.hpp:295
std::vector< double > user_lat_flow
User-forced lateral inflow set via the API (project flow units).
Definition NodeData.hpp:283
int stat_n_pollutants
Definition NodeData.hpp:607