OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
LinkSubtypes.hpp File Reference

Relational (normalized) Structure-of-Arrays side-tables for link subtypes. More...

#include <algorithm>
#include <vector>
#include <cstdint>
#include <string>
#include <type_traits>
#include "LinkData.hpp"
Include dependency graph for LinkSubtypes.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  openswmm::ConduitData
 Dense SoA for conduit-only properties (one row per CONDUIT link). More...
 
struct  openswmm::PumpData
 
struct  openswmm::OrificeData
 
struct  openswmm::WeirData
 
struct  openswmm::OutletData
 
struct  openswmm::LinkSubtypes
 Owns the five link subtype side-tables plus the reverse index map. More...
 

Namespaces

namespace  openswmm
 

Detailed Description

Relational (normalized) Structure-of-Arrays side-tables for link subtypes.

Phase 6 of the relational refactor — the link analogue of NodeSubtypes.hpp. The wide LinkData SoA allocates every conduit/pump/orifice/weir/outlet field for all links even though each field is only valid when type[i] matches. This header holds dense per-subtype side-tables — one per link type — sized to that type's count and joined back to the base link by a stored link_idx ("foreign key"). A reverse map (subtype_row) gives O(1) base-index → row lookup.

Authoritative: the side-tables are the single source of truth for subtype config. Parse/edit writers populate the rows directly; the StructureSolver / XSectGroups init source-reads and the C-API read them. Rows are kept in ascending link_idx order so per-row iteration matches a base-link-ascending scan bit-for-bit.

Design note — shared fields stay on base LinkData: the cross section (xsect_*), has_flap_gate, and pump_curve_name are used by more than one link type (xsect/has_flap by conduit+orifice+weir; pump_curve_name by pump+outlet+conduit-IRREGULAR), so they remain on the base LinkData rather than any one subtype table. Only the unambiguously type-specific fields move here. Structures are split into Orifice/Weir/Outlet with NAMED columns over the type-overloaded wide param1/param2 discriminators (stored as double to preserve bit-for-bit parity with the legacy compute).

See also
src/engine/data/NodeSubtypes.hpp — the node analogue (same API shape)
src/engine/data/LinkData.hpp — base LinkData SoA
Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
License\n MIT License