OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
Node.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2//
3// Copyright 2026 Caleb Buahin
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
16
31
32#ifndef OPENSWMM_NODE_HPP
33#define OPENSWMM_NODE_HPP
34
35#include "../core/Constants.hpp"
36#include "../data/NodeData.hpp"
37#include "../data/TableData.hpp"
38
39namespace openswmm {
40
42struct NodeSubtypes; // relational storage/outfall/divider side-tables (optional source)
43
44namespace node {
45
46// ============================================================================
47// Per-element functions (for C API / single-object queries)
48// ============================================================================
49
61double getVolume(const NodeData& nodes, int idx, double depth,
62 TableData* tables = nullptr, int unit_sys = 0,
63 const NodeSubtypes* subs = nullptr);
64
76double getSurfArea(const NodeData& nodes, int idx, double depth,
77 TableData* tables = nullptr, int unit_sys = 0,
78 const NodeSubtypes* subs = nullptr);
79
91double getPondedArea(const NodeData& nodes, int idx, double depth,
92 TableData* tables = nullptr, int unit_sys = 0,
93 const NodeSubtypes* subs = nullptr);
94
106double getMaxOutflow(const NodeData& nodes, int idx, double q, double dt);
107
120double getOverflow(double new_volume, double full_volume, double dt);
121
130double getDepth(const NodeData& nodes, int idx, double volume,
131 TableData* tables = nullptr, int unit_sys = 0,
132 const NodeSubtypes* subs = nullptr);
133
137inline double getHead(double invert_elev, double depth) {
138 return invert_elev + depth;
139}
140
141// ============================================================================
142// Batch functions (for routing hot loop)
143// ============================================================================
144
153void computeHeads(const double* invert, const double* depth, double* head, int n);
154
162void computeVolumes(const NodeData& nodes, const double* depth, double* volume,
163 const NodeSubtypes* subs = nullptr);
164
174void computeOverflows(const double* new_volume, const double* full_volume,
175 double* overflow, double dt, int n);
176
177} // namespace node
178
179// Constants now consolidated in core/Constants.hpp
180
181} // namespace openswmm
182
183#endif // OPENSWMM_NODE_HPP
Global physical, numerical, and model constants for OpenSWMM Engine.
Structure-of-Arrays (SoA) storage for all node types.
Time series and rating curve data with bidirectional cursor.
Definition Node.cpp:38
double getPondedArea(const NodeData &nodes, int idx, double depth, TableData *tables, int unit_sys, const NodeSubtypes *subs)
Get the ponded area (for overflow above rim).
Definition Node.cpp:333
void computeVolumes(const NodeData &nodes, const double *depth, double *volume, const NodeSubtypes *subs)
Compute volumes for all nodes from their current depths.
Definition Node.cpp:401
double getHead(double invert_elev, double depth)
Compute head from depth: head = invert + depth.
Definition Node.hpp:137
void computeOverflows(const double *new_volume, const double *full_volume, double *overflow, double dt, int n)
Compute overflow for all nodes.
Definition Node.cpp:413
double getSurfArea(const NodeData &nodes, int idx, double depth, TableData *tables, int unit_sys, const NodeSubtypes *subs)
Compute surface area at a given depth for a single node.
Definition Node.cpp:272
void computeHeads(const double *invert, const double *depth, double *head, int n)
Compute head = invert + depth for all nodes.
Definition Node.cpp:391
double getOverflow(double new_volume, double full_volume, double dt)
Compute overflow rate at a node.
Definition Node.cpp:380
double getMaxOutflow(const NodeData &nodes, int idx, double q, double dt)
Compute max outflow limited by available volume.
Definition Node.cpp:351
double getVolume(const NodeData &nodes, int idx, double depth, TableData *tables, int unit_sys, const NodeSubtypes *subs)
Compute volume at a given depth for a single node.
Definition Node.cpp:86
double getDepth(const NodeData &nodes, int idx, double volume, TableData *tables, int unit_sys, const NodeSubtypes *subs)
Compute depth from volume for a single node (inverse of getVolume).
Definition Node.cpp:155
Definition NodeCoupling.cpp:16
Structure-of-Arrays storage for all nodes.
Definition NodeData.hpp:130
Owns the three node subtype side-tables plus the reverse index map.
Definition NodeSubtypes.hpp:373
Central, reentrant simulation context.
Definition SimulationContext.hpp:353