25#ifndef OPENSWMM_ENGINE_NODE_DATA_HPP
26#define OPENSWMM_ENGINE_NODE_DATA_HPP
568 int count() const noexcept {
return static_cast<int>(
type.size()); }
578 const auto un =
static_cast<std::size_t
>(n);
587 depth.assign(un, 0.0);
588 head.assign(un, 0.0);
619 tags.assign(un, std::string{});
655 if (n <=
count())
return;
656 const auto un =
static_cast<std::size_t
>(n);
657 auto g = [&](
auto& vec,
auto def) { vec.resize(un, def); };
675 tags.resize(un, std::string{});
704 const auto ui =
static_cast<std::size_t
>(idx);
705 auto e = [&](
auto& v) {
if (ui < v.size()) v.erase(v.begin() +
static_cast<std::ptrdiff_t
>(idx)); };
734 const auto base = ui * np;
735 auto erase2d = [&](
auto& v) {
736 if (base + np <= v.size())
737 v.erase(v.begin() +
static_cast<std::ptrdiff_t
>(base),
738 v.begin() +
static_cast<std::ptrdiff_t
>(base + np));
743 if (ui <
hrt.size())
hrt.erase(
hrt.begin() +
static_cast<std::ptrdiff_t
>(idx));
749 const auto base = ui * np;
762 if (n_pollutants > 0) {
763 auto total =
static_cast<std::size_t
>(
count()) *
764 static_cast<std::size_t
>(n_pollutants);
774 if (n_pollutants > 0) {
775 auto total =
static_cast<std::size_t
>(
count()) *
776 static_cast<std::size_t
>(n_pollutants);
777 conc.assign(total, 0.0);
779 hrt.assign(
static_cast<std::size_t
>(
count()), 0.0);
795 type.shrink_to_fit();
803 depth.shrink_to_fit();
804 head.shrink_to_fit();
819 conc.shrink_to_fit();
836 tags.shrink_to_fit();
872 for (std::size_t i = 0; i <
inflow.size(); ++i) {
885 const auto n =
depth.size();
887 for (std::size_t i = 0; i < n; ++i) {
911 std::fill(
conc.begin(),
conc.end(), 0.0);
Definition NodeCoupling.cpp:15
StorageShape
Storage-unit surface-area relation.
Definition NodeData.hpp:88
@ CONICAL
Elliptical cone (p1, p2 = base axes, p3 = side slope)
Definition NodeData.hpp:92
@ PYRAMIDAL
Rectangular pyramid (p1 = length, p2 = width, p3 = side slope)
Definition NodeData.hpp:94
@ PARABOLOID
Elliptical paraboloid(p1, p2 = top axes, p3 = height ≠ 0)
Definition NodeData.hpp:93
@ CYLINDRICAL
Elliptical cylinder (p1 = major axis, p2 = minor axis)
Definition NodeData.hpp:91
@ FUNCTIONAL
Area = c + a*d^b.
Definition NodeData.hpp:90
@ WEIR
Definition LinkData.hpp:46
OutfallType
Outfall boundary condition type.
Definition NodeData.hpp:54
@ NORMAL
Definition NodeData.hpp:56
@ FREE
Definition NodeData.hpp:55
@ FIXED
Definition NodeData.hpp:57
@ TIDAL
Definition NodeData.hpp:58
NodeType
Node type codes.
Definition NodeData.hpp:43
@ JUNCTION
Definition NodeData.hpp:44
@ DIVIDER
Definition NodeData.hpp:46
@ STORAGE
Definition NodeData.hpp:47
@ OUTFALL
Definition NodeData.hpp:45
DividerType
Flow divider type.
Definition NodeData.hpp:66
@ CUTOFF
Definition NodeData.hpp:67
@ TABULAR
Definition NodeData.hpp:69
@ OVERFLOW_DIV
Renamed from OVERFLOW to avoid macOS math.h macro collision.
Definition NodeData.hpp:68
@ TIMESERIES
Data from an in-file [TIMESERIES].
Definition GageData.hpp:42
Structure-of-Arrays storage for all nodes.
Definition NodeData.hpp:114
std::vector< double > coupling_inflow
2D ↔ 1D coupling exchange flow at the node (project flow units).
Definition NodeData.hpp:246
std::vector< double > stat_lat_inflow_vol
Definition NodeData.hpp:516
int count() const noexcept
Number of nodes.
Definition NodeData.hpp:568
std::vector< double > depth
Current water depth above invert (project length units).
Definition NodeData.hpp:172
std::vector< double > invert_elev
Invert elevation (project length units).
Definition NodeData.hpp:127
std::vector< double > ext_inflow
External (timeseries/baseline) inflows (project flow units).
Definition NodeData.hpp:214
std::vector< double > conc_old
Previous-step quality at each node.
Definition NodeData.hpp:316
std::vector< double > iface_inflow
Interface file (upstream model coupling) inflows (project flow units).
Definition NodeData.hpp:223
std::vector< double > qual_mass_in
Accumulated quality mass inflow rate per (node, pollutant).
Definition NodeData.hpp:270
std::vector< double > stat_vol_flooded
Total volume of water lost as overflow (project volume units).
Definition NodeData.hpp:446
std::vector< double > stat_time_courant_critical
CFL time-step critical count per node.
Definition NodeData.hpp:552
std::vector< double > old_inflow
Total inflow at the previous timestep (for output interpolation).
Definition NodeData.hpp:400
void erase_at(int idx)
Erase the node at index idx from every parallel array.
Definition NodeData.hpp:703
std::vector< double > hrt
Hydraulic residence time for storage nodes (seconds).
Definition NodeData.hpp:319
std::vector< double > old_depth
Depth at the previous timestep.
Definition NodeData.hpp:388
void reset_state() noexcept
Reset state variables, applying init_depth from input.
Definition NodeData.hpp:884
std::vector< double > qual_vol_in
Accumulated volume inflow rate per node (ft3/sec).
Definition NodeData.hpp:273
std::vector< double > coupling_volume
Pending 1D↔2D exchange VOLUME for the next routing step (1D units, ft³).
Definition NodeData.hpp:261
std::vector< double > old_volume
Volume at the previous timestep.
Definition NodeData.hpp:391
std::vector< double > stat_total_outflow_vol
Definition NodeData.hpp:523
std::vector< double > user_conc_mass_flux
User-forced quality mass flux at each node (mass/sec).
Definition NodeData.hpp:330
void shrink_to_fit()
Release excess vector capacity accumulated during parsing.
Definition NodeData.hpp:794
std::vector< double > stat_max_surcharge_height
Definition NodeData.hpp:498
std::vector< double > stat_max_overflow
Maximum reported overflow rate (project flow units).
Definition NodeData.hpp:464
std::vector< char > rpt_flag
Whether this node is included in report/output (0=no, 1=yes).
Definition NodeData.hpp:436
std::vector< double > outflow
Current total outflow from the node (project flow units).
Definition NodeData.hpp:345
void clearInflowSources() noexcept
Zero routing-phase inflow source arrays.
Definition NodeData.hpp:925
std::vector< double > overflow
Current overflow / ponded flow (project flow units).
Definition NodeData.hpp:351
std::vector< double > old_net_inflow
Net inflow from previous timestep (inflow - outflow) for averaging.
Definition NodeData.hpp:375
std::vector< double > stat_max_depth_date
Definition NodeData.hpp:482
std::vector< double > stat_max_lat_inflow
Definition NodeData.hpp:508
std::vector< double > stat_outfall_max_flow
Outfall maximum flow (project flow units).
Definition NodeData.hpp:529
std::vector< double > volume
Current water volume (project volume units).
Definition NodeData.hpp:184
int conc_n_pollutants
Number of pollutants in the quality arrays.
Definition NodeData.hpp:333
std::vector< double > iface_qual_mass
Routing interface file quality mass rate per (node, pollutant) (mass/sec).
Definition NodeData.hpp:283
std::vector< double > lat_flow
Current lateral inflow (project flow units).
Definition NodeData.hpp:190
std::vector< double > ponded_area
Ponding area at the surface (sq project length units).
Definition NodeData.hpp:151
std::vector< double > stat_total_inflow_vol
Cumulative total inflow volume at each node (ft3).
Definition NodeData.hpp:519
std::vector< double > sur_depth
Maximum depth allowed at the node (ponding or surcharge limit).
Definition NodeData.hpp:145
std::vector< double > crown_elev
Crown elevation — top of highest connecting conduit (project length units).
Definition NodeData.hpp:363
std::vector< double > stat_max_inflow_date
Definition NodeData.hpp:490
std::vector< double > old_lat_flow
Lateral flow at the previous timestep.
Definition NodeData.hpp:394
std::vector< double > stat_outfall_avg_flow
Outfall cumulative average flow (flow units × reporting periods).
Definition NodeData.hpp:504
std::vector< double > inflow
Current total inflow to the node (project flow units).
Definition NodeData.hpp:339
void save_state() noexcept
Snapshot current state into old-step arrays before solving.
Definition NodeData.hpp:865
std::vector< double > stat_time_surcharged
Definition NodeData.hpp:494
std::vector< double > stat_max_depth
Maximum reported depth (project length units).
Definition NodeData.hpp:458
std::vector< long > stat_outfall_periods
Outfall number of non-zero flow periods.
Definition NodeData.hpp:535
void resize_loads(int n_pollutants)
Resize pollutant load arrays after pollutant count is known.
Definition NodeData.hpp:760
std::vector< double > conc
Current quality concentration at each node.
Definition NodeData.hpp:313
std::vector< int > degree
Node degree — number of connecting links (+ve downstream, -ve upstream terminal).
Definition NodeData.hpp:369
std::vector< double > lid_drain_qual_vol
LID drain volume inflow rate per node (ft3/sec).
Definition NodeData.hpp:302
std::vector< double > runoff_inflow
Interpolated surface runoff from subcatchments (project flow units).
Definition NodeData.hpp:208
std::vector< double > dwf_inflow
Dry weather flow inflows (project flow units).
Definition NodeData.hpp:217
std::vector< double > stat_time_flooded
Total duration the node was flooded (seconds).
Definition NodeData.hpp:452
std::vector< std::string > tags
Per-object tag from the INP [TAGS] section.
Definition NodeData.hpp:428
std::vector< double > lid_drain_qual_load
LID drain quality mass rate per (node, pollutant) (mass/sec).
Definition NodeData.hpp:294
std::vector< double > stat_sum_volume
Definition NodeData.hpp:478
std::vector< double > stat_sum_depth
Definition NodeData.hpp:471
std::vector< double > stat_max_rpt_depth
Definition NodeData.hpp:486
std::vector< double > init_depth
Initial water depth (project length units).
Definition NodeData.hpp:139
std::vector< double > stat_total_load
Cumulative pollutant loads at each node.
Definition NodeData.hpp:560
void resize(int n)
Resize all arrays to hold exactly n nodes.
Definition NodeData.hpp:577
std::vector< int > stat_non_converged_count
Count of non-converging steps per node.
Definition NodeData.hpp:543
std::vector< double > full_volume
Full volume at node (project volume units).
Definition NodeData.hpp:381
std::vector< double > stat_max_overflow_date
Date/time when maximum overflow occurred (OADate (days since 12/30/1899)).
Definition NodeData.hpp:467
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:415
std::vector< double > losses
Node losses (evaporation + seepage) (project flow units).
Definition NodeData.hpp:357
void grow_to(int n)
Grow all arrays to hold at least n nodes, preserving existing data.
Definition NodeData.hpp:654
std::vector< NodeType > type
Node type for each node.
Definition NodeData.hpp:121
std::vector< double > full_depth
Full depth of the node (project length units).
Definition NodeData.hpp:133
std::vector< double > stat_max_total_inflow
Definition NodeData.hpp:512
std::vector< double > rdii_inflow
RDII unit hydrograph inflows (project flow units).
Definition NodeData.hpp:220
void resize_quality(int n_pollutants)
Resize per-node quality arrays after pollutant count is known.
Definition NodeData.hpp:772
std::vector< double > head
Current water surface head (project length units = invert + depth).
Definition NodeData.hpp:178
std::vector< double > gw_inflow
Interpolated groundwater flow from subcatchments (project flow units).
Definition NodeData.hpp:211
std::vector< double > user_lat_flow
User-forced lateral inflow set via the API (project flow units).
Definition NodeData.hpp:199
int stat_n_pollutants
Definition NodeData.hpp:561