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
gageassignment.h
Go to the documentation of this file.
1
28#ifndef OPENSWMMVIS_CORE_GAGEASSIGNMENT_H
29#define OPENSWMMVIS_CORE_GAGEASSIGNMENT_H
30
31#include <QPair>
32#include <QPointF>
33#include <QString>
34#include <QVector>
35
37{
38
45constexpr double kWeightEpsilon = 1e-4;
46
48constexpr double kDefaultClusterTol = 0.01;
49
51constexpr int kDefaultSampleTarget = 200;
52
53// ===========================================================================
54// Thiessen area-majority
55// ===========================================================================
56
68[[nodiscard]] QVector<QPointF> clipHalfPlane(const QVector<QPointF> &ring,
69 const QPointF &keep,
70 const QPointF &drop);
71
82[[nodiscard]] QVector<double> thiessenAreaShares(const QVector<QPointF> &ring,
83 const QVector<QPointF> &gages);
84
91[[nodiscard]] int areaMajorityGage(const QVector<double> &shares,
92 double *fractionOut = nullptr);
93
94// ===========================================================================
95// Interpolation support
96// ===========================================================================
97
110[[nodiscard]] QVector<QPointF> samplePolygon(const QVector<QPointF> &ring,
111 int target = kDefaultSampleTarget);
112
123[[nodiscard]] QVector<QPair<int, double>> idwWeights(const QPointF &p,
124 const QVector<QPointF> &sites);
125
126// ===========================================================================
127// Weight-vector clustering
128// ===========================================================================
129
137{
138 QVector<QPair<int, long long>> terms;
139 QString serialized;
140
141 [[nodiscard]] bool isEmpty() const { return terms.isEmpty(); }
142};
143
156[[nodiscard]] ClusterKey quantizeWeights(const QVector<double> &w,
157 double tol = kDefaultClusterTol,
158 double wEps = kWeightEpsilon);
159
169[[nodiscard]] QVector<double> dequantizeWeights(const ClusterKey &key,
170 double tol,
171 int nGages);
172
173} // namespace GageAssignment
174
175#endif // OPENSWMMVIS_CORE_GAGEASSIGNMENT_H
int e
Definition inpmeshreader.cpp:41
ArrowPlacement p
Definition linesymbollayer.cpp:27
int w
Definition mesh2dresultsexport.cpp:387
const char * key
Definition meshcellparams.cpp:24
QPolygonF ring
normalizeRingCCW(r.ring).
Definition meshgenerator.cpp:156
Definition gageassignment.h:37
QVector< double > thiessenAreaShares(const QVector< QPointF > &ring, const QVector< QPointF > &gages)
Area of ring intersected with each gage's Voronoi cell.
Definition gageassignment.cpp:96
QVector< QPointF > clipHalfPlane(const QVector< QPointF > &ring, const QPointF &keep, const QPointF &drop)
Clip an open ring by the half-plane of points at least as close to keep as to drop.
Definition gageassignment.cpp:49
constexpr double kDefaultClusterTol
Default weight-agreement tolerance for clustering (1%).
Definition gageassignment.h:48
QVector< QPair< int, double > > idwWeights(const QPointF &p, const QVector< QPointF > &sites)
Inverse-distance weights (power 2), normalised to sum 1.
Definition gageassignment.cpp:209
constexpr int kDefaultSampleTarget
Default number of interior samples requested per ring.
Definition gageassignment.h:51
int areaMajorityGage(const QVector< double > &shares, double *fractionOut=nullptr)
Index of the largest share, ties broken toward the lowest index.
Definition gageassignment.cpp:129
constexpr double kWeightEpsilon
Weights below this magnitude are clamped to zero before clustering.
Definition gageassignment.h:45
QVector< QPointF > samplePolygon(const QVector< QPointF > &ring, int target=kDefaultSampleTarget)
Interior sample points for area-averaging a field over a ring.
Definition gageassignment.cpp:160
ClusterKey quantizeWeights(const QVector< double > &w, double tol=kDefaultClusterTol, double wEps=kWeightEpsilon)
Quantise a dense weight vector into a canonical cluster key.
Definition gageassignment.cpp:240
QVector< double > dequantizeWeights(const ClusterKey &key, double tol, int nGages)
Dense weights implied by a key — the blend actually synthesised.
Definition gageassignment.cpp:297
A canonical, integer-valued summary of one weight vector.
Definition gageassignment.h:137
bool isEmpty() const
Definition gageassignment.h:141
QVector< QPair< int, long long > > terms
(gage index, quantum), sorted by index.
Definition gageassignment.h:138
QString serialized
"3:57|7:29|11:14"; "" when empty.
Definition gageassignment.h:139