OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
Link.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
32
33#ifndef OPENSWMM_LINK_HPP
34#define OPENSWMM_LINK_HPP
35
36#include "../data/LinkData.hpp"
37#include "XSectBatch.hpp"
38#include "Node.hpp"
39#include "Transect.hpp"
40
41#include <vector>
42
43namespace openswmm {
44
45namespace link {
46
47// ============================================================================
48// Per-element functions
49// ============================================================================
50
63double getVelocity(const XSectParams& xs, double flow, double depth, int barrels = 1);
64
76double getFroude(const XSectParams& xs, double v, double y);
77
93void computeConveyance(double roughness, double slope, double s_full, double& beta,
94 double& rough_factor, double& q_full);
95
114double getDepthFromFlow(const XSectParams& xs, double beta, double q, double q_max = -1.0);
115
126double getCapacity(const XSectParams& xs, double depth);
127
141double getHydPower(double flow, double head_upstream, double head_downstream);
142
155XSectParams buildXSectParams(const LinkData& links, std::size_t uj,
156 const std::vector<transect::TransectData>* transects = nullptr);
157
158// ============================================================================
159// Batch functions (for routing hot loop)
160// ============================================================================
161
162// Phase 6: computeVelocities/computeFroude/computeAllConveyance removed (dead
163// code; referenced conduit fields now in ConduitData — see LinkSubtypes.hpp).
164
171int translateShape(XsectShape link_shape);
172
184inline double filledCircularOffsetBump(const LinkData& links, std::size_t j, bool resolved) {
185 if (!resolved)
186 return 0.0;
187 if (links.type[j] != LinkType::CONDUIT || links.xsect_shape[j] != XsectShape::FILLED_CIRCULAR)
188 return 0.0;
189 return links.xsect_y_bot[j];
190}
191
219void applyTabulatedXSectParams(XSectParams& xs, const transect::TransectData& td, double y_full,
220 int transect_idx);
221
222} // namespace link
223
224} // namespace openswmm
225
226#endif // OPENSWMM_LINK_HPP
Node hydraulics — volume/depth/head conversions, surface area, overflow.
Irregular transect cross-section geometry (HEC-2 style).
Cross-section geometry — unified batch + per-element API.
Definition ExchangeLaw.hpp:60
@ CONDUIT
Definition LinkData.hpp:58
XsectShape
Conduit cross-section shape code.
Definition LinkData.hpp:64
@ FILLED_CIRCULAR
Definition LinkData.hpp:66
double * y
Definition odesolve.c:37
Native cross-section geometry and borrowed optional normalized transect tables.
Definition XSectBatch.hpp:119
Definition Transect.hpp:50