34#ifndef OPENSWMM_ENGINE_2D_MESH_DATA_HPP
35#define OPENSWMM_ENGINE_2D_MESH_DATA_HPP
71 std::vector<double>
vx;
72 std::vector<double>
vy;
73 std::vector<double>
vz;
74 std::vector<std::string>
vtag;
204 int n_vertices() const noexcept {
return static_cast<int>(
vx.size()); }
303 return cell_v[
static_cast<std::size_t
>(
slot(c, k))];
324 bool is_quad(
int c)
const noexcept {
return cell_nv[
static_cast<std::size_t
>(c)] == 4; }
337 const int nv =
cell_nv[
static_cast<std::size_t
>(c)];
338 a =
cell_v[
static_cast<std::size_t
>(
slot(c, (k + 1) % nv))];
339 b =
cell_v[
static_cast<std::size_t
>(
slot(c, (k + 2) % nv))];
353 cell_nv[
static_cast<std::size_t
>(c)] = 3;
354 cell_v[
static_cast<std::size_t
>(
slot(c, 0))] = v0;
355 cell_v[
static_cast<std::size_t
>(
slot(c, 1))] = v1;
356 cell_v[
static_cast<std::size_t
>(
slot(c, 2))] = v2;
357 cell_v[
static_cast<std::size_t
>(
slot(c, 3))] = -1;
370 void set_quad(
int c,
int v0,
int v1,
int v2,
int v3)
noexcept {
371 cell_nv[
static_cast<std::size_t
>(c)] = 4;
372 cell_v[
static_cast<std::size_t
>(
slot(c, 0))] = v0;
373 cell_v[
static_cast<std::size_t
>(
slot(c, 1))] = v1;
374 cell_v[
static_cast<std::size_t
>(
slot(c, 2))] = v2;
375 cell_v[
static_cast<std::size_t
>(
slot(c, 3))] = v3;
392 auto n =
static_cast<std::size_t
>(nv);
418 auto n =
static_cast<std::size_t
>(nt);
419 const auto old_n =
cell_nv.size();
425 for (std::size_t c = old_n; c < n; ++c) {
Definition ExchangeLaw.hpp:60
constexpr int kMaxCellVerts
Definition MeshData.hpp:49
Definition MeshData.hpp:180
int node
SWMM node index (-1 until resolved)
Definition MeshData.hpp:182
bool area_set
Definition MeshData.hpp:188
bool cd_set
Definition MeshData.hpp:185
std::string node_name
Deferred name (cleared after resolve)
Definition MeshData.hpp:183
double cd
Discharge coefficient.
Definition MeshData.hpp:184
double area
Effective exchange area.
Definition MeshData.hpp:187
int tri
Triangle index.
Definition MeshData.hpp:181
SoA storage for 2D mixed triangle/quad mesh geometry and topology.
Definition MeshData.hpp:65
std::vector< double > tri_coupling_area
Effective exchange area.
Definition MeshData.hpp:166
std::vector< double > edge_conveyance
Definition MeshData.hpp:131
int n_triangles() const noexcept
Number of CELLS (triangles + quads). The historical name is kept for the ~200 call sites; n_cells() i...
Definition MeshData.hpp:213
std::vector< uint8_t > vert_coupling_area_set
Definition MeshData.hpp:164
std::vector< int > vert_stencil_idx
Column indices (triangle indices)
Definition MeshData.hpp:145
std::vector< double > tri_area
Planimetric area (m²)
Definition MeshData.hpp:92
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].
Definition MeshData.hpp:336
int n_quads() const noexcept
Number of quadrilateral cells (O(n) scan; not a hot path).
Definition MeshData.hpp:228
std::vector< double > edge_nx
Outward normal X component.
Definition MeshData.hpp:99
std::vector< double > edge_length
Length of each edge.
Definition MeshData.hpp:98
void resize_triangles(int nt)
Resize the per-cell arrays to nt cells. New cells are TRIANGLES (cell_nv = 3, vertex slots 0 / paddin...
Definition MeshData.hpp:417
std::vector< std::string > tri_coupled_node_name
Definition MeshData.hpp:170
std::vector< std::string > vtag
Optional vertex tag.
Definition MeshData.hpp:74
int cell_vertex(int c, int k) const noexcept
Read one mixed-cell topology field.
Definition MeshData.hpp:302
std::vector< double > tri_cy
Centroid Y (area centroid)
Definition MeshData.hpp:94
std::vector< double > vy
Vertex Y coordinate.
Definition MeshData.hpp:72
std::vector< int > tri_coupled_node
SWMM node index (-1 = none)
Definition MeshData.hpp:153
void set_triangle(int c, int v0, int v1, int v2) noexcept
Assign 3-vertex connectivity to one preallocated cell.
Definition MeshData.hpp:352
static constexpr int slot(int c, int k) noexcept
Flat edge/vertex slot of local index k in cell c.
Definition MeshData.hpp:267
std::vector< int > vert_coupled_node
SWMM node index (-1 = none)
Definition MeshData.hpp:152
std::vector< double > tri_init_u
[2D_INITIAL_VELOCITY] u (m/s, default 0)
Definition MeshData.hpp:136
int n_cells() const noexcept
Read the mixed-cell extent.
Definition MeshData.hpp:219
std::vector< double > tri_init_depth
Initial water depth (m, default 0 = dry)
Definition MeshData.hpp:135
std::vector< double > vert_coupling_area
Definition MeshData.hpp:160
std::vector< double > tri_cx
Centroid X (area centroid)
Definition MeshData.hpp:93
std::vector< std::string > tri_tag
Optional triangle tag.
Definition MeshData.hpp:138
std::vector< uint8_t > cell_nv
Vertices per cell: 3 (triangle) or 4 (quadrilateral).
Definition MeshData.hpp:81
void set_quad(int c, int v0, int v1, int v2, int v3) noexcept
Assign 4-vertex connectivity to one preallocated cell.
Definition MeshData.hpp:370
std::vector< int > cell_v
Definition MeshData.hpp:86
int n_edge_slots() const noexcept
Number of internal edge slots (n_cells * kMaxCellVerts).
Definition MeshData.hpp:252
static constexpr int slot_cell(int s) noexcept
Convert mixed-mesh padded slot coordinates.
Definition MeshData.hpp:283
std::vector< double > edge_my
Edge midpoint Y.
Definition MeshData.hpp:102
int cell_vertex_count(int c) const noexcept
Read one mixed-cell topology field.
Definition MeshData.hpp:292
std::vector< int > vert_stencil_ptr
[n_vertices + 1] row pointers
Definition MeshData.hpp:144
std::vector< double > vz
Vertex Z (ground elevation)
Definition MeshData.hpp:73
std::vector< std::string > vert_coupled_node_name
Definition MeshData.hpp:169
std::vector< double > edge_ny
Outward normal Y component.
Definition MeshData.hpp:100
std::vector< double > tri_cz
Mean of the cell's vertex elevations.
Definition MeshData.hpp:95
static constexpr int slot_local(int s) noexcept
Local index k of a flat slot; cell of a flat slot.
Definition MeshData.hpp:276
std::vector< double > quad_vfr_a
Definition MeshData.hpp:116
std::vector< double > mannings_n
Manning's roughness coefficient.
Definition MeshData.hpp:134
std::vector< double > vx
Vertex X coordinate.
Definition MeshData.hpp:71
int edge_stride() const noexcept
Edge-slot stride of the PUBLIC (API / HDF5) layout: 3 for an all-triangle mesh (byte-compatible with ...
Definition MeshData.hpp:244
std::vector< double > edge_mx
Edge midpoint X.
Definition MeshData.hpp:101
std::vector< double > vert_stencil_wt
Pseudo-Laplacian weights.
Definition MeshData.hpp:146
int n_vertices() const noexcept
Read the vertex-array extent.
Definition MeshData.hpp:204
std::vector< double > tri_coupling_cd
Discharge coefficient.
Definition MeshData.hpp:165
void resize_vertices(int nv)
Resize vertex coordinates, tags and vertex coupling arrays.
Definition MeshData.hpp:391
std::vector< double > edge_mz
Definition MeshData.hpp:103
std::vector< double > tri_init_v
[2D_INITIAL_VELOCITY] v (m/s, default 0)
Definition MeshData.hpp:137
std::vector< double > edge_dist_c
Definition MeshData.hpp:108
int cell_neighbour(int c, int k) const noexcept
Read one mixed-cell topology field.
Definition MeshData.hpp:314
std::vector< TriCouplingRow > tri_couplings
Definition MeshData.hpp:192
bool is_quad(int c) const noexcept
Read one mixed-cell topology field.
Definition MeshData.hpp:324
std::vector< uint8_t > vert_coupling_cd_set
Definition MeshData.hpp:159
std::vector< int > cell_nbr
Definition MeshData.hpp:89
std::vector< double > quad_vfr_z
Definition MeshData.hpp:115
std::vector< double > vert_coupling_cd
Definition MeshData.hpp:156