![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
SoA storage for 2D mixed triangle/quad mesh geometry and topology. More...
#include <MeshData.hpp>
Classes | |
| struct | TriCouplingRow |
Public Member Functions | |
| int | n_vertices () const noexcept |
| int | n_triangles () const noexcept |
| int | n_cells () const noexcept |
| int | n_quads () const noexcept |
| Number of quadrilateral cells (O(n) scan; not a hot path). | |
| int | edge_stride () const noexcept |
| int | n_edge_slots () const noexcept |
| Number of internal edge slots (n_cells * kMaxCellVerts). | |
| int | cell_vertex_count (int c) const noexcept |
| int | cell_vertex (int c, int k) const noexcept |
| int | cell_neighbour (int c, int k) const noexcept |
| bool | is_quad (int c) const noexcept |
| void | cell_edge_vertices (int c, int k, int &a, int &b) const noexcept |
| Endpoint vertices of local edge k of cell c: v[(k+1)nv], v[(k+2)nv]. | |
| void | set_triangle (int c, int v0, int v1, int v2) noexcept |
| void | set_quad (int c, int v0, int v1, int v2, int v3) noexcept |
| void | resize_vertices (int nv) |
| void | resize_triangles (int nt) |
Static Public Member Functions | |
| static constexpr int | slot (int c, int k) noexcept |
| Flat edge/vertex slot of local index k in cell c. | |
| static constexpr int | slot_local (int s) noexcept |
| Local index k of a flat slot; cell of a flat slot. | |
| static constexpr int | slot_cell (int s) noexcept |
Public Attributes | |
| std::vector< double > | vx |
| Vertex X coordinate. | |
| std::vector< double > | vy |
| Vertex Y coordinate. | |
| std::vector< double > | vz |
| Vertex Z (ground elevation) | |
| std::vector< std::string > | vtag |
| Optional vertex tag. | |
| std::vector< uint8_t > | cell_nv |
| Vertices per cell: 3 (triangle) or 4 (quadrilateral). | |
| std::vector< int > | cell_v |
| std::vector< int > | cell_nbr |
| std::vector< double > | tri_area |
| Planimetric area (m²) | |
| std::vector< double > | tri_cx |
| Centroid X (area centroid) | |
| std::vector< double > | tri_cy |
| Centroid Y (area centroid) | |
| std::vector< double > | tri_cz |
| Mean of the cell's vertex elevations. | |
| std::vector< double > | edge_length |
| Length of each edge. | |
| std::vector< double > | edge_nx |
| Outward normal X component. | |
| std::vector< double > | edge_ny |
| Outward normal Y component. | |
| std::vector< double > | edge_mx |
| Edge midpoint X. | |
| std::vector< double > | edge_my |
| Edge midpoint Y. | |
| std::vector< double > | edge_mz |
| std::vector< double > | edge_dist_c |
| std::vector< double > | quad_vfr_z |
| std::vector< double > | quad_vfr_a |
| std::vector< double > | edge_conveyance |
| std::vector< double > | mannings_n |
| Manning's roughness coefficient. | |
| std::vector< double > | tri_init_depth |
| Initial water depth (m, default 0 = dry) | |
| std::vector< double > | tri_init_u |
| [2D_INITIAL_VELOCITY] u (m/s, default 0) | |
| std::vector< double > | tri_init_v |
| [2D_INITIAL_VELOCITY] v (m/s, default 0) | |
| std::vector< std::string > | tri_tag |
| Optional triangle tag. | |
| std::vector< int > | vert_stencil_ptr |
| [n_vertices + 1] row pointers | |
| std::vector< int > | vert_stencil_idx |
| Column indices (triangle indices) | |
| std::vector< double > | vert_stencil_wt |
| Pseudo-Laplacian weights. | |
| std::vector< int > | vert_coupled_node |
| SWMM node index (-1 = none) | |
| std::vector< int > | tri_coupled_node |
| SWMM node index (-1 = none) | |
| std::vector< double > | vert_coupling_cd |
| Discharge coefficient (default 0.65) | |
| std::vector< double > | vert_coupling_area |
| std::vector< uint8_t > | vert_coupling_area_set |
| std::vector< double > | tri_coupling_cd |
| Discharge coefficient. | |
| std::vector< double > | tri_coupling_area |
| Effective exchange area. | |
| std::vector< std::string > | vert_coupled_node_name |
| std::vector< std::string > | tri_coupled_node_name |
| std::vector< TriCouplingRow > | tri_couplings |
SoA storage for 2D mixed triangle/quad mesh geometry and topology.
All vertex arrays are indexed by vertex index [0, n_vertices). All cell arrays are indexed by cell index [0, n_triangles()) — the historical tri_* names are kept for the per-cell scalar arrays; a "tri" is any cell (triangle or quad). Cells are ordered triangles first, then quads (the [2D_TRIANGLES] rows, then the [2D_QUADS] rows). Edge / connectivity arrays are flat 2D: [cell * kMaxCellVerts + k] for k in [0, cell_nv[cell]).
Local-edge convention (unified for both shapes): edge k has endpoints v[(k+1) % nv], v[(k+2) % nv]. For a triangle this is the historical "edge k is opposite vertex k" rule, so every existing TRI EDGE row keeps its meaning; for a quad it is a fixed rotation of the natural numbering.
|
inlinenoexcept |
Endpoint vertices of local edge k of cell c: v[(k+1)nv], v[(k+2)nv].
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Edge-slot stride of the PUBLIC (API / HDF5) layout: 3 for an all-triangle mesh (byte-compatible with every existing consumer), kMaxCellVerts once a quad exists. Internal SoAs always use kMaxCellVerts.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Number of internal edge slots (n_cells * kMaxCellVerts).
|
inlinenoexcept |
Number of quadrilateral cells (O(n) scan; not a hot path).
|
inlinenoexcept |
Number of CELLS (triangles + quads). The historical name is kept for the ~200 call sites; n_cells() is the same value.
|
inlinenoexcept |
|
inline |
Resize the per-cell arrays to nt cells. New cells are TRIANGLES (cell_nv = 3, vertex slots 0 / padding −1) until set_quad() is called.
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinestaticconstexprnoexcept |
Flat edge/vertex slot of local index k in cell c.
|
inlinestaticconstexprnoexcept |
|
inlinestaticconstexprnoexcept |
Local index k of a flat slot; cell of a flat slot.
| std::vector<int> openswmm::twoD::MeshData::cell_nbr |
Neighbour across local edge k, padded: [cell * kMaxCellVerts + k]. −1 = boundary edge, −2 = padding slot (k ≥ cell_nv).
| std::vector<uint8_t> openswmm::twoD::MeshData::cell_nv |
Vertices per cell: 3 (triangle) or 4 (quadrilateral).
| std::vector<int> openswmm::twoD::MeshData::cell_v |
Connectivity, padded: [cell * kMaxCellVerts + k]; −1 in padding slots. Counter-clockwise order (MeshBuilder orients the outward normals from the centroid, so a clockwise triangle still works; quads are validated CCW + convex at parse time).
| std::vector<double> openswmm::twoD::MeshData::edge_conveyance |
Per-edge conveyance factor in [0, 1], flat 2D [cell * kMaxCellVerts + k]. Default 1.0 (unrestricted) for every edge. Multiplies the diffusion-wave flux in SurfaceFluxCalculator::computeEdgeFluxes (the last factor before edge_flux is stored). Symmetric: for an interior edge shared by triangles A and B, the slots [A*3 + e_A] and [B*3 + e_B] must carry the same value; SurfaceRouter2D::initialize enforces this when draining the [2D_EDGE_CONVEYANCE] pending rows. See §11A of docs/2dModelStrategy.md.
Cross-reference: this is the edge transmissivity ψ in the Integral-Porosity Shallow-Water literature (Sanders 2008; Bruwier et al. 2017).
| std::vector<double> openswmm::twoD::MeshData::edge_dist_c |
Centroid → edge-midpoint distance along the outward normal, (m⃗_e − c⃗)·n̂_e (m). For a triangle this equals the classic 2A/(3ξ) (the centroid sits one third of the altitude up); for a quad it is the exact normal distance. The ghost-cell arm every boundary-edge law uses.
| std::vector<double> openswmm::twoD::MeshData::edge_length |
Length of each edge.
| std::vector<double> openswmm::twoD::MeshData::edge_mx |
Edge midpoint X.
| std::vector<double> openswmm::twoD::MeshData::edge_my |
Edge midpoint Y.
| std::vector<double> openswmm::twoD::MeshData::edge_mz |
Edge midpoint Z (interpolated)
| std::vector<double> openswmm::twoD::MeshData::edge_nx |
Outward normal X component.
| std::vector<double> openswmm::twoD::MeshData::edge_ny |
Outward normal Y component.
| std::vector<double> openswmm::twoD::MeshData::mannings_n |
Manning's roughness coefficient.
| std::vector<double> openswmm::twoD::MeshData::quad_vfr_a |
| std::vector<double> openswmm::twoD::MeshData::quad_vfr_z |
Quad VFR precomputed data (B&S 2007 two-plane storage model, see mesh/QuadVfr.hpp): per CELL, six sorted sub-triangle elevations [cell*6 + k] and two sub-triangle areas [cell*2 + k]. Allocated only when the mesh holds at least one quad (empty otherwise); triangle rows are zero and never read. Rebuilt by MeshBuilder with the z-dependents.
| std::vector<double> openswmm::twoD::MeshData::tri_area |
Planimetric area (m²)
| std::vector<int> openswmm::twoD::MeshData::tri_coupled_node |
SWMM node index (-1 = none)
| std::vector<std::string> openswmm::twoD::MeshData::tri_coupled_node_name |
| std::vector<double> openswmm::twoD::MeshData::tri_coupling_area |
Effective exchange area.
| std::vector<double> openswmm::twoD::MeshData::tri_coupling_cd |
Discharge coefficient.
| std::vector<TriCouplingRow> openswmm::twoD::MeshData::tri_couplings |
| std::vector<double> openswmm::twoD::MeshData::tri_cx |
Centroid X (area centroid)
| std::vector<double> openswmm::twoD::MeshData::tri_cy |
Centroid Y (area centroid)
| std::vector<double> openswmm::twoD::MeshData::tri_cz |
Mean of the cell's vertex elevations.
| std::vector<double> openswmm::twoD::MeshData::tri_init_depth |
Initial water depth (m, default 0 = dry)
| std::vector<double> openswmm::twoD::MeshData::tri_init_u |
[2D_INITIAL_VELOCITY] u (m/s, default 0)
| std::vector<double> openswmm::twoD::MeshData::tri_init_v |
[2D_INITIAL_VELOCITY] v (m/s, default 0)
| std::vector<std::string> openswmm::twoD::MeshData::tri_tag |
Optional triangle tag.
| std::vector<int> openswmm::twoD::MeshData::vert_coupled_node |
SWMM node index (-1 = none)
| std::vector<std::string> openswmm::twoD::MeshData::vert_coupled_node_name |
| std::vector<double> openswmm::twoD::MeshData::vert_coupling_area |
Effective exchange area (m²)
| std::vector<uint8_t> openswmm::twoD::MeshData::vert_coupling_area_set |
1 when the [2D_VERTEX_NODE_MAP] row authored an explicit AREA token. Rows without one keep the 1.0 default value but are eligible for the COUPLING_AREA AUTO derivation at coupling-point resolve.
| std::vector<double> openswmm::twoD::MeshData::vert_coupling_cd |
Discharge coefficient (default 0.65)
| std::vector<int> openswmm::twoD::MeshData::vert_stencil_idx |
Column indices (triangle indices)
| std::vector<int> openswmm::twoD::MeshData::vert_stencil_ptr |
[n_vertices + 1] row pointers
| std::vector<double> openswmm::twoD::MeshData::vert_stencil_wt |
Pseudo-Laplacian weights.
| std::vector<std::string> openswmm::twoD::MeshData::vtag |
Optional vertex tag.
| std::vector<double> openswmm::twoD::MeshData::vx |
Vertex X coordinate.
| std::vector<double> openswmm::twoD::MeshData::vy |
Vertex Y coordinate.
| std::vector<double> openswmm::twoD::MeshData::vz |
Vertex Z (ground elevation)