SWMMVis  6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
meshcellgeom.h File Reference
#include "mesh/meshresult.h"
#include <QPointF>
#include <QVector>
#include <array>
#include <cmath>
Include dependency graph for meshcellgeom.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mesh::CellGeom
 Per-cell derived geometry shared by every consumer. More...
 

Namespaces

namespace  mesh
 

Functions

constexpr int mesh::edgeSlot (int cell, int e) noexcept
 
constexpr int mesh::slotCell (int slot) noexcept
 
constexpr int mesh::slotLocal (int slot) noexcept
 
constexpr int mesh::edgeSlotCount (int nCells) noexcept
 
void mesh::edgeEndpoints (const MeshTriangle &t, int k, int &a, int &b) noexcept
 
bool mesh::rt0CellDischarge (int cell, int nv, const float *flux, const float *length, const float *nx, const float *ny, double &qx, double &qy) noexcept
 RT0 least-squares specific discharge (m²/s) of one cell from its outward-positive normal edge fluxes (m³/s).
 
CellGeom mesh::cellGeom (const QVector< MeshVertex > &vertices, const MeshTriangle &t)
 Geometry of cell t against vertices.
 
double mesh::cellSignedArea (const QVector< MeshVertex > &vertices, const MeshTriangle &t) noexcept
 Signed area of the polygon (positive = counter-clockwise).
 
bool mesh::cellIsConvex (const QVector< MeshVertex > &vertices, const MeshTriangle &t) noexcept
 Convexity test for a quad (every consecutive cross product has the same non-zero sign). Triangles are trivially convex.
 
bool mesh::cellContains (const QVector< MeshVertex > &vertices, const MeshTriangle &t, const QPointF &p, double eps=0.0) noexcept
 Point-in-cell test on the sub-triangle fan (barycentric per sub-triangle).
 

Variables

constexpr int mesh::kEdgeStride = 4
 

Detailed Description

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
Date
2026
License\n GPL-3.0-or-later

Mixed triangle/quad cell helpers (workplans/TRI_QUAD_MESHING_PLAN_2026-09-06.md, phase G1). ONE place decides how a cell's edges are numbered, how its flat edge slots are addressed, and how a quad is split into the two sub-triangles the engine's storage model uses — rendering, hit-testing, profiles, contours and statistics all draw the same picture the solver stores.

Engine contract (plans/2D_TRI_QUAD_MESH_PLAN_2026-09-06.md):

  • local edge k of a cell has endpoints v[(k+1)nv], v[(k+2)nv] (for a triangle: the historical "edge k is opposite vertex k");
  • per-edge SoAs are padded to kEdgeStride = 4 slots per cell (cell * 4 + k; slot 3 of a triangle is unused);
  • a quad's storage (VFR) model is two planar sub-triangles split along the diagonal chosen from the elevation ordering of its vertices (Begnudelli & Sanders 2007, Cases 1–3): the same split is used here.