OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm::twoD::MeshData Struct Reference

SoA storage for 2D mixed triangle/quad mesh geometry and topology. More...

#include <MeshData.hpp>

Collaboration diagram for openswmm::twoD::MeshData:

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< TriCouplingRowtri_couplings
 

Detailed Description

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.

Member Function Documentation

◆ cell_edge_vertices()

void openswmm::twoD::MeshData::cell_edge_vertices ( int c,
int k,
int & a,
int & b ) const
inlinenoexcept

Endpoint vertices of local edge k of cell c: v[(k+1)nv], v[(k+2)nv].

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cell_neighbour()

int openswmm::twoD::MeshData::cell_neighbour ( int c,
int k ) const
inlinenoexcept
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cell_vertex()

int openswmm::twoD::MeshData::cell_vertex ( int c,
int k ) const
inlinenoexcept
Here is the call graph for this function:
Here is the caller graph for this function:

◆ cell_vertex_count()

int openswmm::twoD::MeshData::cell_vertex_count ( int c) const
inlinenoexcept
Here is the caller graph for this function:

◆ edge_stride()

int openswmm::twoD::MeshData::edge_stride ( ) const
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.

Here is the call graph for this function:

◆ is_quad()

bool openswmm::twoD::MeshData::is_quad ( int c) const
inlinenoexcept

◆ n_cells()

int openswmm::twoD::MeshData::n_cells ( ) const
inlinenoexcept
Here is the caller graph for this function:

◆ n_edge_slots()

int openswmm::twoD::MeshData::n_edge_slots ( ) const
inlinenoexcept

Number of internal edge slots (n_cells * kMaxCellVerts).

Here is the call graph for this function:
Here is the caller graph for this function:

◆ n_quads()

int openswmm::twoD::MeshData::n_quads ( ) const
inlinenoexcept

Number of quadrilateral cells (O(n) scan; not a hot path).

Here is the caller graph for this function:

◆ n_triangles()

int openswmm::twoD::MeshData::n_triangles ( ) const
inlinenoexcept

Number of CELLS (triangles + quads). The historical name is kept for the ~200 call sites; n_cells() is the same value.

Here is the caller graph for this function:

◆ n_vertices()

int openswmm::twoD::MeshData::n_vertices ( ) const
inlinenoexcept
Here is the caller graph for this function:

◆ resize_triangles()

void openswmm::twoD::MeshData::resize_triangles ( int nt)
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.

Here is the caller graph for this function:

◆ resize_vertices()

void openswmm::twoD::MeshData::resize_vertices ( int nv)
inline
Here is the caller graph for this function:

◆ set_quad()

void openswmm::twoD::MeshData::set_quad ( int c,
int v0,
int v1,
int v2,
int v3 )
inlinenoexcept
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_triangle()

void openswmm::twoD::MeshData::set_triangle ( int c,
int v0,
int v1,
int v2 )
inlinenoexcept
Here is the call graph for this function:
Here is the caller graph for this function:

◆ slot()

static constexpr int openswmm::twoD::MeshData::slot ( int c,
int k )
inlinestaticconstexprnoexcept

Flat edge/vertex slot of local index k in cell c.

Here is the caller graph for this function:

◆ slot_cell()

static constexpr int openswmm::twoD::MeshData::slot_cell ( int s)
inlinestaticconstexprnoexcept
Here is the caller graph for this function:

◆ slot_local()

static constexpr int openswmm::twoD::MeshData::slot_local ( int s)
inlinestaticconstexprnoexcept

Local index k of a flat slot; cell of a flat slot.

Here is the caller graph for this function:

Member Data Documentation

◆ cell_nbr

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).

◆ cell_nv

std::vector<uint8_t> openswmm::twoD::MeshData::cell_nv

Vertices per cell: 3 (triangle) or 4 (quadrilateral).

◆ cell_v

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).

◆ edge_conveyance

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).

◆ edge_dist_c

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.

◆ edge_length

std::vector<double> openswmm::twoD::MeshData::edge_length

Length of each edge.

◆ edge_mx

