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
mesh.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
2#pragma once
3#include "geometry.hpp"
4#include "events.hpp"
5#include <array>
6#include <functional>
7#include <string>
8#include <vector>
9
10namespace meshkit
11{
12using Index = std::uint32_t;
13constexpr Index missingIndex = ~Index(0);
14enum class PathKind : std::uint8_t { Outer, Hole, Line, Region };
15struct Path {
16 std::vector<Index> vertices;
18 std::int32_t marker = 0;
19 std::int64_t id = 0;
20 bool closed = false;
21};
22struct Cell {
23 std::array<Index, 4> vertices{};
24 std::int32_t region = 0;
25 std::uint8_t count = 3;
26};
27struct Edge {
28 Index a = 0, b = 0;
29 std::int32_t marker = 0;
30};
31struct Label {
32 std::int32_t id = 0;
33 std::string name;
34};
37 std::int64_t sourceId = 0;
38 std::int32_t marker = 0;
39};
40struct Metadata {
42 bool unitsKnown = true;
43 std::string crs, description;
44};
45// Geometry and sparse numeric attributes only; no engine/coupling ownership.
46// Empty id/marker arrays mean sequential one-based ids / zero markers. Arrays
47// are owned and contiguous. Connectivity is zero-based uint32 throughout.
48struct Mesh {
49 std::vector<Point3> vertices;
50 std::vector<Cell> cells;
51 std::vector<Edge> edges;
52 std::vector<Path> paths;
53 std::vector<std::int64_t> vertexIds, cellIds, edgeIds;
54 std::vector<std::int32_t> vertexMarkers;
55 std::vector<Label> labels;
56 std::vector<VertexAlias> aliases;
58};
59struct Limits {
60 std::uint64_t maxVertices = 20000000, maxCells = 20000000, maxEdges = 40000000;
61 std::uint64_t maxWorkspaceBytes = std::uint64_t(4) << 30;
62 std::uint64_t maxWork = 0; // Zero uses 20 billion orchestration/audit work units.
63 std::uint64_t maxMetadataBytes = 8 * 1024 * 1024, maxRecordBytes = 1024 * 1024;
64};
66 std::uint32_t schemaVersion = 1;
68 std::string code, message;
70 std::uint64_t work = 0, record = 0;
71 double seconds = 0;
72 bool complete() const noexcept
73 {
75 }
76};
77// Local connectivity/finite/positive convex-cell validation. It does not prove
78// arbitrary nonincident nonoverlap or CRS correctness. Caller owns metadata.
79OperationReport validateMesh(const Mesh &, const Limits & = {},
80 const std::function<bool()> &cancelled = {});
81}
Definition qtcdtstorage.h:9
OperationReport validateMesh(const Mesh &, const Limits &={}, const std::function< bool()> &cancelled={})
Definition mesh.cpp:9
std::uint32_t Index
Definition mesh.hpp:12
PathKind
Definition mesh.hpp:14
RunStatus
Definition events.hpp:21
constexpr Index missingIndex
Definition mesh.hpp:13
Definition mesh.hpp:22
std::int32_t region
Definition mesh.hpp:24
std::array< Index, 4 > vertices
Definition mesh.hpp:23
std::uint8_t count
Definition mesh.hpp:25
Definition events.hpp:52
Definition mesh.hpp:27
Index b
Definition mesh.hpp:28
std::int32_t marker
Definition mesh.hpp:29
Index a
Definition mesh.hpp:28
Definition mesh.hpp:31
std::string name
Definition mesh.hpp:33
Definition mesh.hpp:59
std::uint64_t maxWorkspaceBytes
Definition mesh.hpp:61
std::uint64_t maxRecordBytes
Definition mesh.hpp:63
std::uint64_t maxMetadataBytes
Definition mesh.hpp:63
std::uint64_t maxEdges
Definition mesh.hpp:60
std::uint64_t maxVertices
Definition mesh.hpp:60
std::uint64_t maxWork
Definition mesh.hpp:62
std::uint64_t maxCells
Definition mesh.hpp:60
Definition mesh.hpp:48
Metadata metadata
Definition mesh.hpp:57
std::vector< Label > labels
Definition mesh.hpp:55
std::vector< Cell > cells
Definition mesh.hpp:50
std::vector< Path > paths
Definition mesh.hpp:52
std::vector< Point3 > vertices
Definition mesh.hpp:49
std::vector< std::int32_t > vertexMarkers
Definition mesh.hpp:54
std::vector< Edge > edges
Definition mesh.hpp:51
std::vector< VertexAlias > aliases
Definition mesh.hpp:56
std::vector< std::int64_t > edgeIds
Definition mesh.hpp:53
std::vector< std::int64_t > vertexIds
Definition mesh.hpp:53
std::vector< std::int64_t > cellIds
Definition mesh.hpp:53
Definition mesh.hpp:40
double verticalMetresPerUnit
Definition mesh.hpp:41
bool unitsKnown
Definition mesh.hpp:42
double horizontalMetresPerUnit
Definition mesh.hpp:41
std::string description
Definition mesh.hpp:43
std::string crs
Definition mesh.hpp:43
Definition mesh.hpp:65
RunStatus status
Definition mesh.hpp:67
std::uint32_t schemaVersion
Definition mesh.hpp:66
std::string message
Definition mesh.hpp:68
std::uint64_t record
Definition mesh.hpp:70
std::uint64_t work
Definition mesh.hpp:70
std::string code
Definition mesh.hpp:68
double seconds
Definition mesh.hpp:71
Counts counts
Definition mesh.hpp:69
bool complete() const noexcept
Definition mesh.hpp:72
Definition mesh.hpp:15
bool closed
Definition mesh.hpp:20
std::int32_t marker
Definition mesh.hpp:18
std::vector< Index > vertices
Definition mesh.hpp:16
PathKind kind
Definition mesh.hpp:17
Definition mesh.hpp:35
std::int64_t sourceId
Definition mesh.hpp:37
Index vertex
Definition mesh.hpp:36
std::int32_t marker
Definition mesh.hpp:38
bool cancelled
Definition vectorexport.cpp:214