![]() |
OpenSWMM Engine
6.0.0-alpha.3
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.3)
|
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< double > | xsect_geom1 |
| Raw [XSECTIONS] geometry parameters as supplied (display units), retained purely for lossless serialization. | |
| std::vector< double > | xsect_geom2 |
| std::vector< double > | xsect_geom3 |
| std::vector< double > | xsect_geom4 |
| std::vector< int > | xsect_curve |
| Shape curve index (for IRREGULAR / CUSTOM shapes). | |
| 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 > | 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< std::string > | pump_curve_name |
| Pump curve name (for deferred resolution). | |
| std::vector< uint8_t > | has_flap_gate |
| Flap gate on this conduit (uint8_t: 0=no, 1=yes). | |
| std::vector< double > | dqdh |
| Derivative dQ/dH for inlet-controlled culvert flow. | |
| 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< 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<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::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::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<uint8_t> openswmm::LinkData::has_flap_gate |
Flap gate on this conduit (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).
|
staticconstexpr |
| 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<std::string> openswmm::LinkData::pump_curve_name |
Pump curve name (for deferred resolution).
| std::vector<double> openswmm::LinkData::q0 |
| std::vector<double> openswmm::LinkData::q_limit |
Maximum allowable flow rate (project flow units, 0 = unlimited).
| std::vector<char> openswmm::LinkData::rpt_flag |
Whether this link is included in report/output (0=no, 1=yes).
| std::vector<double> openswmm::LinkData::setting |
| 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_geom1 |
Raw [XSECTIONS] geometry parameters as supplied (display units), retained purely for lossless serialization.
The computational fields above (xsect_y_full, xsect_w_max, xsect_a_full, xsect_y_bot, xsect_r_bot) are overwritten with derived geometry during initialization (e.g. for a trapezoid xsect_w_max becomes the TOP width, discarding the input bottom width and side slopes), so they cannot reproduce the original Geom1–Geom4. These mirror the four columns exactly so swmm_model_write and swmm_link_get_xsect can round-trip them. xsect_geom1 == 0 marks "not populated" (e.g. objects built by readers that do not set these), in which case writers fall back to the derived fields. Set by swmm_link_set_xsect and the [XSECTIONS] parser.
| std::vector<double> openswmm::LinkData::xsect_geom2 |
| std::vector<double> openswmm::LinkData::xsect_geom3 |
| std::vector<double> openswmm::LinkData::xsect_geom4 |
| 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.