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
meshcrossfield.h
Go to the documentation of this file.
1
23#ifndef OPENSWMMVIS_MESH_MESHCROSSFIELD_H
24#define OPENSWMMVIS_MESH_MESHCROSSFIELD_H
25
26#include <QPointF>
27#include <QRectF>
28#include <QVector>
29
30namespace mesh {
31
33{
34public:
35 struct Options
36 {
37 double pitch = 0.0;
38 int maxSweeps = 4000;
39 double tol = 1e-5;
40 double omega = 1.7;
41 double margin = 2.0;
42 };
43
44 CrossField() = default;
45
51 bool build(const QRectF &bbox, const QVector<QVector<QPointF>> &alignedPolylines,
52 const Options &opts);
53
55 void setConstant(double thetaDeg);
56
57 bool valid() const noexcept { return m_valid; }
58 int cols() const noexcept { return m_cols; }
59 int rows() const noexcept { return m_rows; }
60 int sweepsUsed() const noexcept { return m_sweeps; }
61
63 double thetaAt(double x, double y) const;
64
66 void directionsAt(double x, double y, QPointF d[4]) const;
67
69 QPointF cellU(int col, int row) const;
70 bool cellPinned(int col, int row) const;
71
72private:
73 bool m_valid = false;
74 bool m_constant = false;
75 double m_constTheta = 0.0;
76 int m_cols = 0, m_rows = 0, m_sweeps = 0;
77 double m_x0 = 0.0, m_y0 = 0.0, m_pitch = 0.0;
78 QVector<double> m_ux, m_uy;
79 QVector<bool> m_pinned;
80};
81
82} // namespace mesh
83
84#endif // OPENSWMMVIS_MESH_MESHCROSSFIELD_H
Definition meshcrossfield.h:33
bool cellPinned(int col, int row) const
Definition meshcrossfield.cpp:196
void directionsAt(double x, double y, QPointF d[4]) const
The four unit directions θ, θ+90°, θ+180°, θ+270° at (x, y).
Definition meshcrossfield.cpp:178
double thetaAt(double x, double y) const
Field angle in radians, folded to [0, π/2). Clamps outside the grid.
Definition meshcrossfield.cpp:154
void setConstant(double thetaDeg)
Constant field: every query returns thetaDeg (folded). valid() → true.
Definition meshcrossfield.cpp:147
bool valid() const noexcept
Definition meshcrossfield.h:57
int rows() const noexcept
Definition meshcrossfield.h:59
QPointF cellU(int col, int row) const
Raw representation vector (cos 4θ, sin 4θ) at a cell (tests).
Definition meshcrossfield.cpp:188
bool build(const QRectF &bbox, const QVector< QVector< QPointF > > &alignedPolylines, const Options &opts)
Solve the field over bbox with Dirichlet data along alignedPolylines (>= 2 points each; a closed ring...
Definition meshcrossfield.cpp:34
int cols() const noexcept
Definition meshcrossfield.h:58
CrossField()=default
int sweepsUsed() const noexcept
Definition meshcrossfield.h:60
int e
Definition inpmeshreader.cpp:41
QRectF bbox
Definition meshgenerator.cpp:166
Definition meshcommands.h:302
Definition meshcrossfield.h:36
double omega
SOR relaxation.
Definition meshcrossfield.h:40
int maxSweeps
SOR sweep cap.
Definition meshcrossfield.h:38
double tol
Stop when the max |Δu| over a sweep drops below this.
Definition meshcrossfield.h:39
double pitch
Grid spacing (map units). Required > 0 (use the region's h).
Definition meshcrossfield.h:37
double margin
Cells of padding around bbox on every side.
Definition meshcrossfield.h:41