Loading...
Searching...
No Matches
meshcellgeom.h File Reference

Mixed triangle/quad cell helpers (workplans/TRI_QUAD_MESHING_PLAN_2026-09-06.md, phase G1). More...

#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
 The Qt-facing MeshKit API (meshkit::core_qt, meshkit::model_qt, meshkit::io_qt): mesh value types and cell attributes, the mesh generator, quad regions, matching and cleanup, mesh statistics, and the INP and 2DM mesh codecs.
 

Functions

constexpr int mesh::edgeSlot (int cell, int e) noexcept
 Compute the flat stride-four slot for one cell-local edge.
 
constexpr int mesh::slotCell (int slot) noexcept
 Decode the owning cell index from a stride-four flat edge slot.
 
constexpr int mesh::slotLocal (int slot) noexcept
 Decode local edge position from a stride-four flat slot.
 
constexpr int mesh::edgeSlotCount (int nCells) noexcept
 Calculate padded per-edge storage length for a cell count.
 
void mesh::edgeEndpoints (const MeshTriangle &t, int k, int &a, int &b) noexcept
 Resolve the ordered vertex IDs of one cell-local opposite-edge convention.
 
bool mesh::rt0CellDischarge (int cell, int nv, const float *flux, const float *length, const float *nx, const float *ny, double &qx, double &qy) noexcept
 Reconstruct planar specific discharge by least-squares fitting outward edge-normal discharge.
 
bool mesh::cellVelocity (int cell, int nv, const float *flux, const float *length, const float *nx, const float *ny, double depth, double dryDepth, double &vx, double &vy) noexcept
 Reconstruct cell velocity from edge discharge only when a usable wet depth is available.
 
CellGeom mesh::cellGeom (const QVector< MeshVertex > &vertices, const MeshTriangle &t)
 Compute triangle/quad subtriangles, positive fan area, area centroid and arithmetic mean elevation.
 
double mesh::cellSignedArea (const QVector< MeshVertex > &vertices, const MeshTriangle &t) noexcept
 Compute oriented polygon area in local coordinates to reduce projected-origin cancellation.
 
bool mesh::cellIsConvex (const QVector< MeshVertex > &vertices, const MeshTriangle &t) noexcept
 Check strict consistent quad turns, treating every triangle as convex without inspection.
 
bool mesh::cellContains (const QVector< MeshVertex > &vertices, const MeshTriangle &t, const QPointF &p, double eps=0.0) noexcept
 Test a point against the elevation-selected cell subtriangle fan using barycentric slack.
 

Variables

constexpr int mesh::kEdgeStride = 4
 Edge slots per cell in every flat per-edge array (== engine kMaxCellVerts).
 

Detailed Description

Mixed triangle/quad cell helpers (workplans/TRI_QUAD_MESHING_PLAN_2026-09-06.md, phase G1).

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
Date
2026
License
Apache-2.0

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.