Loading...
Searching...
No Matches
meshpatch.h
Go to the documentation of this file.
1
23
24#ifndef OPENSWMMVIS_MESH_MESHPATCH_H
25#define OPENSWMMVIS_MESH_MESHPATCH_H
26
27#include "mesh/meshresult.h"
28
29#include <QPair>
30#include <QPointF>
31#include <QPolygonF>
32#include <QString>
33#include <QVector>
34
35namespace mesh
36{
37
42 QVector<QPointF> corners;
47 int n = 0, m = 0;
48 QString tag;
49};
50
55struct SweptPatch {
56 QVector<QPointF> centreline;
57 double width = 0.0;
58 int across = 0;
59 double along = 0.0;
60 QString tag;
61};
62
73 QVector<QPointF> bankA, bankB;
74 int across = 0;
75 double along = 0.0;
76 QString tag;
77};
78
81struct PatchLine {
82 QVector<int> path;
83 int marker = 0;
84 QString tag;
85};
86
88struct PatchMesh {
89 QVector<QPointF> xy;
90 QVector<MeshTriangle> quads;
91 QVector<QPair<int, int>> boundarySegments;
92 QString tag;
95 QVector<PatchLine> lines;
96};
97
99QString validate(const StructuredPatch &p);
107QString validate(const SweptPatch &p);
113QString validate(const PatchMesh &pm);
114
118QPolygonF orderedPatchBoundary(const PatchMesh &pm, QString *err = nullptr);
119
123PatchMesh makeTransfinitePatch(const StructuredPatch &p, QString *err = nullptr);
124
129PatchMesh makeSweptPatch(const SweptPatch &p, QString *err = nullptr);
130
134PatchMesh makeBankPairPatch(const BankPairPatch &p, QString *err = nullptr);
135
136// ── Quad-region redesign (QUAD_MESHING_REDESIGN_PLAN_2026-09-06.md §4.2) ───
137
146PatchMesh makeTransfinitePatch(const QVector<QVector<QPointF>> &sides, int n, int m,
147 const QString &tag, QString *err = nullptr);
158// Four already-stationed cyclic sides. Opposite side counts must agree.
159// Retains every boundary coordinate exactly; shared owners can reuse/reverse
160// one canonical sequence. No independent boundary resampling occurs.
161PatchMesh makeTransfinitePatchAtStations(const QVector<QVector<QPointF>> &sides,
162 const QString &tag, QString *err = nullptr);
163
167PatchMesh makeMappedPatch(const QPolygonF &ring, const QVector<int> &corners, double h,
168 const QString &tag, QString *err = nullptr);
169
175PatchMesh makeMappedPatch(const QPolygonF &ring, const QVector<int> &corners, double hAlong,
176 double hAcross, double alongAngleDeg, const QString &tag,
177 QString *err = nullptr);
178
179} // namespace mesh
180
181#endif // OPENSWMMVIS_MESH_MESHPATCH_H
value types for the 2D mesh generator.
The Qt-facing MeshKit API (meshkit::core_qt, meshkit::model_qt, meshkit::io_qt): mesh value types and...
QPolygonF orderedPatchBoundary(const PatchMesh &pm, QString *err=nullptr)
Validate the complete patch and return its CCW boundary, without a repeated closing vertex.
Definition meshpatch.cpp:9
PatchMesh makeTransfinitePatch(const StructuredPatch &p, QString *err=nullptr)
Transfinite interpolation on the four straight sides.
Definition meshpatch.cpp:10
PatchMesh makeMappedPatch(const QPolygonF &ring, const QVector< int > &corners, double h, const QString &tag, QString *err=nullptr)
Split a CCW ring at the four corners (ring vertex indices, ring order) into polyline sides,...
Definition meshpatch.cpp:15
PatchMesh makeSweptPatch(const SweptPatch &p, QString *err=nullptr)
Sweep the centreline: (stations)×(across+1) vertices, (stations-1)×across quads.
Definition meshpatch.cpp:11
PatchMesh makeTransfinitePatchAtStations(const QVector< QVector< QPointF > > &sides, const QString &tag, QString *err=nullptr)
Coons patch whose boundary vertices are exactly the given side stations.
Definition meshpatch.cpp:14
PatchMesh makeBankPairPatch(const BankPairPatch &p, QString *err=nullptr)
Build a conforming strip between two simple, disjoint banks.
Definition meshpatch.cpp:12
QString validate(const StructuredPatch &p)
Input checks.
Definition meshpatch.cpp:6
Two open bank polylines with independently supplied directions.
Definition meshpatch.h:68
QVector< QPointF > bankA
First bank: open polyline of >= 2 finite points with no repeated consecutive point.
Definition meshpatch.h:73
QVector< QPointF > bankB
Second bank, same rules; must not touch or cross bankA.
Definition meshpatch.h:73
int across
Quads between the banks at every station; must be >= 1.
Definition meshpatch.h:74
QString tag
Copied to the generated patch and its quads.
Definition meshpatch.h:76
double along
Target station spacing in XY units; finite >= 0 (0 = union only).
Definition meshpatch.h:75
A polyline through a patch's vertices that must be reported as mesh edges with a marker — a conduit r...
Definition meshpatch.h:81
QVector< int > path
Local vertex indices, consecutive ones joined by quad edges.
Definition meshpatch.h:82
QString tag
Edge tag; empty = MeshGenerator resolves it from marker's constraint tag.
Definition meshpatch.h:84
int marker
Copied to each emitted MeshEdge::marker.
Definition meshpatch.h:83
A generated patch in local indices.
Definition meshpatch.h:88
QVector< MeshTriangle > quads
v3 >= 0, local indices.
Definition meshpatch.h:90
QString tag
Patch tag; MeshGenerator gives it to stitched quads whose own tag is empty.
Definition meshpatch.h:92
QVector< PatchLine > lines
Interior lines emitted as MeshResult::boundaryEdges with their marker and tag, and bounding region ta...
Definition meshpatch.h:95
QVector< QPair< int, int > > boundarySegments
Local index pairs around the patch.
Definition meshpatch.h:91
QVector< QPointF > xy
Vertex coordinates (caller XY units); local index = position.
Definition meshpatch.h:89
Four-sided patch: corners in cyclic order (either orientation); n subdivisions along corner0→corner1 ...
Definition meshpatch.h:41
QString tag
Copied verbatim to PatchMesh::tag and to every quad's tag.
Definition meshpatch.h:48
int n
Quads along corner0→corner1; must be >= 1 (the default 0 fails validate()).
Definition meshpatch.h:47
QVector< QPointF > corners
Exactly 4, cyclic.
Definition meshpatch.h:42
int m
Quads along corner0→corner3; >= 1, and (n+1)(m+1) must fit an int index.
Definition meshpatch.h:47
Swept patch: the centreline is offset ±width/2 (mitred at interior vertices) and cut into across quad...
Definition meshpatch.h:55
double along
Target station spacing in XY units; finite >= 0 (0 = vertices).
Definition meshpatch.h:59
QString tag
Copied verbatim to PatchMesh::tag and to every quad's tag.
Definition meshpatch.h:60
double width
Full strip width in XY units; must be finite and > 0.
Definition meshpatch.h:57
int across
Quads across the strip at every station; must be >= 1.
Definition meshpatch.h:58
QVector< QPointF > centreline
>= 2 points.
Definition meshpatch.h:56