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

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

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

Go to the source code of this file.

Classes

struct  openswmm::StorageData
 Dense SoA for storage-unit properties (one row per STORAGE node). More...
 
struct  openswmm::OutfallData
 Dense SoA for outfall boundary-condition properties (one row per OUTFALL). More...
 
struct  openswmm::DividerData
 Dense SoA for flow-divider properties (one row per DIVIDER node). More...
 
struct  openswmm::NodeSubtypes
 Owns the three node subtype side-tables plus the reverse index map. More...
 

Namespaces

namespace  openswmm
 

Detailed Description

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

Part of the relational node refactor (docs/relational/ RELATIONAL_NODE_REFACTOR_PLAN.md). The wide NodeData struct (src/engine/data/NodeData.hpp) currently allocates every storage/ outfall/divider field for all nodes, even though those fields are only valid when type[i] matches. This header introduces dense side-tables — one per subtype — sized to the count of that subtype, joined back to the base node by a stored node_idx ("foreign key"). A reverse map (subtype_row) gives O(1) base-index → side-table-row lookup.

Phase 4 (authoritative): the side-tables are the single source of truth for subtype config. Parse/edit writers populate the rows directly (no build-from-wide, no verify_mirror/ensure_fresh mirror machinery); compute and the C-API read them. Rows are kept in ascending node_idx order so per-row iteration (e.g. the outfall pass) matches a base-node-ascending scan bit-for-bit. The wide subtype arrays remain on NodeData until they are deleted at the end of the cutover (Phase 4 Stage D).

Structural mutations go through set_node_type (insert/move a row on a type change), erase_node (drop a row + renumber join keys on a base-node delete), and rebuild_index (re-derive the reverse map). subtype_row lives here, not on NodeData.

See also
src/engine/data/NodeData.hpp — base NodeData SoA
src/engine/hydraulics/XSectBatch.hpp — XSectGroups::build (batch pattern)
Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
License\n MIT License