OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
VertexReconstruction.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_ENGINE_2D_VERTEX_RECONSTRUCTION_HPP
34#define OPENSWMM_ENGINE_2D_VERTEX_RECONSTRUCTION_HPP
35
36#include "../data/MeshData.hpp"
38
39namespace openswmm::twoD {
40
51
62void reconstructVertexHeads(const MeshData& mesh, SurfaceStateData& state,
63 int nthreads = 1);
64
76inline double vertexHeadAt(const MeshData& mesh, const SurfaceStateData& state,
77 int v) noexcept {
78 const int start = mesh.vert_stencil_ptr[v];
79 const int end = mesh.vert_stencil_ptr[v + 1];
80 double h = 0.0;
81 for (int k = start; k < end; ++k)
82 h += mesh.vert_stencil_wt[k] * state.head[mesh.vert_stencil_idx[k]];
83 return h;
84}
85
107double cellFreeSurfaceElevation(double mean_depth, double za, double zb,
108 double zc);
109
112double cellFreeSurfaceElevationOf(const MeshData& mesh, int t, double mean_depth);
113
149void reconstructVertexRenderDepths(const MeshData& mesh, SurfaceStateData& state,
150 double dry_depth, int nthreads,
151 std::vector<double>& eta_scratch);
152
156 SurfaceStateData& state,
157 double dry_depth, int nthreads = 1) {
158 std::vector<double> eta_scratch;
159 reconstructVertexRenderDepths(mesh, state, dry_depth, nthreads,
160 eta_scratch);
161}
162
163} // namespace openswmm::twoD
164
165#endif // OPENSWMM_ENGINE_2D_VERTEX_RECONSTRUCTION_HPP
Structure-of-Arrays (SoA) storage for 2D triangular mesh geometry.
Structure-of-Arrays (SoA) storage for 2D surface routing state.
Definition NodeCoupling.cpp:16
void buildVertexStencils(MeshData &mesh)
Build pseudo-Laplacian reconstruction stencils for all vertices.
Definition VertexReconstruction.cpp:26
double cellFreeSurfaceElevationOf(const MeshData &mesh, int t, double mean_depth)
Definition VertexReconstruction.cpp:168
double vertexHeadAt(const MeshData &mesh, const SurfaceStateData &state, int v) noexcept
Pseudo-Laplacian head at ONE vertex, evaluated on demand from the current cell heads.
Definition VertexReconstruction.hpp:76
void reconstructVertexHeads(const MeshData &mesh, SurfaceStateData &state, int nthreads)
Reconstruct head values at vertices from cell-centred heads.
Definition VertexReconstruction.cpp:148
double cellFreeSurfaceElevation(double mean_depth, double za, double zb, double zc)
Free-surface elevation η of one triangular cell from its mean depth (render/output closure).
Definition VertexReconstruction.cpp:183
void reconstructVertexRenderDepths(const MeshData &mesh, SurfaceStateData &state, double dry_depth, int nthreads, std::vector< double > &eta_scratch)
Wet-masked, depth-weighted free-surface reconstruction at vertices for RENDERING/OUTPUT only (writes ...
Definition VertexReconstruction.cpp:196
SoA storage for 2D mixed triangle/quad mesh geometry and topology.
Definition MeshData.hpp:67
Definition SurfaceStateData.hpp:59