![]() |
OpenSWMM Engine
6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
|
Structure-of-Arrays storage for all links. More...
#include <LinkData.hpp>
Public Member Functions | |
| int | count () const noexcept |
| void | resize (int n) |
| void | grow_to (int n) |
Grow all arrays to hold at least n links, preserving existing data. | |
| void | erase_at (int idx) |
Erase the link at index idx from every parallel array. | |
| void | resize_loads (int n_pollutants) |
| Resize pollutant load arrays after pollutant count is known. | |
| void | resize_quality (int n_pollutants) |
| Resize per-link quality arrays after pollutant count is known. | |
| void | shrink_to_fit () |
| Release excess vector capacity accumulated during parsing. | |
| void | save_state () noexcept |
| void | reset_state () noexcept |
Public Attributes | |
| std::vector< LinkType > | type |
| Link type. | |
| std::vector< int > | node1 |
| Upstream node index. | |
| std::vector< int > | node2 |
| Downstream node index. | |
| std::vector< double > | offset1 |
| Link offset at upstream node (project length units above invert). | |
| std::vector< double > | offset2 |
| Link offset at downstream node. | |
| std::vector< double > | q0 |
| Initial flow rate (project flow units). | |
| std::vector< double > | q_limit |
| Maximum allowable flow rate (project flow units, 0 = unlimited). | |
| std::vector< XsectShape > | xsect_shape |
| Cross-section shape. | |
| std::vector< double > | xsect_y_full |
| Full depth of cross-section (project length units). | |
| std::vector< double > | xsect_a_full |
| Full-flow area of cross-section (sq project length units). | |
| std::vector< double > | xsect_w_max |
| Full hydraulic width of cross-section. | |
| std::vector< int > | xsect_curve |
| Shape curve index (for IRREGULAR / CUSTOM shapes). | |
| std::vector< double > | roughness |
| Manning's roughness coefficient. | |
| std::vector< double > | length |
| Conduit length (project length units). | |
| std::vector< double > | slope |
| Conduit slope (rise/run, dimensionless). | |
| std::vector< double > | mod_length |
| Modified conduit length for CFL stability (project length units). | |
| std::vector< int > | barrels |
| Number of identical barrels (conduits only, default 1). | |
| std::vector< double > | beta |
| Manning conveyance factor: beta = PHI * sqrt(|slope|) / n. | |
| std::vector< double > | rough_factor |
| Roughness factor for head loss: GRAVITY * (n/PHI)^2. | |
| std::vector< double > | q_full |
| Full-pipe flow rate: q_full = xsect_s_full * beta. | |
| std::vector< double > | xsect_r_full |
| Full-pipe hydraulic radius. | |
| std::vector< double > | xsect_s_full |
| Full-pipe section factor. | |
| std::vector< double > | xsect_s_max |
| Maximum section factor (at depth of max conveyance). | |
| std::vector< double > | q_max |
| Maximum flow rate at sMax: q_max = xsect_s_max * beta. | |
| std::vector< double > | xsect_y_bot |
| Bottom depth for FILLED_CIRCULAR, RECT_TRIANG, RECT_ROUND shapes. | |
| std::vector< double > | xsect_a_bot |
| Bottom area for FILLED_CIRCULAR, RECT_TRIANG shapes. | |
| std::vector< double > | xsect_s_bot |
| Multi-purpose shape param: side slope (RECT_TRIANG), C-factor (FORCE_MAIN), number of open sides (RECT_OPEN), etc. | |
| std::vector< double > | xsect_r_bot |
| Multi-purpose shape param: wall length (RECT_TRIANG), wetted perimeter (FILLED_CIRCULAR). | |
| std::vector< double > | xsect_yw_max |
| Depth at maximum width. | |
| std::vector< int > | xsect_batch_shape |
| Cached batch (XSectBatch) shape code, translated from XsectShape at init. | |
| std::vector< double > | setting |
| Current link setting (0-1 for pumps/orifices/weirs, 1.0 default for conduits). | |
| std::vector< double > | target_setting |
| Target setting from control rules. | |
| std::vector< double > | time_last_set |
| Absolute date (decimal days) when target_setting last crossed an open<->closed boundary. Consulted by the control engine for LINK_TIMEOPEN / LINK_TIMECLOSED premises. Updated by the routing layer (SWMMEngine::stepRouting) only on open<->closed transitions, matching legacy routing.c:295-299. | |
| std::vector< int > | direction |
| Flow direction: +1 = node1→node2, -1 = reversed. | |
| std::vector< int > | pump_curve |
| Pump curve index into TableData. | |
| std::vector< bool > | pump_init_state |
| Initial pump on/off state. | |
| std::vector< double > | pump_startup |
| Pump startup depth (ft). | |
| std::vector< double > | pump_shutoff |
| Pump shutoff depth (ft). | |
| std::vector< int > | pump_curve_type |
| Pump curve type: 1=TYPE1..5=TYPE5, 6=Ideal, -1=not a pump. | |
| std::vector< std::string > | pump_curve_name |
| Pump curve name (for deferred resolution). | |
| std::vector< double > | loss_inlet |
| Inlet loss coefficient. | |
| std::vector< double > | loss_outlet |
| Outlet loss coefficient. | |
| std::vector< double > | loss_avg |
| Average loss coefficient. | |
| std::vector< uint8_t > | has_flap_gate |
| Flap gate on this conduit (uint8_t: 0=no, 1=yes). | |
| std::vector< double > | seep_rate |
| User-specified seepage rate (project units). | |
| std::vector< double > | evap_loss_rate |
| Computed conduit evaporation loss rate (cfs per barrel). | |
| std::vector< double > | seep_loss_rate |
| Computed conduit seepage loss rate (cfs per barrel). | |
| std::vector< int > | culvert_code |
| Culvert type code (1-57, 0 = not a culvert). | |
| std::vector< uint8_t > | normal_flow_limited |
| std::vector< uint8_t > | inlet_control |
| True if inlet control governs for this culvert link (uint8_t: 0=no, 1=yes). | |
| std::vector< double > | dqdh |
| Derivative dQ/dH for inlet-controlled culvert flow. | |
| std::vector< double > | crest_height |
| Crest height above upstream node invert (project length units). | |
| std::vector< double > | cd |
| Discharge coefficient (dimensionless). | |
| std::vector< double > | param1 |
| Parameter 1 (orifice type: 0=BOTTOM, 1=SIDE; weir type encoding). | |
| std::vector< double > | param2 |
| Rated capacity or parameter 2 (weir side slopes, orifice area, etc.). | |
| std::vector< double > | orate |
| Orifice open/close rate (fraction per second). | |
| std::vector< double > | flow |
| Current flow rate (project flow units, +ve = node1→node2). | |
| std::vector< double > | depth |
| Current water depth at midpoint (project length units). | |
| std::vector< double > | volume |
| Current full-flow volume (project volume units). | |
| std::vector< double > | froude |
| Current froude number (absolute). | |
| std::vector< FlowClass > | flow_class |
| Current flow class (DRY, SUBCRITICAL, etc.). | |
| std::vector< uint8_t > | is_closed |
| True if the link is closed by a control rule (uint8_t: 0=no, 1=yes). | |
| std::vector< int8_t > | full_state |
| End-of-step full-pipe classification: 0=neither, 1=UP_FULL, 2=DN_FULL, 3=ALL_FULL. | |
| std::vector< double > | old_flow |
| Flow at the previous timestep. | |
| std::vector< double > | old_depth |
| Depth at the previous timestep. | |
| std::vector< double > | old_volume |
| Volume at the previous timestep. | |
| std::vector< double > | conc |
| Current quality concentration in each link. | |
| std::vector< double > | conc_old |
| Previous-step quality in each link. | |
| int | conc_n_pollutants = 0 |
| Number of pollutants in the quality arrays. | |
| std::vector< std::string > | comments |
| Object comment from the INP file (';'-prefixed lines immediately above this link's data row), joined by literal "\\n". Empty string means no comment. | |
| std::vector< std::string > | tags |
Per-object tag from the INP [TAGS] section. | |
| std::vector< char > | rpt_flag |
| Whether this link is included in report/output (0=no, 1=yes). | |
| std::vector< double > | stat_vol_flow |
| Total volume conveyed by this link (project volume units). | |
| std::vector< double > | stat_max_flow |
| Maximum reported flow rate (project flow units). | |
| std::vector< double > | stat_max_veloc |
| Maximum reported flow velocity (project length/time units). | |
| std::vector< double > | stat_max_filling |
| Maximum reported filling ratio (depth / full depth). | |
| std::vector< double > | stat_time_surcharged |
| Total duration of surcharge (seconds). | |
| std::vector< long > | stat_flow_class |
| std::vector< long > | stat_norm_ltd |
| Count of steps with normal flow limiting. | |
| std::vector< long > | stat_inlet_ctrl |
| Count of steps with inlet control. | |
| std::vector< double > | stat_max_flow_date |
| std::vector< double > | stat_time_full_upstream |
| std::vector< double > | stat_time_full_dnstream |
| std::vector< double > | stat_time_full_both |
| std::vector< double > | stat_time_capacity_limited |
| std::vector< double > | stat_total_load |
| Cumulative pollutant loads transported through each link. | |
| int | stat_n_pollutants = 0 |
| std::vector< int > | stat_pump_cycles |
| Number of pump on→off + off→on transitions per pump. | |
| std::vector< double > | stat_pump_on_time |
| Time pump was running (seconds). | |
| std::vector< double > | stat_pump_volume |
| Total volume pumped (ft³). | |
| std::vector< double > | stat_pump_energy |
| Total pump energy consumed (kWh). | |
| std::vector< bool > | stat_pump_was_on |
| Previous pump state for cycle detection (true = on). | |
| std::vector< long > | stat_flow_turns |
| Count of flow direction reversals per link. | |
| std::vector< int > | stat_flow_turn_sign |
| Sign of previous flow change for flow-turn detection. | |
| std::vector< double > | stat_time_courant_critical |
| CFL time-step critical count per link. | |
Static Public Attributes | |
| static constexpr int | N_FLOW_CLASSES = 7 |
| Per-link flow classification step counts. | |
Structure-of-Arrays storage for all links.
All arrays indexed by link index [0, count). Use SimulationContext::link_names to translate name → index.
|
inlinenoexcept |
|
inline |
Erase the link at index idx from every parallel array.
Removes the element at idx from every SoA vector. Flat-2D arrays (stat_flow_class, conc, conc_old, stat_total_load) have their full stride for idx removed. Spatial arrays are erased separately by ObjectDeleter.
|
inline |
Grow all arrays to hold at least n links, preserving existing data.
|
inlinenoexcept |
|
inline |
|
inline |
Resize pollutant load arrays after pollutant count is known.
|
inline |
Resize per-link quality arrays after pollutant count is known.
|
inlinenoexcept |
|
inline |
Release excess vector capacity accumulated during parsing.
| std::vector<int> openswmm::LinkData::barrels |
Number of identical barrels (conduits only, default 1).
| std::vector<double> openswmm::LinkData::beta |
| std::vector<double> openswmm::LinkData::cd |
Discharge coefficient (dimensionless).
| std::vector<std::string> openswmm::LinkData::comments |
Object comment from the INP file (';'-prefixed lines immediately above this link's data row), joined by literal "\\n". Empty string means no comment.
| std::vector<double> openswmm::LinkData::conc |
Current quality concentration in each link.
Size = n_links * n_pollutants.
| int openswmm::LinkData::conc_n_pollutants = 0 |
Number of pollutants in the quality arrays.
| std::vector<double> openswmm::LinkData::conc_old |
Previous-step quality in each link.
| std::vector<double> openswmm::LinkData::crest_height |
Crest height above upstream node invert (project length units).
| std::vector<int> openswmm::LinkData::culvert_code |
Culvert type code (1-57, 0 = not a culvert).
| std::vector<double> openswmm::LinkData::depth |
Current water depth at midpoint (project length units).
| std::vector<int> openswmm::LinkData::direction |
| std::vector<double> openswmm::LinkData::dqdh |
| std::vector<double> openswmm::LinkData::evap_loss_rate |
Computed conduit evaporation loss rate (cfs per barrel).
| std::vector<double> openswmm::LinkData::flow |
Current flow rate (project flow units, +ve = node1→node2).
| std::vector<FlowClass> openswmm::LinkData::flow_class |
Current flow class (DRY, SUBCRITICAL, etc.).
| std::vector<double> openswmm::LinkData::froude |
| std::vector<int8_t> openswmm::LinkData::full_state |
End-of-step full-pipe classification: 0=neither, 1=UP_FULL, 2=DN_FULL, 3=ALL_FULL.
Set by KW/DW/Steady-flow solvers each routing step. Bit 0 = upstream end at or above full depth; bit 1 = downstream end.
| std::vector<uint8_t> openswmm::LinkData::has_flap_gate |
Flap gate on this conduit (uint8_t: 0=no, 1=yes).
| std::vector<uint8_t> openswmm::LinkData::inlet_control |
True if inlet control governs for this culvert link (uint8_t: 0=no, 1=yes).
| std::vector<uint8_t> openswmm::LinkData::is_closed |
True if the link is closed by a control rule (uint8_t: 0=no, 1=yes).
| std::vector<double> openswmm::LinkData::length |
Conduit length (project length units).
| std::vector<double> openswmm::LinkData::loss_avg |
Average loss coefficient.
| std::vector<double> openswmm::LinkData::loss_inlet |
Inlet loss coefficient.
| std::vector<double> openswmm::LinkData::loss_outlet |
Outlet loss coefficient.
| std::vector<double> openswmm::LinkData::mod_length |
Modified conduit length for CFL stability (project length units).
Computed as lengthFactor * length where lengthFactor >= 1.0. Short conduits are virtually lengthened to satisfy the Courant criterion at full-flow conditions.
|
staticconstexpr |
Per-link flow classification step counts.
Flat 2D: [link * N_FLOW_CLASSES + class], where N_FLOW_CLASSES = 7. Indexed by FlowClass enum (DRY=0..DN_CRITICAL=6).
| std::vector<uint8_t> openswmm::LinkData::normal_flow_limited |
True if normal flow limitation was applied this step (uint8_t: 0=no, 1=yes).
| std::vector<double> openswmm::LinkData::offset1 |
| std::vector<double> openswmm::LinkData::offset2 |
| std::vector<double> openswmm::LinkData::old_depth |
Depth at the previous timestep.
| std::vector<double> openswmm::LinkData::old_flow |
Flow at the previous timestep.
| std::vector<double> openswmm::LinkData::old_volume |
Volume at the previous timestep.
| std::vector<double> openswmm::LinkData::orate |
| std::vector<double> openswmm::LinkData::param1 |
Parameter 1 (orifice type: 0=BOTTOM, 1=SIDE; weir type encoding).
| std::vector<double> openswmm::LinkData::param2 |
Rated capacity or parameter 2 (weir side slopes, orifice area, etc.).
| std::vector<int> openswmm::LinkData::pump_curve |
Pump curve index into TableData.
| std::vector<std::string> openswmm::LinkData::pump_curve_name |
Pump curve name (for deferred resolution).
| std::vector<int> openswmm::LinkData::pump_curve_type |
| std::vector<bool> openswmm::LinkData::pump_init_state |
Initial pump on/off state.
| std::vector<double> openswmm::LinkData::pump_shutoff |
Pump shutoff depth (ft).
| std::vector<double> openswmm::LinkData::pump_startup |
Pump startup depth (ft).
| std::vector<double> openswmm::LinkData::q0 |
| std::vector<double> openswmm::LinkData::q_full |
Full-pipe flow rate: q_full = xsect_s_full * beta.
| std::vector<double> openswmm::LinkData::q_limit |
Maximum allowable flow rate (project flow units, 0 = unlimited).
| std::vector<double> openswmm::LinkData::q_max |
Maximum flow rate at sMax: q_max = xsect_s_max * beta.
| std::vector<double> openswmm::LinkData::rough_factor |
Roughness factor for head loss: GRAVITY * (n/PHI)^2.
| std::vector<double> openswmm::LinkData::roughness |
Manning's roughness coefficient.
| std::vector<char> openswmm::LinkData::rpt_flag |
Whether this link is included in report/output (0=no, 1=yes).
| std::vector<double> openswmm::LinkData::seep_loss_rate |
Computed conduit seepage loss rate (cfs per barrel).
| std::vector<double> openswmm::LinkData::seep_rate |
User-specified seepage rate (project units).
| std::vector<double> openswmm::LinkData::setting |
| std::vector<double> openswmm::LinkData::slope |
Conduit slope (rise/run, dimensionless).
| std::vector<long> openswmm::LinkData::stat_flow_class |
| std::vector<int> openswmm::LinkData::stat_flow_turn_sign |
Sign of previous flow change for flow-turn detection.
+1 or -1 indicating the sign of (newFlow - oldFlow) at the previous routing step (matching legacy LinkStats[i].flowTurnSign).
| std::vector<long> openswmm::LinkData::stat_flow_turns |
Count of flow direction reversals per link.
Incremented when the sign of (newFlow - oldFlow) reverses and the magnitude exceeds 0.001 (matching legacy LinkStats[i].flowTurns).
| std::vector<long> openswmm::LinkData::stat_inlet_ctrl |
Count of steps with inlet control.
| std::vector<double> openswmm::LinkData::stat_max_filling |
Maximum reported filling ratio (depth / full depth).
| std::vector<double> openswmm::LinkData::stat_max_flow |
Maximum reported flow rate (project flow units).
| std::vector<double> openswmm::LinkData::stat_max_flow_date |
Date/time when maximum flow occurred (OADate (days since 12/30/1899)).
| std::vector<double> openswmm::LinkData::stat_max_veloc |
Maximum reported flow velocity (project length/time units).
| int openswmm::LinkData::stat_n_pollutants = 0 |
| std::vector<long> openswmm::LinkData::stat_norm_ltd |
Count of steps with normal flow limiting.
| std::vector<int> openswmm::LinkData::stat_pump_cycles |
Number of pump on→off + off→on transitions per pump.
| std::vector<double> openswmm::LinkData::stat_pump_energy |
Total pump energy consumed (kWh).
| std::vector<double> openswmm::LinkData::stat_pump_on_time |
Time pump was running (seconds).
| std::vector<double> openswmm::LinkData::stat_pump_volume |
Total volume pumped (ft³).
| std::vector<bool> openswmm::LinkData::stat_pump_was_on |
Previous pump state for cycle detection (true = on).
| std::vector<double> openswmm::LinkData::stat_time_capacity_limited |
Time above full normal flow (seconds).
| std::vector<double> openswmm::LinkData::stat_time_courant_critical |
CFL time-step critical count per link.
Incremented when the link's CFL condition produces the smallest adaptive timestep (matching legacy LinkStats[i].timeCourantCritical).
| std::vector<double> openswmm::LinkData::stat_time_full_both |
Time both ends surcharged (seconds).
| std::vector<double> openswmm::LinkData::stat_time_full_dnstream |
Time of downstream surcharge (seconds).
| std::vector<double> openswmm::LinkData::stat_time_full_upstream |
Time of upstream surcharge (seconds).
| std::vector<double> openswmm::LinkData::stat_time_surcharged |
Total duration of surcharge (seconds).
| std::vector<double> openswmm::LinkData::stat_total_load |
Cumulative pollutant loads transported through each link.
Flat 2D: [link * n_pollutants + p]. Resized by resize_loads() after pollutant count is known.
| std::vector<double> openswmm::LinkData::stat_vol_flow |
Total volume conveyed by this link (project volume units).
| std::vector<std::string> openswmm::LinkData::tags |
Per-object tag from the INP [TAGS] section.
Free-form string label. Index-keyed so swmm_link_rename keeps the tag attached.
| std::vector<double> openswmm::LinkData::target_setting |
Target setting from control rules.
| std::vector<double> openswmm::LinkData::time_last_set |
Absolute date (decimal days) when target_setting last crossed an open<->closed boundary. Consulted by the control engine for LINK_TIMEOPEN / LINK_TIMECLOSED premises. Updated by the routing layer (SWMMEngine::stepRouting) only on open<->closed transitions, matching legacy routing.c:295-299.
| std::vector<LinkType> openswmm::LinkData::type |
Link type.
| std::vector<double> openswmm::LinkData::volume |
Current full-flow volume (project volume units).
| std::vector<double> openswmm::LinkData::xsect_a_bot |
Bottom area for FILLED_CIRCULAR, RECT_TRIANG shapes.
| std::vector<double> openswmm::LinkData::xsect_a_full |
Full-flow area of cross-section (sq project length units).
| std::vector<int> openswmm::LinkData::xsect_batch_shape |
Cached batch (XSectBatch) shape code, translated from XsectShape at init.
Avoids per-timestep translateShape() switch dispatch. Set once by Routing::init() or PostParseResolver.
| std::vector<int> openswmm::LinkData::xsect_curve |
Shape curve index (for IRREGULAR / CUSTOM shapes).
-1 for standard shapes.
| std::vector<double> openswmm::LinkData::xsect_r_bot |
Multi-purpose shape param: wall length (RECT_TRIANG), wetted perimeter (FILLED_CIRCULAR).
| std::vector<double> openswmm::LinkData::xsect_r_full |
Full-pipe hydraulic radius.
| std::vector<double> openswmm::LinkData::xsect_s_bot |
Multi-purpose shape param: side slope (RECT_TRIANG), C-factor (FORCE_MAIN), number of open sides (RECT_OPEN), etc.
| std::vector<double> openswmm::LinkData::xsect_s_full |
Full-pipe section factor.
| std::vector<double> openswmm::LinkData::xsect_s_max |
Maximum section factor (at depth of max conveyance).
| std::vector<XsectShape> openswmm::LinkData::xsect_shape |
Cross-section shape.
| std::vector<double> openswmm::LinkData::xsect_w_max |
Full hydraulic width of cross-section.
| std::vector<double> openswmm::LinkData::xsect_y_bot |
Bottom depth for FILLED_CIRCULAR, RECT_TRIANG, RECT_ROUND shapes.
| std::vector<double> openswmm::LinkData::xsect_y_full |
Full depth of cross-section (project length units).
| std::vector<double> openswmm::LinkData::xsect_yw_max |
Depth at maximum width.