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
profilebuilder.h
Go to the documentation of this file.
1
25#ifndef PROFILE_BUILDER_H
26#define PROFILE_BUILDER_H
27
28#include <QDateTime>
29#include <QPointF>
30#include <QString>
31#include <QVector>
32
33#include <limits>
34
36{
37
42inline constexpr double kGravityFps2 = 32.174;
43inline constexpr double kGravityMps2 = 9.80665;
51enum class NodeKind
52{
53 Junction = 0,
54 Outfall,
55 Storage,
56 Divider,
62};
63
69enum class LinkKind
70{
71 Conduit = 0,
72 Pump,
73 Orifice,
74 Weir,
75 Outlet,
76};
77
95enum class OutputKind
96{
97 HGL = 0,
98 EGL,
100 MaxHGL,
101 MaxEGL,
102 MinHGL,
103 MinEGL,
106};
107
112inline constexpr double kNoBearing = 1.0e9;
113
139{
140 QString name;
142 double invertElev = 0.0;
145 double maxDepth = 0.0;
148 bool openTop = false;
149 double bearingRad = 0.0;
150 bool intoNode = false;
151 bool onPath = false;
154};
155
169{
170 QString name;
171 double invertElev = 0.0;
172 double maxDepth = 0.0;
173 double surchargeDepth = 0.0;
180 bool isInlet = false;
185 QVector<BranchLink> branches;
186};
187
198{
199 QString name;
200 double length = 0.0;
201 double offset1 = 0.0;
205 double offset2 = 0.0;
206 double maxDepth = 0.0;
207 double crestHeight = 0.0;
211 bool openTop = false;
214 bool isStreet = false;
220 bool reversed = false;
224};
225
242{
243 QVector<NodeStatic> nodes;
244 QVector<LinkStatic> links;
245 QVector<double> chainage;
246 QVector<QPointF> terrainSamples;
247};
248
261{
264 QString sourceId;
265 QDateTime startTime;
267 int periodCount = 0;
268
270 QVector<QVector<float>> nodeHead;
273 QVector<QVector<float>> nodeDepth;
277 QVector<QVector<float>> linkVelocity;
278};
279
292{
294 QVector<QVector<double>> hglByPeriod;
296 QVector<QVector<double>> eglByPeriod;
299 QVector<QVector<double>> waterSurfaceByPeriod;
300 QVector<double> minHgl;
301 QVector<double> maxHgl;
302 QVector<double> minEgl;
303 QVector<double> maxEgl;
304 QVector<double> minWaterSurface;
305 QVector<double> maxWaterSurface;
306};
307
314{
315 QString error;
316};
317
318// --------------------------------------------------------------------------
319// Static-topology utilities
320// --------------------------------------------------------------------------
321
327[[nodiscard]] QVector<double> computeChainage(const QVector<LinkStatic> &links);
328
333[[nodiscard]] double groundElev(const NodeStatic &n);
334
339[[nodiscard]] double conduitInvertUpstream(const PathStatic &path, int linkIdx);
340
345[[nodiscard]] double conduitInvertDownstream(const PathStatic &path, int linkIdx);
346
347// --------------------------------------------------------------------------
348// Per-period EGL helper (exposed for callers that want a point query rather
349// than a full envelope compute, e.g. tooltip / hover read-outs).
350// --------------------------------------------------------------------------
351
359[[nodiscard]] double velocityHead(const PathStatic &path,
360 const SourceSeries &src,
361 int nodeIdx,
362 int period,
363 double gravity);
364
369[[nodiscard]] double eglAtPeriod(const PathStatic &path,
370 const SourceSeries &src,
371 int nodeIdx,
372 int period,
373 double gravity);
374
375// --------------------------------------------------------------------------
376// Validation + full compute
377// --------------------------------------------------------------------------
378
385[[nodiscard]] Diagnostic validate(const PathStatic &path,
386 const SourceSeries &src);
387
393[[nodiscard]] SourceDerived compute(const PathStatic &path,
394 const SourceSeries &src,
395 double gravity);
396
408bool appendPeriods(const PathStatic &path,
409 const SourceSeries &src,
410 double gravity,
411 SourceDerived &derived);
412
419 const SourceSeries &src,
420 int p,
421 double gravity,
422 SourceDerived &out);
423
424} // namespace ProfileBuilder
425
426#endif // PROFILE_BUILDER_H
ArrowPlacement p
Definition linesymbollayer.cpp:27
std::size_t n
Definition mesh2dresultsexport.cpp:426
Definition profilebuilder.h:36
constexpr double kGravityFps2
Standard gravitational acceleration in the two unit systems SWMM supports. Caller passes whichever ap...
Definition profilebuilder.h:42
QVector< double > computeChainage(const QVector< LinkStatic > &links)
Computes cumulative chainage from the first node. chainage[0] = 0.0, chainage[i] = chainage[i-1] + li...
Definition profilebuilder.cpp:41
double groundElev(const NodeStatic &n)
Returns the ground elevation at node i along the path. Equivalent to nodes[i].invertElev + nodes[i]....
Definition profilebuilder.cpp:54
NodeKind
Topology category for the manhole-glyph picker in ProfilePlotWidget. Maps 1:1 to the relevant SWMMMod...
Definition profilebuilder.h:52
LinkKind
Connector category for the conduit-vs-glyph render branch in ProfilePlotWidget.
Definition profilebuilder.h:70
constexpr double kGravityMps2
Definition profilebuilder.h:43
constexpr double kNoBearing
Definition profilebuilder.h:112
double conduitInvertDownstream(const PathStatic &path, int linkIdx)
Symmetric to conduitInvertUpstream for the downstream end: nodes[i+1].invertElev + links[i]....
Definition profilebuilder.cpp:68
double eglAtPeriod(const PathStatic &path, const SourceSeries &src, int nodeIdx, int period, double gravity)
Convenience: EGL at node nodeIdx, period p = HGL(nodeIdx, p) + velocityHead(nodeIdx,...
Definition profilebuilder.cpp:105
double conduitInvertUpstream(const PathStatic &path, int linkIdx)
Returns the conduit-invert elevation at the upstream end of link i along the path: nodes[i]....
Definition profilebuilder.cpp:61
bool appendPeriods(const PathStatic &path, const SourceSeries &src, double gravity, SourceDerived &derived)
Live results: extend a SourceDerived built over the first derived.hglByPeriod.size() periods of src w...
Definition profilebuilder.cpp:270
OutputKind
Which elevation-axis quantity a profile series represents. Every option resolves to an elevation (ft ...
Definition profilebuilder.h:96
double velocityHead(const PathStatic &path, const SourceSeries &src, int nodeIdx, int period, double gravity)
Velocity-head at node nodeIdx for the given source at period p, using the path-direction convention: ...
Definition profilebuilder.cpp:79
void accumulatePeriod(const PathStatic &path, const SourceSeries &src, int p, double gravity, SourceDerived &out)
The per-period kernel shared by compute() and appendPeriods(): fills period p's rows of out (which mu...
Definition profilebuilder.cpp:212
SourceDerived compute(const PathStatic &path, const SourceSeries &src, double gravity)
Builds per-node HGL/EGL time-series and per-node envelope min/max for a single source....
Definition profilebuilder.cpp:162
Diagnostic validate(const PathStatic &path, const SourceSeries &src)
Sanity-checks a PathStatic + SourceSeries pair before compute(). Catches: empty path (< 2 nodes),...
Definition profilebuilder.cpp:123
int path
Definition pslgminsize.cpp:234
int src
index into the caller's vector; -1 = new
Definition pslgminsize.cpp:152
Returned from validate() to flag malformed inputs without triggering exceptions. Empty error means "O...
Definition profilebuilder.h:314
QString error
Definition profilebuilder.h:315
Time-invariant per-node properties needed by the profile plot. The "rim" elevation is always invertEl...
Definition profilebuilder.h:169
double surchargeDepth
Definition profilebuilder.h:173
double maxDepth
Definition profilebuilder.h:172
double invertElev
Definition profilebuilder.h:171
NodeKind kind
Definition profilebuilder.h:175
bool isInlet
Definition profilebuilder.h:180
QString name
Definition profilebuilder.h:170
QVector< BranchLink > branches
Definition profilebuilder.h:185
A fully-resolved profile path: ordered nodes, joining links, and cumulative chainage from nodes[0] to...
Definition profilebuilder.h:242
QVector< LinkStatic > links
Definition profilebuilder.h:244
QVector< double > chainage
Definition profilebuilder.h:245
QVector< QPointF > terrainSamples
Definition profilebuilder.h:246
QVector< NodeStatic > nodes
Definition profilebuilder.h:243
Output of compute(): per-source HGL/EGL series and per-node envelope min/max. Sized to match the inpu...
Definition profilebuilder.h:292
QVector< double > minHgl
Definition profilebuilder.h:300
QVector< double > maxEgl
Definition profilebuilder.h:303
QVector< double > maxHgl
Definition profilebuilder.h:301
QVector< QVector< double > > eglByPeriod
Definition profilebuilder.h:296
QVector< double > minEgl
Definition profilebuilder.h:302
QVector< double > minWaterSurface
Definition profilebuilder.h:304
QVector< QVector< double > > hglByPeriod
Definition profilebuilder.h:294
QVector< double > maxWaterSurface
Definition profilebuilder.h:305
QVector< QVector< double > > waterSurfaceByPeriod
Definition profilebuilder.h:299
Pre-fetched per-source time-series. One instance per SWMMResultsLayer that the user wants to overlay ...
Definition profilebuilder.h:261
QString sourceId
Definition profilebuilder.h:264
QVector< QVector< float > > nodeDepth
Definition profilebuilder.h:273
QDateTime startTime
Definition profilebuilder.h:265
int periodCount
Definition profilebuilder.h:267
QVector< QVector< float > > nodeHead
Definition profilebuilder.h:270
int reportStepSec
Definition profilebuilder.h:266
QVector< QVector< float > > linkVelocity
Definition profilebuilder.h:277