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

Owns the three node subtype side-tables plus the reverse index map. More...

#include <NodeSubtypes.hpp>

Collaboration diagram for openswmm::NodeSubtypes:

Public Member Functions

void clear () noexcept
 Drop all rows and the reverse map.
 
void rebuild_index (int n_nodes)
 Recompute the reverse map (subtype_row) from the side-table rows.
 
int set_node_type (NodeData &nodes, int i, NodeType t)
 Set node i to t, creating/removing/moving its subtype row so the side-table stays the single source of truth. Returns the new subtype row (or -1 for JUNCTION). Also sets nodes.type[i].
 
void erase_node (int i, int n_after)
 Drop node i's subtype row and renumber the join keys after a base node erase. Call after NodeData::erase_at(i) (so n_after is the new node count). Every node_idx > i shifts down by one.
 
int storage_row (int i) const noexcept
 Storage side-table row for base node i, or -1 if i is not a storage node (or the side-table is unbuilt). O(1).
 
int outfall_row (int i) const noexcept
 Outfall side-table row for base node i, or -1 if not an outfall (or the side-table is unbuilt). O(1).
 
int divider_row (int i) const noexcept
 Divider side-table row for base node i, or -1 if not a divider (or the side-table is unbuilt). O(1).
 

Public Attributes

StorageData storages
 
OutfallData outfalls
 
DividerData dividers
 
std::vector< int > subtype_row
 base node index → row in its subtype table (-1 for junctions).
 

Detailed Description

Owns the three node subtype side-tables plus the reverse index map.

subtype_row[i] is the row of node i within whichever side-table matches nodes.type[i] (i.e. an index into storages/outfalls/ dividers), or -1 for JUNCTION nodes. Together with each side-table's node_idx, this provides O(1) lookup in both directions.

Member Function Documentation

◆ clear()

void openswmm::NodeSubtypes::clear ( )
inlinenoexcept

Drop all rows and the reverse map.

◆ divider_row()

int openswmm::NodeSubtypes::divider_row ( int i) const
inlinenoexcept

Divider side-table row for base node i, or -1 if not a divider (or the side-table is unbuilt). O(1).

Here is the caller graph for this function:

◆ erase_node()

void openswmm::NodeSubtypes::erase_node ( int i,
int n_after )
inline

Drop node i's subtype row and renumber the join keys after a base node erase. Call after NodeData::erase_at(i) (so n_after is the new node count). Every node_idx > i shifts down by one.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ outfall_row()

int openswmm::NodeSubtypes::outfall_row ( int i) const
inlinenoexcept

Outfall side-table row for base node i, or -1 if not an outfall (or the side-table is unbuilt). O(1).

Here is the caller graph for this function:

◆ rebuild_index()

void openswmm::NodeSubtypes::rebuild_index ( int n_nodes)
inline

Recompute the reverse map (subtype_row) from the side-table rows.

Phase 4: the side-tables are the authoritative store (no longer built from the wide arrays), so this only re-derives the O(1) base→row index from each table's node_idx. Sizes subtype_row to n_nodes (junctions and untyped nodes stay -1). Used after a structural edit (insert/erase/convert) and as the end-of-parse / hydraulics-init consistency pass. Does not touch row data.

Here is the caller graph for this function:

◆ set_node_type()

int openswmm::NodeSubtypes::set_node_type ( NodeData & nodes,
int i,
NodeType t )
inline

Set node i to t, creating/removing/moving its subtype row so the side-table stays the single source of truth. Returns the new subtype row (or -1 for JUNCTION). Also sets nodes.type[i].

Idempotent: re-setting the same subtype type returns the existing row (parse duplicate lines, no-op). On a real type change the old row is erased and a fresh default row inserted (keeping node_idx ascending). Fresh ascending parse appends at the end in O(1); any mid-table insert or erase triggers an O(n) rebuild_index. New rows carry NodeData::resize defaults (so a converted node starts clean, matching the legacy clear-then-apply-defaults path).

Here is the call graph for this function:
Here is the caller graph for this function:

◆ storage_row()

int openswmm::NodeSubtypes::storage_row ( int i) const
inlinenoexcept

Storage side-table row for base node i, or -1 if i is not a storage node (or the side-table is unbuilt). O(1).

Here is the caller graph for this function:

Member Data Documentation

◆ dividers

DividerData openswmm::NodeSubtypes::dividers

◆ outfalls

OutfallData openswmm::NodeSubtypes::outfalls

◆ storages

StorageData openswmm::NodeSubtypes::storages

◆ subtype_row

std::vector<int> openswmm::NodeSubtypes::subtype_row

base node index → row in its subtype table (-1 for junctions).


The documentation for this struct was generated from the following file: