OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
InertialEdges.hpp
Go to the documentation of this file.
1
29
30#ifndef OPENSWMM_ENGINE_2D_INERTIAL_EDGES_HPP
31#define OPENSWMM_ENGINE_2D_INERTIAL_EDGES_HPP
32
33#include <vector>
34
35namespace openswmm::twoD {
36
37struct MeshData;
38
44 int ne = 0;
45
46 // Per-edge arrays (size ne), oriented cL→cR (cL = min(t,nbr), cR = max).
47 std::vector<int> cL, cR;
48 std::vector<double> xi;
49 std::vector<double> inv_dx;
50 std::vector<double> zface;
51 std::vector<int> slotL, slotR;
52
53 // Per-cell CSR incidence for the conservative continuity gather. For cell i,
54 // the incident edges are cell_edge[cell_ptr[i] .. cell_ptr[i+1]) with sign
55 // cell_sign (+1 if i==cL, −1 if i==cR). Then
56 // dV_i/dt (flux part) = − Σ cell_sign · q[edge] · ξ[edge].
57 std::vector<int> cell_ptr;
58 std::vector<int> cell_edge;
59 std::vector<double> cell_sign;
60
62 void build(const MeshData& mesh);
63
64 bool empty() const noexcept { return ne == 0; }
65};
66
67} // namespace openswmm::twoD
68
69#endif // OPENSWMM_ENGINE_2D_INERTIAL_EDGES_HPP
Definition NodeCoupling.cpp:15
Canonical unique interior-edge layout + per-cell incidence for the local-inertial scheme.
Definition InertialEdges.hpp:43
bool empty() const noexcept
Definition InertialEdges.hpp:64
std::vector< double > cell_sign
+1 (i==cL) / −1 (i==cR)
Definition InertialEdges.hpp:59
std::vector< double > xi
edge length ξ (m)
Definition InertialEdges.hpp:48
std::vector< double > inv_dx
1 / centroid-to-centroid distance (1/m)
Definition InertialEdges.hpp:49
void build(const MeshData &mesh)
Build the structure from mesh topology. O(n_triangles).
Definition InertialEdges.cpp:24
std::vector< double > zface
max(tri_cz[cL], tri_cz[cR]) interface bed (m)
Definition InertialEdges.hpp:50
std::vector< int > cL
Definition InertialEdges.hpp:47
std::vector< int > slotR
flat mesh edge slots [tri*3+e] for writeback
Definition InertialEdges.hpp:51
std::vector< int > slotL
Definition InertialEdges.hpp:51
int ne
number of interior (q-carrying) edges
Definition InertialEdges.hpp:44
std::vector< int > cell_ptr
[n_triangles + 1] CSR row pointers
Definition InertialEdges.hpp:57
std::vector< int > cell_edge
incident edge id
Definition InertialEdges.hpp:58
std::vector< int > cR
incident cell indices
Definition InertialEdges.hpp:47
SoA storage for 2D triangular mesh geometry and topology.
Definition MeshData.hpp:34