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
meshboundarygraph.h
Go to the documentation of this file.
1
14#ifndef OPENSWMMVIS_MESH_MESHBOUNDARYGRAPH_H
15#define OPENSWMMVIS_MESH_MESHBOUNDARYGRAPH_H
16
17#include <QHash>
18#include <QVector>
19
20namespace mesh {
21
22struct MeshResult;
23
34{
35public:
40 const QVector<bool> &isBoundary);
41
51 [[nodiscard]] QVector<int> shortestPath(int startSlot, int endSlot) const;
52
55 [[nodiscard]] bool isEmpty() const { return m_edges.isEmpty(); }
56
58 [[nodiscard]] int edgeCount() const { return int(m_edges.size()); }
59
61 [[nodiscard]] bool contains(int slot) const
62 { return m_slotToEdge.contains(slot); }
63
64private:
65 struct Edge
66 {
67 int slot = -1;
68 int a = -1;
69 int b = -1;
70 double len = 0.0;
71 };
72
73 QVector<Edge> m_edges;
74 QHash<int,int> m_slotToEdge;
75 // CSR adjacency over compact vertex ids: the boundary touches only a
76 // small subset of a large mesh's vertices, so compacting keeps the
77 // arrays proportional to the boundary rather than to the whole mesh.
78 QVector<int> m_vertPtr;
79 QVector<int> m_vertEdge;
80};
81
82} // namespace mesh
83
84#endif // OPENSWMMVIS_MESH_MESHBOUNDARYGRAPH_H
Undirected graph whose nodes are mesh vertices and whose arcs are boundary edge slots (mesh::edgeSlot...
Definition meshboundarygraph.h:34
static MeshBoundaryGraph build(const MeshResult &mesh, const QVector< bool > &isBoundary)
Build from mesh and the flat per-slot boundary flags (isBoundary[mesh::edgeSlot(cell,...
Definition meshboundarygraph.cpp:19
bool contains(int slot) const
True when slot (mesh::edgeSlot(cell, edgeLocal)) is one of them.
Definition meshboundarygraph.h:61
QVector< int > shortestPath(int startSlot, int endSlot) const
Shortest chain of boundary edge slots from startSlot to endSlot, inclusive of both terminal slots.
Definition meshboundarygraph.cpp:84
int edgeCount() const
Number of boundary edge slots in the graph.
Definition meshboundarygraph.h:58
bool isEmpty() const
True when the mesh contributed no boundary edges (also the state of a default-constructed graph).
Definition meshboundarygraph.h:55
std::vector< double > len
Definition mesh2dresultsexport.cpp:448
int b
local residual indices, a < b
Definition meshquadmatch.cpp:46
int a
Definition meshquadmatch.cpp:46
Definition meshcommands.h:302
Result of MeshGenerator::generate.
Definition meshresult.h:116