std::vector<double> openswmm::twoD::MeshData::edge_mx

Edge midpoint X.

◆ edge_my

std::vector<double> openswmm::twoD::MeshData::edge_my

Edge midpoint Y.

◆ edge_mz

std::vector<double> openswmm::twoD::MeshData::edge_mz

Edge midpoint Z (interpolated)

◆ edge_nx

std::vector<double> openswmm::twoD::MeshData::edge_nx

Outward normal X component.

◆ edge_ny

std::vector<double> openswmm::twoD::MeshData::edge_ny

Outward normal Y component.

◆ mannings_n

std::vector<double> openswmm::twoD::MeshData::mannings_n

Manning's roughness coefficient.

◆ quad_vfr_a

std::vector<double> openswmm::twoD::MeshData::quad_vfr_a

◆ quad_vfr_z

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.

◆ tri_area

std::vector<double> openswmm::twoD::MeshData::tri_area

Planimetric area (m²)

◆ tri_coupled_node

std::vector<int> openswmm::twoD::MeshData::tri_coupled_node

SWMM node index (-1 = none)

◆ tri_coupled_node_name

std::vector<std::string> openswmm::twoD::MeshData::tri_coupled_node_name

◆ tri_coupling_area

std::vector<double> openswmm::twoD::MeshData::tri_coupling_area

Effective exchange area.

◆ tri_coupling_cd

std::vector<double> openswmm::twoD::MeshData::tri_coupling_cd

Discharge coefficient.

◆ tri_couplings

std::vector<TriCouplingRow> openswmm::twoD::MeshData::tri_couplings

◆ tri_cx

std::vector<double> openswmm::twoD::MeshData::tri_cx

Centroid X (area centroid)

◆ tri_cy

std::vector<double> openswmm::twoD::MeshData::tri_cy

Centroid Y (area centroid)

◆ tri_cz

std::vector<double> openswmm::twoD::MeshData::tri_cz

Mean of the cell's vertex elevations.

◆ tri_init_depth

std::vector<double> openswmm::twoD::MeshData::tri_init_depth

Initial water depth (m, default 0 = dry)

◆ tri_init_u

std::vector<double> openswmm::twoD::MeshData::tri_init_u

[2D_INITIAL_VELOCITY] u (m/s, default 0)

◆ tri_init_v

std::vector<double> openswmm::twoD::MeshData::tri_init_v

[2D_INITIAL_VELOCITY] v (m/s, default 0)

◆ tri_tag

std::vector<std::string> openswmm::twoD::MeshData::tri_tag

Optional triangle tag.

◆ vert_coupled_node

std::vector<int> openswmm::twoD::MeshData::vert_coupled_node

SWMM node index (-1 = none)

◆ vert_coupled_node_name

std::vector<std::string> openswmm::twoD::MeshData::vert_coupled_node_name

◆ vert_coupling_area

std::vector<double> openswmm::twoD::MeshData::vert_coupling_area

Effective exchange area (m²)

◆ vert_coupling_area_set

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.

◆ vert_coupling_cd

std::vector<double> openswmm::twoD::MeshData::vert_coupling_cd

Discharge coefficient (default 0.65)

◆ vert_stencil_idx

std::vector<int> openswmm::twoD::MeshData::vert_stencil_idx

Column indices (triangle indices)

◆ vert_stencil_ptr

std::vector<int> openswmm::twoD::MeshData::vert_stencil_ptr

[n_vertices + 1] row pointers

◆ vert_stencil_wt

std::vector<double> openswmm::twoD::MeshData::vert_stencil_wt

Pseudo-Laplacian weights.

◆ vtag

std::vector<std::string> openswmm::twoD::MeshData::vtag

Optional vertex tag.

◆ vx

std::vector<double> openswmm::twoD::MeshData::vx

Vertex X coordinate.

◆ vy

std::vector<double> openswmm::twoD::MeshData::vy

Vertex Y coordinate.

◆ vz

std::vector<double> openswmm::twoD::MeshData::vz

Vertex Z (ground elevation)


The documentation for this struct was generated from the following file: