OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
BoundaryData.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
38
39#ifndef OPENSWMM_ENGINE_2D_BOUNDARY_DATA_HPP
40#define OPENSWMM_ENGINE_2D_BOUNDARY_DATA_HPP
41
42#include <vector>
43#include <cstdint>
44
45namespace openswmm::twoD {
46
63
72
74 std::vector<int8_t> edge_bc_type;
75
79 std::vector<double> edge_bed_slope;
80
83 std::vector<double> edge_bc_head;
84
88 std::vector<int> edge_bc_tseries;
89
91 std::vector<std::string> edge_bc_tseries_name;
92
95 std::vector<double> edge_bc_cum_flux;
96
97 // -----------------------------------------------------------------------
98 // V-E4 — SPECIFIED_FLOW slots (per-metre-of-edge discharge).
99 // Sign convention: outward-positive (matches edge_bc_cum_flux).
100 // -----------------------------------------------------------------------
101
104 std::vector<double> edge_bc_flow;
105
109 std::vector<int> edge_bc_flow_tseries;
110
112 std::vector<std::string> edge_bc_flow_tseries_name;
113
114 // -----------------------------------------------------------------------
115 // V-E5 — RATING_CURVE slot (stage → flow lookup).
116 // -----------------------------------------------------------------------
117
120 std::vector<int> edge_bc_rating_curve;
121
123 std::vector<std::string> edge_bc_rating_curve_name;
124
125 // -----------------------------------------------------------------------
126 // Lifecycle
127 // -----------------------------------------------------------------------
128
133 void resize(int n_edges) {
134 auto n = static_cast<std::size_t>(n_edges);
135 edge_bc_type.assign(n, static_cast<int8_t>(BoundaryType::WALL));
136 edge_bed_slope.assign(n, 0.0);
137 edge_bc_head.assign(n, 0.0);
138 edge_bc_tseries.assign(n, -1);
139 edge_bc_tseries_name.resize(n);
140 edge_bc_cum_flux.assign(n, 0.0);
141 edge_bc_flow.assign(n, 0.0);
142 edge_bc_flow_tseries.assign(n, -1);
144 edge_bc_rating_curve.assign(n, -1);
146 }
147
148 int size() const noexcept { return static_cast<int>(edge_bc_type.size()); }
149};
150
151} // namespace openswmm::twoD
152
153#endif // OPENSWMM_ENGINE_2D_BOUNDARY_DATA_HPP
Definition NodeCoupling.cpp:16
BoundaryType
Boundary condition types for 2D mesh edges.
Definition BoundaryData.hpp:56
@ RATING_CURVE
Stage → flow lookup (curve registry index)
Definition BoundaryData.hpp:61
@ SPECIFIED_FLOW
Prescribed discharge per metre of edge (constant or TS)
Definition BoundaryData.hpp:60
@ NORMAL_FLOW
Manning outflow using bed slope.
Definition BoundaryData.hpp:58
@ WALL
Zero-flux wall (default)
Definition BoundaryData.hpp:57
@ SPECIFIED_STAGE
Prescribed water surface elevation (constant or TS)
Definition BoundaryData.hpp:59
SoA storage for per-edge boundary conditions.
Definition BoundaryData.hpp:71
std::vector< std::string > edge_bc_flow_tseries_name
Timeseries name for deferred resolution (cleared after resolve).
Definition BoundaryData.hpp:112
void resize(int n_edges)
Resize all arrays to n_edges and initialize to WALL defaults.
Definition BoundaryData.hpp:133
std::vector< int > edge_bc_tseries
Definition BoundaryData.hpp:88
std::vector< int8_t > edge_bc_type
Boundary condition type per edge (cast from BoundaryType)
Definition BoundaryData.hpp:74
std::vector< std::string > edge_bc_tseries_name
Timeseries name for deferred resolution (cleared after resolve).
Definition BoundaryData.hpp:91
std::vector< double > edge_bed_slope
Definition BoundaryData.hpp:79
std::vector< double > edge_bc_flow
Definition BoundaryData.hpp:104
std::vector< double > edge_bc_head
Definition BoundaryData.hpp:83
int size() const noexcept
Definition BoundaryData.hpp:148
std::vector< std::string > edge_bc_rating_curve_name
Curve name for deferred resolution (cleared after resolve).
Definition BoundaryData.hpp:123
std::vector< double > edge_bc_cum_flux
Definition BoundaryData.hpp:95
std::vector< int > edge_bc_rating_curve
Definition BoundaryData.hpp:120
std::vector< int > edge_bc_flow_tseries
Definition BoundaryData.hpp:109