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
gageblend.h
Go to the documentation of this file.
1
37#ifndef OPENSWMMVIS_CORE_GAGEBLEND_H
38#define OPENSWMMVIS_CORE_GAGEBLEND_H
39
40#include <QString>
41#include <QVector>
42
43#include <QtGlobal>
44
45namespace GageBlend
46{
47
49enum class RainType
50{
51 Intensity = 0,
52 Volume = 1,
53 Cumulative = 2
54};
55
57constexpr int kMaxGridCells = 200000;
58
60constexpr double kVolumeTolerance = 1e-9;
61
64{
65 qint64 t = 0;
66 double value = 0.0;
67};
68
71{
72 QVector<SeriesPoint> points;
73 qint64 intervalSec = 0;
75 double scaleFactor = 1.0;
76 QString name;
77};
78
80struct Box
81{
82 qint64 t0 = 0;
83 qint64 t1 = 0;
84 double intensity = 0.0;
85};
86
89{
90 QVector<SeriesPoint> points;
91 qint64 intervalSec = 0;
92
93 double blendedDepth = 0.0;
94 double referenceDepth = 0.0;
95 double relativeError = 0.0;
96
97 double peakBlended = 0.0;
98 double peakReference = 0.0;
99
100 QString error;
101
103 [[nodiscard]] bool volumeOk() const
104 {
105 return error.isEmpty() && relativeError <= kVolumeTolerance;
106 }
107
111 [[nodiscard]] double peakRetention() const
112 {
113 return peakReference > 0.0 ? peakBlended / peakReference : 1.0;
114 }
115};
116
131[[nodiscard]] QVector<Box> toBoxes(const SourceGage &source);
132
134[[nodiscard]] double boxDepth(const QVector<Box> &boxes);
135
143[[nodiscard]] double engineDepth(const QVector<SeriesPoint> &points,
144 qint64 intervalSec,
145 RainType rainType = RainType::Intensity,
146 double scaleFactor = 1.0);
147
164[[nodiscard]] BlendResult blend(const QVector<SourceGage> &sources,
165 const QVector<double> &weights);
166
167} // namespace GageBlend
168
169#endif // OPENSWMMVIS_CORE_GAGEBLEND_H
int e
Definition inpmeshreader.cpp:41
QPointer< OpenSWMMVisLayer > source
Definition maskclipresolver.cpp:30
Definition gageblend.h:46
double boxDepth(const QVector< Box > &boxes)
Total depth carried by a box list.
Definition gageblend.cpp:88
constexpr int kMaxGridCells
Ceiling on grid cells, so a pathological gcd cannot melt the model.
Definition gageblend.h:57
QVector< Box > toBoxes(const SourceGage &source)
Expand one source into explicit intensity boxes.
Definition gageblend.cpp:36
BlendResult blend(const QVector< SourceGage > &sources, const QVector< double > &weights)
Blend sources under weights into one INTENSITY series.
Definition gageblend.cpp:109
constexpr double kVolumeTolerance
Relative tolerance for the volume-conservation check.
Definition gageblend.h:60
double engineDepth(const QVector< SeriesPoint > &points, qint64 intervalSec, RainType rainType=RainType::Intensity, double scaleFactor=1.0)
Total depth of an emitted series under the ENGINE's boxcar rule.
Definition gageblend.cpp:96
RainType
Rain-data format, matching SWMM_GageRainType.
Definition gageblend.h:50
@ Intensity
Value is a rate (depth/hour).
@ Volume
Value is depth accumulated over one interval.
@ Cumulative
Value is a running total; deltas carry the depth.
Outcome of one blend.
Definition gageblend.h:89
qint64 intervalSec
gcd of the source intervals.
Definition gageblend.h:91
double referenceDepth
Weighted sum of the sources' depths.
Definition gageblend.h:94
bool volumeOk() const
True when the blend conserved volume within tolerance.
Definition gageblend.h:103
double peakReference
Weighted sum of the sources' peaks.
Definition gageblend.h:98
double peakBlended
Max emitted intensity.
Definition gageblend.h:97
double peakRetention() const
Fraction of the reference peak that survived, or 1 when flat. Reported, never enforced — attenuation ...
Definition gageblend.h:111
double relativeError
|blended - reference| / max(reference, eps).
Definition gageblend.h:95
QString error
Non-empty means nothing was produced.
Definition gageblend.h:100
QVector< SeriesPoint > points
Emitted series; INTENSITY.
Definition gageblend.h:90
double blendedDepth
Total depth of points.
Definition gageblend.h:93
A constant-intensity interval, [t0, t1), in depth/hour.
Definition gageblend.h:81
double intensity
Definition gageblend.h:84
qint64 t1
Definition gageblend.h:83
qint64 t0
Definition gageblend.h:82
One (time, value) entry of a rainfall series.
Definition gageblend.h:64
double value
In the series' own rain type and units.
Definition gageblend.h:66
qint64 t
Seconds since the epoch.
Definition gageblend.h:65
A contributing gage: its series plus everything needed to read it.
Definition gageblend.h:71
QString name
For diagnostics only.
Definition gageblend.h:76
double scaleFactor
Folded into the blend.
Definition gageblend.h:75
QVector< SeriesPoint > points
Strictly increasing in t.
Definition gageblend.h:72
RainType rainType
Definition gageblend.h:74
qint64 intervalSec
Gage recording interval.
Definition gageblend.h:73