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
meshquadmatch.cpp File Reference
#include "mesh/meshquadmatch.h"
#include "mesh/meshcellgeom.h"
#include "mesh/meshquadmerge.h"
#include <QHash>
#include <algorithm>
#include <cmath>
Include dependency graph for meshquadmatch.cpp:

Namespaces

namespace  mesh
 

Functions

QVector< int > mesh::maximumMatching (int n, const QVector< QPair< int, int > > &edges)
 Maximum-cardinality matching on a general graph — Edmonds' blossom algorithm (O(V·E)). edges are unordered pairs in [0, n). Returns mate[i] (-1 = unmatched). Exposed for the brute-force cross-check test.
 
bool mesh::unionQuad (const QVector< MeshVertex > &vertices, const MeshTriangle &t1, const MeshTriangle &t2, MeshTriangle &quad)
 The CCW quad formed by two triangles sharing edge (p,q): returns false when they do not share exactly two vertices or the union is not a simple quad. quad receives v0..v3 (tag etc. copied from t1).
 
QuadPairingStats mesh::pairTrianglesIntoQuads (MeshResult &mesh, const QVector< int > &cellIds, const QVector< QuadTemplate > &templates, const QSet< QPair< int, int > > &lockedEdges, const QuadPairingOptions &opts, QVector< int > *oldToNew)
 Pair the triangles cellIds (indices into mesh.triangles; every one must be a triangle) into quads. templates carry OUTPUT vertex ids. lockedEdges (mesh::edgeKey pairs) are never straddled. On return oldToNew (optional) maps every old cell index to its new index (a paired triangle maps to its quad). Region triangles that were not paired keep their tag/mannings/initDepth; a quad inherits them from its first triangle (tags of the two triangles are equal inside a region).
 

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

Pairing region triangles into quads (QUAD_MESHING_REDESIGN_PLAN §4.4f): template lookup by sorted vertex triple (best score first), then an unweighted Edmonds blossom maximum-cardinality matching on the residual dual graph, then an alternating-4-cycle polish that swaps two adjacent pairs when the summed score increases. Cells are rebuilt triangles-first exactly like meshquadmerge.cpp.

Variable Documentation

◆ a

int a = -1

◆ b

int b = -1

local residual indices, a < b

◆ quad

MeshTriangle quad

◆ score

double score = 0.0

◆ t1

int t1 = -1

◆ t2

int t2 = -1