41#ifndef OPENSWMM_ENGINE_NODE_DATA_HPP
42#define OPENSWMM_ENGINE_NODE_DATA_HPP
721 int count() const noexcept {
return static_cast<int>(
type.size()); }
731 const auto un =
static_cast<std::size_t
>(n);
743 depth.assign(un, 0.0);
744 head.assign(un, 0.0);
785 tags.assign(un, std::string{});
822 if (n <=
count())
return;
823 const auto un =
static_cast<std::size_t
>(n);
824 auto g = [&](
auto& vec,
auto def) { vec.resize(un, def); };
829 g(
is_inlet,
static_cast<uint8_t
>(0));
848 tags.resize(un, std::string{});
888 const auto un =
static_cast<std::size_t
>(n);
889 if (
type.capacity() >= un)
return;
890 auto r = [&](
auto& vec) { vec.reserve(un); };
921 const auto ui =
static_cast<std::size_t
>(idx);
922 auto e = [&](
auto& v) {
if (ui < v.size()) v.erase(v.begin() +
static_cast<std::ptrdiff_t
>(idx)); };
955 const auto base = ui * np;
956 auto erase2d = [&](
auto& v) {
957 if (base + np <= v.size())
958 v.erase(v.begin() +
static_cast<std::ptrdiff_t
>(base),
959 v.begin() +
static_cast<std::ptrdiff_t
>(base + np));
967 if (ui <
hrt.size())
hrt.erase(
hrt.begin() +
static_cast<std::ptrdiff_t
>(idx));
973 const auto base = ui * np;
986 if (n_pollutants > 0) {
987 auto total =
static_cast<std::size_t
>(
count()) *
988 static_cast<std::size_t
>(n_pollutants);
998 if (n_pollutants > 0) {
999 auto total =
static_cast<std::size_t
>(
count()) *
1000 static_cast<std::size_t
>(n_pollutants);
1001 conc.assign(total, 0.0);
1003 hrt.assign(
static_cast<std::size_t
>(
count()), 0.0);
1023 type.shrink_to_fit();
1034 depth.shrink_to_fit();
1035 head.shrink_to_fit();
1057 conc.shrink_to_fit();
1074 tags.shrink_to_fit();
1111 for (std::size_t i = 0; i <
inflow.size(); ++i) {
1124 const auto n =
depth.size();
1126 for (std::size_t i = 0; i < n; ++i) {
1157 std::fill(
conc.begin(),
conc.end(), 0.0);
Definition NodeCoupling.cpp:16
StorageShape
Storage-unit surface-area relation.
Definition NodeData.hpp:104
@ CONICAL
Elliptical cone (p1, p2 = base axes, p3 = side slope)
Definition NodeData.hpp:108
@ PYRAMIDAL
Rectangular pyramid (p1 = length, p2 = width, p3 = side slope)
Definition NodeData.hpp:110
@ PARABOLOID
Elliptical paraboloid(p1, p2 = top axes, p3 = height ≠ 0)
Definition NodeData.hpp:109
@ CYLINDRICAL
Elliptical cylinder (p1 = major axis, p2 = minor axis)
Definition NodeData.hpp:107
@ FUNCTIONAL
Area = c + a*d^b.
Definition NodeData.hpp:106
@ STORAGE
Definition LidLayerSpeciesData.hpp:56
@ WEIR
Definition LinkData.hpp:62
OutfallType
Outfall boundary condition type.
Definition NodeData.hpp:70
@ NORMAL
Definition NodeData.hpp:72
@ FREE
Definition NodeData.hpp:71
@ FIXED
Definition NodeData.hpp:73
@ TIDAL
Definition NodeData.hpp:74
NodeType
Node type codes.
Definition NodeData.hpp:59
@ JUNCTION
Definition NodeData.hpp:60
@ DIVIDER
Definition NodeData.hpp:62
@ OUTFALL
Definition NodeData.hpp:61
DividerType
Flow divider type.
Definition NodeData.hpp:82
@ CUTOFF
Definition NodeData.hpp:83
@ TABULAR
Definition NodeData.hpp:85
@ OVERFLOW_DIV
Renamed from OVERFLOW to avoid macOS math.h macro collision.
Definition NodeData.hpp:84
@ TIMESERIES
Data from an in-file [TIMESERIES].
Definition GageData.hpp:58
Structure-of-Arrays storage for all nodes.
Definition NodeData.hpp:130
std::vector< double > coupling_inflow
2D ↔ 1D coupling exchange flow at the node (project flow units).
Definition NodeData.hpp:301
std::vector< double > stat_lat_inflow_vol
Definition NodeData.hpp:669
bool coupling_tuple_temp
Definition NodeData.hpp:370
int count() const noexcept
Number of nodes.
Definition NodeData.hpp:721
std::vector< double > depth
Current water depth above invert (project length units).
Definition NodeData.hpp:227
std::vector< double > invert_elev
Invert elevation (project length units).
Definition NodeData.hpp:143
std::vector< double > ext_inflow
External (timeseries/baseline) inflows (project flow units).
Definition NodeData.hpp:269
std::vector< double > conc_old
Previous-step quality at each node.
Definition NodeData.hpp:463
std::vector< double > iface_inflow
Interface file (upstream model coupling) inflows (project flow units).
Definition NodeData.hpp:278
std::vector< double > coupling_queue
Delivery queue for the 1D↔2D junction exchange (1D units, ft³).
Definition NodeData.hpp:334
std::vector< double > qual_mass_in
Accumulated quality mass inflow rate per (node, pollutant).
Definition NodeData.hpp:379
std::vector< double > stat_vol_flooded
Total volume of water lost as overflow (project volume units).
Definition NodeData.hpp:593
std::vector< double > stat_time_courant_critical
CFL time-step critical count per node.
Definition NodeData.hpp:705
std::vector< double > old_inflow
Total inflow at the previous timestep (for output interpolation).
Definition NodeData.hpp:547
void erase_at(int idx)
Erase the node at index idx from every parallel array.
Definition NodeData.hpp:920
std::vector< double > coupling_age_vol_inflow
Definition NodeData.hpp:367
std::vector< double > hrt
Hydraulic residence time for storage nodes (seconds).
Definition NodeData.hpp:466
std::vector< double > old_depth
Depth at the previous timestep.
Definition NodeData.hpp:535
void reset_state() noexcept
Reset state variables, applying init_depth from input.
Definition NodeData.hpp:1123
std::vector< double > qual_vol_in
Accumulated volume inflow rate per node (ft3/sec).
Definition NodeData.hpp:382
std::vector< double > coupling_volume
Pending 1D↔2D exchange VOLUME for the next routing step (1D units, ft³).
Definition NodeData.hpp:316
std::vector< double > old_volume
Volume at the previous timestep.
Definition NodeData.hpp:538
std::vector< double > stat_total_outflow_vol
Definition NodeData.hpp:676
std::vector< double > user_conc_mass_flux
User-forced quality mass flux at each node (mass/sec).
Definition NodeData.hpp:477
void reserve_to(int n)
Reserve capacity for n nodes without changing count().
Definition NodeData.hpp:886
std::vector< double > coupling_temp_vol_inflow
Definition NodeData.hpp:368
std::vector< double > coupling_age_vol_queue
S4 — the tuple's age-volume and temperature-volume halves, per node (age·ft³ / °C·ft³ queued; age·ft³...
Definition NodeData.hpp:365
bool coupling_tuple_age
set by SurfaceRouter2D at initialize
Definition NodeData.hpp:369
void shrink_to_fit()
Release excess vector capacity accumulated during parsing.
Definition NodeData.hpp:1022
std::vector< double > stat_max_surcharge_height
Definition NodeData.hpp:645
std::vector< double > stat_max_overflow
Maximum reported overflow rate (project flow units).
Definition NodeData.hpp:611
std::vector< char > rpt_flag
Whether this node is included in report/output (0=no, 1=yes).
Definition NodeData.hpp:583
std::vector< double > outflow
Current total outflow from the node (project flow units).
Definition NodeData.hpp:492
void clearInflowSources() noexcept
Zero routing-phase inflow source arrays.
Definition NodeData.hpp:1171
std::vector< double > dwf_qual_mass
Per-node DWF pollutant mass-rate ADJUSTMENT (mass/sec), net of the global default: row mass (q·patter...
Definition NodeData.hpp:417
std::vector< double > overflow
Current overflow / ponded flow (project flow units).
Definition NodeData.hpp:498
std::vector< double > old_net_inflow
Net inflow from previous timestep (inflow - outflow) for averaging.
Definition NodeData.hpp:522
std::vector< double > stat_storage_max_outflow
Definition NodeData.hpp:665
std::vector< uint8_t > is_virtual
Virtual-junction flag (0 = regular node, 1 = virtual junction).
Definition NodeData.hpp:178
std::vector< double > stat_max_depth_date
Definition NodeData.hpp:629
std::vector< double > stat_max_lat_inflow
Definition NodeData.hpp:655
std::vector< double > stat_outfall_max_flow
Outfall maximum flow (project flow units).
Definition NodeData.hpp:682
std::vector< double > volume
Current water volume (project volume units).
Definition NodeData.hpp:239
int conc_n_pollutants
Number of pollutants in the quality arrays.
Definition NodeData.hpp:480
std::vector< double > iface_qual_mass
Routing interface file quality mass rate per (node, pollutant) (mass/sec).
Definition NodeData.hpp:392
std::vector< double > lat_flow
Current lateral inflow (project flow units).
Definition NodeData.hpp:245
std::vector< double > ponded_area
Ponding area at the surface (sq project length units).
Definition NodeData.hpp:167
std::vector< double > stat_total_inflow_vol
Cumulative total inflow volume at each node (ft3).
Definition NodeData.hpp:672
std::vector< double > coupling_temp_vol_queue
Definition NodeData.hpp:366
std::vector< double > sur_depth
Maximum depth allowed at the node (ponding or surcharge limit).
Definition NodeData.hpp:161
std::vector< double > crown_elev
Crown elevation — top of highest connecting conduit (project length units).
Definition NodeData.hpp:510
std::vector< double > stat_max_inflow_date
Definition NodeData.hpp:637
std::vector< double > old_lat_flow
Lateral flow at the previous timestep.
Definition NodeData.hpp:541
std::vector< double > stat_outfall_avg_flow
Outfall cumulative average flow (flow units × reporting periods).
Definition NodeData.hpp:651
std::vector< double > inflow
Current total inflow to the node (project flow units).
Definition NodeData.hpp:486
void save_state() noexcept
Snapshot current state into old-step arrays before solving.
Definition NodeData.hpp:1104
std::vector< double > stat_time_surcharged
Definition NodeData.hpp:641
std::vector< double > stat_max_depth
Maximum reported depth (project length units).
Definition NodeData.hpp:605
std::vector< double > coupling_qual_queue
S3 — species MASS queue for the 2D→1D junction drain, per (node, pollutant), 1D mass units (conc × ft...
Definition NodeData.hpp:350
std::vector< long > stat_outfall_periods
Outfall number of non-zero flow periods.
Definition NodeData.hpp:688
void resize_loads(int n_pollutants)
Resize pollutant load arrays after pollutant count is known.
Definition NodeData.hpp:984
std::vector< double > conc
Current quality concentration at each node.
Definition NodeData.hpp:460
std::vector< double > ext_qual_mass
Direct external inflow quality mass rate per (node, pollutant) (mass/sec).
Definition NodeData.hpp:406
std::vector< int > degree
Node degree — number of connecting links (+ve downstream, -ve upstream terminal).
Definition NodeData.hpp:516
std::vector< uint8_t > is_inlet
Inlet-junction flag (0 = plain node, 1 = inlet junction).
Definition NodeData.hpp:190
std::vector< double > lid_drain_qual_vol
LID drain volume inflow rate per node (ft3/sec).
Definition NodeData.hpp:436
std::vector< double > runoff_inflow
Interpolated surface runoff from subcatchments (project flow units).
Definition NodeData.hpp:263
std::vector< double > rim_depth
Rendering-only rim (ground) depth above the invert, project length units. 0 = unset.
Definition NodeData.hpp:206
std::vector< double > dwf_inflow
Dry weather flow inflows (project flow units).
Definition NodeData.hpp:272
std::vector< double > stat_time_flooded
Total duration the node was flooded (seconds).
Definition NodeData.hpp:599
std::vector< std::string > tags
Per-object tag from the INP [TAGS] section.
Definition NodeData.hpp:575
std::vector< double > lid_drain_qual_load
LID drain quality mass rate per (node, pollutant) (mass/sec).
Definition NodeData.hpp:428
std::vector< double > stat_sum_volume
Definition NodeData.hpp:625
std::vector< double > stat_sum_depth
Definition NodeData.hpp:618
std::vector< double > stat_max_rpt_depth
Definition NodeData.hpp:633
std::vector< double > init_depth
Initial water depth (project length units).
Definition NodeData.hpp:155
std::vector< double > stat_total_load
Cumulative pollutant loads at each node.
Definition NodeData.hpp:713
void resize(int n)
Resize all arrays to hold exactly n nodes.
Definition NodeData.hpp:730
std::vector< double > coupling_qual_inflow
S3 — this step's delivered 2D→1D species mass RATE per (node, pollutant) (mass/sec); read by QualityS...
Definition NodeData.hpp:353
std::vector< int > stat_non_converged_count
Count of non-converging steps per node.
Definition NodeData.hpp:696
std::vector< double > full_volume
Full volume at node (project volume units).
Definition NodeData.hpp:528
std::vector< double > stat_max_overflow_date
Date/time when maximum overflow occurred (OADate (days since 12/30/1899)).
Definition NodeData.hpp:614
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:562
std::vector< double > losses
Node losses (evaporation + seepage) (project flow units).
Definition NodeData.hpp:504
std::vector< double > lid_drain_inflow
LID drain WATER inflow rate per node (ft3/sec) — the routing twin of lid_drain_qual_vol.
Definition NodeData.hpp:449
void grow_to(int n)
Grow all arrays to hold at least n nodes, preserving existing data.
Definition NodeData.hpp:821
std::vector< NodeType > type
Node type for each node.
Definition NodeData.hpp:137
std::vector< double > full_depth
Full depth of the node (project length units).
Definition NodeData.hpp:149
std::vector< double > stat_max_total_inflow
Definition NodeData.hpp:659
std::vector< double > rdii_inflow
RDII unit hydrograph inflows (project flow units).
Definition NodeData.hpp:275
void resize_quality(int n_pollutants)
Resize per-node quality arrays after pollutant count is known.
Definition NodeData.hpp:996
std::vector< double > head
Current water surface head (project length units = invert + depth).
Definition NodeData.hpp:233
std::vector< double > gw_inflow
Interpolated groundwater flow from subcatchments (project flow units).
Definition NodeData.hpp:266
std::vector< double > user_lat_flow
User-forced lateral inflow set via the API (project flow units).
Definition NodeData.hpp:254
int stat_n_pollutants
Definition NodeData.hpp:714