Loading...
Searching...
No Matches
meshresult.h
Go to the documentation of this file.
1
13
14#ifndef OPENSWMMVIS_MESH_MESHRESULT_H
15#define OPENSWMMVIS_MESH_MESHRESULT_H
16
17#include <QHash>
18#include <QPointF>
19#include <QString>
20#include <QVector>
21
22#include <limits>
23
24#include "meshinfil.h" // InfilRow / InfilDefaultRow / InfilOptions (GG0 §3.2a)
25
26namespace mesh
27{
28
30struct MeshVertex {
31 QPointF xy;
32 double z = 0.0;
33 int marker = 0;
34 QString tag;
35 QString coupledNode;
36 double couplingCd = 0.65;
37 double couplingArea =
38 1.0;
42 bool couplingCdSet = true;
45 bool couplingAreaSet = true;
46};
47
71 int v0 = 0, v1 = 0, v2 = 0;
72 int v3 = -1;
73 QString tag;
77 double mannings = std::numeric_limits<double>::quiet_NaN();
82 double initDepth = std::numeric_limits<double>::quiet_NaN();
87 double initHgl = std::numeric_limits<double>::quiet_NaN();
91 double initU = 0.0;
92 double initV = 0.0;
93
99 bool isQuad() const noexcept { return v3 >= 0; }
105 int vertexCount() const noexcept { return v3 >= 0 ? 4 : 3; }
115 int vertex(int k) const noexcept
116 {
117 switch (k) {
118 case 0:
119 return v0;
120 case 1:
121 return v1;
122 case 2:
123 return v2;
124 case 3:
125 return v3;
126 default:
127 return -1;
128 }
129 }
130
139 void setVertex(int k, int v) noexcept
140 {
141 switch (k) {
142 case 0:
143 v0 = v;
144 break;
145 case 1:
146 v1 = v;
147 break;
148 case 2:
149 v2 = v;
150 break;
151 case 3:
152 v3 = v;
153 break;
154 default:
155 break;
156 }
157 }
158
165 bool hasVertex(int v) const noexcept
166 {
167 return v0 == v || v1 == v || v2 == v || (v3 >= 0 && v3 == v);
168 }
169};
170
173
175struct MeshEdge {
180 int v0 = 0, v1 = 0;
181 int marker = 0;
182 QString tag;
183};
184
194 int tri = -1;
195 QString nodeId;
196 double cd = 0.65;
197 double area = 2.0;
198 bool cdSet = true;
199 bool areaSet = true;
200};
201
206 QVector<MeshVertex> vertices;
207 QVector<MeshTriangle> triangles;
211 QVector<MeshEdge> boundaryEdges;
212 QVector<CellCoupling> cellCouplings;
213
220 // Engine-resolved authoring preview; absent means unavailable, not zero.
258 QVector<InfilDefaultRow> infilDefaults;
259 QHash<int, InfilRow> infilOverrides;
261
262 bool ok = false;
263 QString errorMsg;
264
273 int quadCount() const noexcept
274 {
275 int n = 0;
276 for (const MeshTriangle &t : triangles)
277 n += t.isQuad() ? 1 : 0;
278 return n;
279 }
280
286 bool hasQuads() const noexcept
287 {
288 for (const MeshTriangle &t : triangles)
289 if (t.isQuad())
290 return true;
291 return false;
292 }
293};
294
295} // namespace mesh
296
297#endif // OPENSWMMVIS_MESH_MESHRESULT_H
Per-cell 2D infiltration: value types, tag/override resolution and method↔parameter masks.
The Qt-facing MeshKit API (meshkit::core_qt, meshkit::model_qt, meshkit::io_qt): mesh value types and...
MeshTriangle MeshCell
Alias: a "triangle" row is any cell (triangle or quad).
Definition meshresult.h:172
A 1D node coupled to a mesh cell (centroid coupling).
Definition meshresult.h:193
int tri
Triangle index into MeshResult::triangles.
Definition meshresult.h:194
bool areaSet
False: row written without AREA.
Definition meshresult.h:199
bool cdSet
False: row written without CD (see MeshVertex::couplingCdSet).
Definition meshresult.h:198
double area
Effective exchange area, mesh length units² (mapper default).
Definition meshresult.h:197
double cd
Discharge coefficient (engine default).
Definition meshresult.h:196
QString nodeId
SWMM node id.
Definition meshresult.h:195
[2D_INFILTRATION_OPTIONS].
Definition meshinfil.h:141
A boundary edge with its source-segment marker preserved.
Definition meshresult.h:175
int marker
Source segment marker; non-zero if assigned by caller.
Definition meshresult.h:181
int v1
Second endpoint; the pair is not oriented relative to the adjacent cells.
Definition meshresult.h:180
QString tag
Resolved tag (e.g. conduit ID, "domain", "outflow").
Definition meshresult.h:182
int v0
First endpoint: index into MeshResult::vertices, in source-path order.
Definition meshresult.h:180
Result of MeshGenerator::generate.
Definition meshresult.h:203
QVector< InfilDefaultRow > infilDefaults
Per-cell infiltration defaults: tag rows; '*' = mesh-wide fallback.
Definition meshresult.h:258
QVector< CellCoupling > cellCouplings
Node→cell couplings (Part C).
Definition meshresult.h:212
QVector< MeshEdge > boundaryEdges
Marked constraint edges, not only the outer boundary: generate() lists every kept sub-edge of the dom...
Definition meshresult.h:211
QVector< MeshTriangle > triangles
Cells: triangles first, then quads (engine order).
Definition meshresult.h:207
QVector< MeshVertex > vertices
Mesh vertices; cells and edges index into this array.
Definition meshresult.h:206
QVector< double > surfaceSourcePerviousPercent
Per-cell spatial-source pervious/LID area in percent, indexed like triangles.
Definition meshresult.h:221
bool ok
True only when the producer (generator or reader) succeeded.
Definition meshresult.h:262
QString errorMsg
Failure reason when ok is false; empty on success.
Definition meshresult.h:263
QVector< int > infiltrationConflict
Per-cell infiltration conflict code, caller-filled: 0 none, 1 explicit surface cell method,...
Definition meshresult.h:236
QVector< int > infiltrationOwner
Per-cell resolved infiltration owner, indexed like triangles and caller-filled from the engine: 0 pro...
Definition meshresult.h:236
bool hasQuads() const noexcept
Determine whether any stored cell has a nonnegative fourth identifier.
Definition meshresult.h:286
int quadCount() const noexcept
Count cells whose fourth identifier classifies them as quadrilaterals.
Definition meshresult.h:273
InfilOptions infilOptions
[2D_INFILTRATION_OPTIONS].
Definition meshresult.h:260
QVector< int > surfaceOwnershipStatus
Per-cell surface ownership review code, indexed like triangles and caller-filled: 0 mesh only,...
Definition meshresult.h:229
QVector< double > surfaceMeshWeatherPercent
Per-cell share of the cell's weather that remains with the mesh, in percent ("Remaining mesh weather"...
Definition meshresult.h:221
QHash< int, InfilRow > infilOverrides
Sparse, keyed by triangle index.
Definition meshresult.h:259
QStringList infiltrationSource
Per-cell display text naming the infiltration source, caller-filled and parallel to infiltrationOwner...
Definition meshresult.h:239
A cell in the mesh — a triangle or (since the engine's mixed tri-quad meshes, workplans/TRI_QUAD_MESH...
Definition meshresult.h:64
int v2
Third corner, cyclically after v1.
Definition meshresult.h:71
double initU
Initial velocity components in m/s whatever the project units ([2D_INITIAL_VELOCITY] U and V).
Definition meshresult.h:91
int v1
Second corner, cyclically after v0.
Definition meshresult.h:71
double initV
[2D_INITIAL_VELOCITY] V: map-Y velocity in m/s; see initU.
Definition meshresult.h:92
double initDepth
Initial water depth in m ([2D_TRIANGLES] INIT_DEPTH, written between MANNINGS_N and TAG).
Definition meshresult.h:82
int vertex(int k) const noexcept
Fetch one stored corner identifier without a vertex-array lookup.
Definition meshresult.h:115
int v3
Fourth vertex of a quadrilateral; -1 = triangle.
Definition meshresult.h:72
double initHgl
Initial water-surface elevation in mesh length units on the vertex Z datum ([2D_INITIAL_HGL]).
Definition meshresult.h:87
int vertexCount() const noexcept
Report the logical corner count selected by the fourth-vertex sentinel.
Definition meshresult.h:105
double mannings
Manning's roughness ([2D_TRIANGLES] MANNINGS_N).
Definition meshresult.h:77
int v0
First corner: index into MeshResult::vertices (not range-checked here).
Definition meshresult.h:71
bool hasVertex(int v) const noexcept
Check whether an identifier equals a stored logical corner.
Definition meshresult.h:165
void setVertex(int k, int v) noexcept
Replace a stored corner identifier, leaving every other cell attribute unchanged.
Definition meshresult.h:139
bool isQuad() const noexcept
Classify the cell solely by whether a fourth vertex identifier is present.
Definition meshresult.h:99
QString tag
Region tag, for example a subcatchment ID; empty if untagged.
Definition meshresult.h:73
A vertex in the generated mesh.
Definition meshresult.h:30
bool couplingAreaSet
False when the [2D_VERTEX_NODE_MAP] row has no AREA token: the writer omits AREA (and CD too unless c...
Definition meshresult.h:45
double couplingArea
[2D_VERTEX_NODE_MAP] AREA column, mesh length units² (engine default).
Definition meshresult.h:37
bool couplingCdSet
False when the row does not author CD / AREA: it is written without the token and the engine applies ...
Definition meshresult.h:42
int marker
Input/output point marker (carries our tag id).
Definition meshresult.h:33
QPointF xy
Map units (project CRS).
Definition meshresult.h:31
double z
Sampled DTM elevation (set by DTMSampler; 0 until then).
Definition meshresult.h:32
double couplingCd
[2D_VERTEX_NODE_MAP] CD column (engine default).
Definition meshresult.h:36
QString coupledNode
Coupled SWMM node id ([2D_VERTEX_NODE_MAP]); empty if uncoupled.
Definition meshresult.h:35
QString tag
Descriptive label ([2D_VERTICES] TAG column); empty if none.
Definition meshresult.h:34