54#ifndef OPENSWMM_ENGINE_NODE_SUBTYPES_HPP
55#define OPENSWMM_ENGINE_NODE_SUBTYPES_HPP
77 std::vector<LidNodeConfig>
lid;
87 std::vector<StorageShape>
shape;
90 std::vector<double>
a;
93 std::vector<double>
b;
95 std::vector<double>
c;
99 std::vector<double>
p1;
101 std::vector<double>
p2;
103 std::vector<double>
p3;
168 const auto un =
static_cast<std::size_t
>(n);
204 const auto p =
static_cast<std::ptrdiff_t
>(
212 a.insert(
a.begin() + p, 0.0);
213 b.insert(
b.begin() + p, 0.0);
214 c.insert(
c.begin() + p, 0.0);
215 p1.insert(
p1.begin() + p, 0.0);
216 p2.insert(
p2.begin() + p, 0.0);
217 p3.insert(
p3.begin() + p, 0.0);
228 return static_cast<int>(p);
241 const auto p =
static_cast<std::ptrdiff_t
>(r);
246 a.erase(
a.begin() + p);
247 b.erase(
b.begin() + p);
248 c.erase(
c.begin() + p);
249 p1.erase(
p1.begin() + p);
250 p2.erase(
p2.begin() + p);
251 p3.erase(
p3.begin() + p);
260 lid.erase(
lid.begin() + p);
334 const auto un =
static_cast<std::size_t
>(n);
360 const auto p =
static_cast<std::ptrdiff_t
>(
372 return static_cast<int>(p);
385 const auto p =
static_cast<std::ptrdiff_t
>(r);
416 std::vector<double>
cd;
461 const auto un =
static_cast<std::size_t
>(n);
486 const auto p =
static_cast<std::ptrdiff_t
>(
491 cd.insert(
cd.begin() + p, 0.0);
497 return static_cast<int>(p);
510 const auto p =
static_cast<std::ptrdiff_t
>(r);
514 cd.erase(
cd.begin() + p);
567 subtype_row.assign(
static_cast<std::size_t
>(n_nodes), -1);
568 for (
int r = 0; r <
storages.count(); ++r)
571 for (
int r = 0; r <
outfalls.count(); ++r)
574 for (
int r = 0; r <
dividers.count(); ++r)
595 const auto ui =
static_cast<std::size_t
>(i);
597 subtype_row.resize(
static_cast<std::size_t
>(i) + 1, -1);
604 if (old == t && existing >= 0)
607 bool shifted =
false;
669 auto drop = [i](
auto& tbl) ->
bool {
670 for (
int r = 0; r < tbl.count(); ++r)
671 if (tbl.node_idx[
static_cast<std::size_t
>(r)] == i) {
679 auto shift = [i](std::vector<int>& keys) {
702 if (i >= 0 && i <
static_cast<int>(
subtype_row.size())) {
703 const int r =
subtype_row[
static_cast<std::size_t
>(i)];
704 if (r >= 0 && r <
storages.count() &&
705 storages.node_idx[
static_cast<std::size_t
>(r)] == i)
722 if (i >= 0 && i <
static_cast<int>(
subtype_row.size())) {
723 const int r =
subtype_row[
static_cast<std::size_t
>(i)];
724 if (r >= 0 && r <
outfalls.count() &&
725 outfalls.node_idx[
static_cast<std::size_t
>(r)] == i)
742 if (i >= 0 && i <
static_cast<int>(
subtype_row.size())) {
743 const int r =
subtype_row[
static_cast<std::size_t
>(i)];
744 if (r >= 0 && r <
dividers.count() &&
745 dividers.node_idx[
static_cast<std::size_t
>(r)] == i)
Data-oriented storage for LID node layers, properties, and state.
Structure-of-Arrays (SoA) storage for all node types.
Definition ExchangeLaw.hpp:60
@ FUNCTIONAL
Area = c + a*d^b.
Definition NodeData.hpp:101
@ FREE
Definition NodeData.hpp:71
NodeType
Node type codes.
Definition NodeData.hpp:65
@ JUNCTION
Definition NodeData.hpp:65
@ DIVIDER
Definition NodeData.hpp:65
@ STORAGE
Definition NodeData.hpp:65
@ OUTFALL
Definition NodeData.hpp:65
@ CUTOFF
Definition NodeData.hpp:78
Dense SoA for flow-divider properties (one row per DIVIDER node).
Definition NodeSubtypes.hpp:407
std::vector< double > cd
Weir discharge coefficient for WEIR dividers.
Definition NodeSubtypes.hpp:416
std::vector< std::string > link_name
Diversion link name (deferred resolution).
Definition NodeSubtypes.hpp:424
std::vector< int > curve
Diversion curve index for TABULAR dividers (-1 = none).
Definition NodeSubtypes.hpp:420
std::vector< double > cutoff
Cutoff flow for CUTOFF dividers.
Definition NodeSubtypes.hpp:414
void clear() noexcept
Erase all DividerData rows while retaining vector capacities.
Definition NodeSubtypes.hpp:440
std::vector< DividerType > method
Diversion method (CUTOFF/OVERFLOW/TABULAR/WEIR).
Definition NodeSubtypes.hpp:412
int count() const noexcept
Count DividerData rows from the base-object join-key column.
Definition NodeSubtypes.hpp:432
int add_default(int i)
Insert a default DividerData row at the sorted base-object key position.
Definition NodeSubtypes.hpp:485
std::vector< double > max_depth
Weir max depth for WEIR dividers.
Definition NodeSubtypes.hpp:418
void reserve(int n)
Request capacity for each DividerData column without changing row count.
Definition NodeSubtypes.hpp:460
std::vector< int > link
Diversion link index (-1 = not set).
Definition NodeSubtypes.hpp:422
std::vector< std::string > curve_name
Diversion curve name (deferred resolution, TABULAR only).
Definition NodeSubtypes.hpp:426
void erase_at(int r)
Erase dense DividerData row data and shift later dense rows down.
Definition NodeSubtypes.hpp:509
std::vector< int > node_idx
Base NodeData index this row belongs to (the join key).
Definition NodeSubtypes.hpp:409
Definition LidNodeData.hpp:91
Definition LidNodeData.hpp:54
Structure-of-Arrays storage for all nodes.
Definition NodeData.hpp:125
int count() const noexcept
Number of nodes.
Definition NodeData.hpp:754
std::vector< double > storage_area
Physical junction area (ft2); zero retains legacy behavior.
Definition NodeData.hpp:163
std::vector< NodeType > type
Node type for each node.
Definition NodeData.hpp:132
Owns the three node subtype side-tables plus the reverse index map.
Definition NodeSubtypes.hpp:535
int divider_row(int i) const noexcept
Resolve a base node key into the divider side table.
Definition NodeSubtypes.hpp:741
DividerData dividers
Definition NodeSubtypes.hpp:538
int storage_row(int i) const noexcept
Resolve a base node key into the storage side table.
Definition NodeSubtypes.hpp:701
int set_node_type(NodeData &nodes, int i, NodeType t)
Change one base node type and maintain its dense side-table row.
Definition NodeSubtypes.hpp:594
void erase_node(int i, int n_after)
Drop a deleted base node's subtype row and renumber later join keys.
Definition NodeSubtypes.hpp:667
void rebuild_index(int n_nodes)
Rebuild base node indices to dense subtype-row lookup.
Definition NodeSubtypes.hpp:566
void clear() noexcept
Erase all owned node subtype tables and reverse-map entries.
Definition NodeSubtypes.hpp:549
OutfallData outfalls
Definition NodeSubtypes.hpp:537
std::vector< int > subtype_row
base node index → row in its subtype table (-1 for junctions).
Definition NodeSubtypes.hpp:541
int outfall_row(int i) const noexcept
Resolve a base node key into the outfall side table.
Definition NodeSubtypes.hpp:721
StorageData storages
Definition NodeSubtypes.hpp:536
Dense SoA for outfall boundary-condition properties (one row per OUTFALL).
Definition NodeSubtypes.hpp:273
std::vector< OutfallType > bc_type
Boundary condition type (FREE/NORMAL/FIXED/TIDAL/TIMESERIES).
Definition NodeSubtypes.hpp:278
void erase_at(int r)
Erase dense OutfallData row data and shift later dense rows down.
Definition NodeSubtypes.hpp:384
std::vector< int > link_idx
Cached connected-conduit index (-1 = none).
Definition NodeSubtypes.hpp:291
std::vector< uint8_t > has_flap_gate
Flap gate present (0/1).
Definition NodeSubtypes.hpp:287
void reserve(int n)
Request capacity for each OutfallData column without changing row count.
Definition NodeSubtypes.hpp:333
std::vector< int > route_to
Subcatchment index to route discharge to (-1 = none).
Definition NodeSubtypes.hpp:289
int count() const noexcept
Count OutfallData rows from the base-object join-key column.
Definition NodeSubtypes.hpp:304
void clear() noexcept
Erase all OutfallData rows while retaining vector capacities.
Definition NodeSubtypes.hpp:312
std::vector< std::string > param_name
Stage-data table name for TIDAL/TIMESERIES, held for deferred name→index resolution in PostParseResol...
Definition NodeSubtypes.hpp:285
std::vector< double > ramp_2d
Cached wet/dry ramp factor [0,1] for the 2D tailwater override (0 = dry → free discharge,...
Definition NodeSubtypes.hpp:298
int add_default(int i)
Insert a default OutfallData row at the sorted base-object key position.
Definition NodeSubtypes.hpp:359
std::vector< double > param
Fixed stage, or tidal/timeseries table index (per bc_type). For TIDAL/TIMESERIES an unresolved refere...
Definition NodeSubtypes.hpp:282
std::vector< double > head_2d
Cached 2D surface head at the coupling point (sentinel -1e30).
Definition NodeSubtypes.hpp:295
std::vector< double > link_offset
Conduit offset at the outfall end.
Definition NodeSubtypes.hpp:293
std::vector< int > node_idx
Base NodeData index this row belongs to (the join key).
Definition NodeSubtypes.hpp:275
Dense SoA for storage-unit properties (one row per STORAGE node).
Definition NodeSubtypes.hpp:76
void clear() noexcept
Erase all StorageData rows while retaining vector capacities.
Definition NodeSubtypes.hpp:136
int add_default(int i)
Insert a default StorageData row at the sorted base-object key position.
Definition NodeSubtypes.hpp:203
int count() const noexcept
Count StorageData rows from the base-object join-key column.
Definition NodeSubtypes.hpp:128
std::vector< double > exfil_rate
Raw (uncapped) exfiltration rate this timestep (cfs), written by ExfilSolver::computeAll and consumed...
Definition NodeSubtypes.hpp:116
void reserve(int n)
Request capacity for each StorageData column without changing row count.
Definition NodeSubtypes.hpp:167
std::vector< double > exfil_imd
Green-Ampt initial moisture deficit for exfiltration (0-1).
Definition NodeSubtypes.hpp:122
std::vector< double > evap_frac
Fraction of potential evaporation realized (0-1).
Definition NodeSubtypes.hpp:107
std::vector< double > exfil_suction
Green-Ampt suction head for exfiltration.
Definition NodeSubtypes.hpp:118
std::vector< double > a
Area coefficient A (legacy a1). FUNCTIONAL: A·d^B; geometric shapes: the linear term of C + A·d + B·d...
Definition NodeSubtypes.hpp:90
std::vector< double > p3
Raw shape parameter 3 — side slope Z (run/rise), or height for PARABOLOID.
Definition NodeSubtypes.hpp:103
std::vector< double > b
Area coefficient B (legacy a2). FUNCTIONAL: the exponent; geometric shapes: the quadratic term.
Definition NodeSubtypes.hpp:93
std::vector< double > seep_rate
Seepage rate (project units/day).
Definition NodeSubtypes.hpp:105
std::vector< LidNodeState > lid_state
Definition NodeSubtypes.hpp:78
std::vector< int > node_idx
Base NodeData index this row belongs to (the join key).
Definition NodeSubtypes.hpp:80
std::vector< int > curve
Storage curve index into TableData (-1 = not tabulated).
Definition NodeSubtypes.hpp:83
std::vector< double > p2
Raw shape parameter 2 — minor axis / base width W.
Definition NodeSubtypes.hpp:101
std::vector< double > exfil_ksat
Green-Ampt saturated conductivity for exfiltration.
Definition NodeSubtypes.hpp:120
std::vector< double > c
Area coefficient C (legacy a0). Baseline area at zero depth.
Definition NodeSubtypes.hpp:95
std::vector< LidNodeConfig > lid
Definition NodeSubtypes.hpp:77
std::vector< std::string > curve_name
Curve name for deferred resolution.
Definition NodeSubtypes.hpp:85
std::vector< double > evap_loss
Evaporation loss this timestep (ft3).
Definition NodeSubtypes.hpp:109
std::vector< double > p1
Raw shape parameter 1 — major axis / base length L (geometric shapes only). Kept alongside the derive...
Definition NodeSubtypes.hpp:99
std::vector< double > exfil_loss
Exfiltration loss this timestep (ft3).
Definition NodeSubtypes.hpp:111
std::vector< StorageShape > shape
Surface-area relation. Selects how a/b/c below are interpreted.
Definition NodeSubtypes.hpp:87
void erase_at(int r)
Erase dense StorageData row data and shift later dense rows down.
Definition NodeSubtypes.hpp:240