![]() |
SWMMVis
6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
|
#include <swmm2dresultslayer.h>
Public Member Functions | |
| HDF5Mesh2DSource () | |
| ~HDF5Mesh2DSource () override | |
| bool | open (const QString &path) |
| const QString & | path () const noexcept |
| int | vertexCount () const override |
| Geometry counts. Stable for the lifetime of the source. | |
| int | triangleCount () const override |
| int | timeCount () const override |
| Latest known time-step count (grows during live mode). | |
| bool | readMeshGeometry (std::vector< double > &vx, std::vector< double > &vy, std::vector< double > &vz, std::vector< std::array< int, 3 > > &tris) override |
| Fetch mesh geometry as a DISPLAY triangle fan. Resizes outputs. | |
| bool | readCells (std::vector< double > &vx, std::vector< double > &vy, std::vector< double > &vz, std::vector< std::array< int, 4 > > &cells) override |
Fetch mesh geometry as CELLS: cells[i] = {v0,v1,v2,v3} with v3 == -1 for a triangle (cyclic order for a quad), one entry per face, engine order (triangles first, then quads). Resizes outputs. | |
| bool | readDepthsAt (int timeIdx, std::vector< float > &depths) override |
Fetch per-triangle depth at timeIdx. Resizes depths to triangleCount(). | |
| QDateTime | simTimeAt (int timeIdx) const override |
Wall-clock sim time at timeIdx (invalid if out of range or unknown). | |
| bool | readEdgeFluxAt (int timeIdx, std::vector< float > &flux) override |
Fetch per-edge signed normal flux at timeIdx. | |
| bool | readEdgeGeometry (std::vector< float > &length, std::vector< float > &nx, std::vector< float > &ny) override |
| Fetch time-invariant edge geometry (length + outward unit normal). | |
| bool | readVertexDepthsAt (int timeIdx, std::vector< float > &vdepths) override |
Fetch per-vertex SIGNED water depth (m) at timeIdx — the engine's wet-masked, depth-weighted render reconstruction η_v − z_v (Mesh2_node_depth / swmm_2d_vertex_get_render_depths_bulk). NOT clamped: negative values over the dry side of partially wet cells carry the sub-cell shoreline intercept; exactly 0 where no incident cell is wet. Dry-cell bed elevations never contribute (unlike the legacy Mesh2_node_head solver field, which is deliberately NOT consumed here — blending dry-cell beds lifted the rendered surface up adverse slopes/steps). Resized to vertexCount(). | |
| bool | hasFaceField (const char *dataset) const override |
Whether the source carries a named per-face [nTime, nFace] field beyond depth (e.g. "Mesh2_face_rainfall", "Mesh2_face_rain_cum"). Default: none — the live in-process source streams depth/flux only. | |
| bool | readFaceFieldAt (const char *dataset, int timeIdx, std::vector< float > &values) override |
Fetch one time slice of a named per-face field (engine SI units). Resized to triangleCount(). Default returns false. | |
| bool | readFaceEnvelope (const char *dataset, std::vector< float > &values) override |
Fetch a time-INVARIANT per-face [nFace] envelope written by the engine's ENVELOPES output group ("Mesh2_face_max_depth", "Mesh2_face_max_velocity"): the whole-run maximum per cell, engine SI units, resized to triangleCount(). | |
| openswmmvis::io::CoordinateReference | coordinateReference () const override |
| How the coordinates from readMeshGeometry relate to the model CRS — see openswmmvis::io::CoordinateReference. | |
| void | setSimulationStart (QDateTime t) |
| Anchor wall-clock time for the simulation start (so /time (seconds since start) maps back to a QDateTime for the global slider). | |
Public Member Functions inherited from IMesh2DSource | |
| virtual | ~IMesh2DSource ()=default |
| virtual bool | isLive () const |
| True while this source is streaming from a running simulation (frames keep arriving). The animation must NOT auto-advance to the newest frame for a live source — the user drives playback via the slider / Play. A completed file source returns false. | |
| virtual bool | readDepthAt (int timeIdx, int cell, float &out) |
One cell's depth at timeIdx. The default copies the whole frame through readDepthsAt; a source holding frames in memory overrides it in O(1) so per-cell time series (comparison plots) do not copy every frame per point. | |
| virtual int | historyGeneration () const |
| Bumps whenever frames are removed or reordered (a live source thinning its history), invalidating anything cached per frame index. Appends do not bump it. | |
| HDF5Mesh2DSource::HDF5Mesh2DSource | ( | ) |
|
overridedefault |
|
overridevirtual |
How the coordinates from readMeshGeometry relate to the model CRS — see openswmmvis::io::CoordinateReference.
Every source delivers SI metres (the 2D solver's internal unit), which for a foot-based model CRS is NOT the unit the coordinates must be reprojected from. The default returns an undeclared reference, so a source that cannot state the factor makes the layer fall back to the layer CRS's own linear unit rather than silently assuming 1.0.
Reimplemented from IMesh2DSource.
|
overridevirtual |
Whether the source carries a named per-face [nTime, nFace] field beyond depth (e.g. "Mesh2_face_rainfall", "Mesh2_face_rain_cum"). Default: none — the live in-process source streams depth/flux only.
Reimplemented from IMesh2DSource.
| bool HDF5Mesh2DSource::open | ( | const QString & | path | ) |
|
inlinenoexcept |
|
overridevirtual |
Fetch mesh geometry as CELLS: cells[i] = {v0,v1,v2,v3} with v3 == -1 for a triangle (cyclic order for a quad), one entry per face, engine order (triangles first, then quads). Resizes outputs.
Default: an all-triangle source — readMeshGeometry's triangles ARE the cells, so they are wrapped with v3 = -1. Mixed-mesh sources override.
Reimplemented from IMesh2DSource.
|
overridevirtual |
Fetch per-triangle depth at timeIdx. Resizes depths to triangleCount().
Implements IMesh2DSource.
|
overridevirtual |
Fetch per-edge signed normal flux at timeIdx.
| flux | Resized to mesh::edgeSlotCount(triangleCount()), indexed mesh::edgeSlot(cell, localEdge) (stride mesh::kEdgeStride; slot 3 of a triangle is padding). Units m² s⁻¹; positive flows outward through the edge's outward normal. |
Reimplemented from IMesh2DSource.
|
overridevirtual |
Fetch time-invariant edge geometry (length + outward unit normal).
| length | Resized to mesh::edgeSlotCount(triangleCount()) (m). |
| nx,ny | Resized likewise (dimensionless); indexed mesh::edgeSlot. |
Reimplemented from IMesh2DSource.
|
overridevirtual |
Fetch a time-INVARIANT per-face [nFace] envelope written by the engine's ENVELOPES output group ("Mesh2_face_max_depth", "Mesh2_face_max_velocity"): the whole-run maximum per cell, engine SI units, resized to triangleCount().
Reimplemented from IMesh2DSource.
|
overridevirtual |
Fetch one time slice of a named per-face field (engine SI units). Resized to triangleCount(). Default returns false.
Reimplemented from IMesh2DSource.
|
overridevirtual |
Fetch mesh geometry as a DISPLAY triangle fan. Resizes outputs.
tris carries one triangle per triangle cell and two per quad (the engine's VFR sub-triangle split, mesh::cellGeom), in cell order — so tris.size() >= triangleCount(). Consumers that need per-cell values must use readCells and map fan triangles back to their cell.
Implements IMesh2DSource.
|
overridevirtual |
Fetch per-vertex SIGNED water depth (m) at timeIdx — the engine's wet-masked, depth-weighted render reconstruction η_v − z_v (Mesh2_node_depth / swmm_2d_vertex_get_render_depths_bulk). NOT clamped: negative values over the dry side of partially wet cells carry the sub-cell shoreline intercept; exactly 0 where no incident cell is wet. Dry-cell bed elevations never contribute (unlike the legacy Mesh2_node_head solver field, which is deliberately NOT consumed here — blending dry-cell beds lifted the rendered surface up adverse slopes/steps). Resized to vertexCount().
Reimplemented from IMesh2DSource.
|
inline |
Anchor wall-clock time for the simulation start (so /time (seconds since start) maps back to a QDateTime for the global slider).
|
overridevirtual |
Wall-clock sim time at timeIdx (invalid if out of range or unknown).
Reimplemented from IMesh2DSource.
|
overridevirtual |
Latest known time-step count (grows during live mode).
Implements IMesh2DSource.
|
overridevirtual |
Implements IMesh2DSource.
|
overridevirtual |
Geometry counts. Stable for the lifetime of the source.
triangleCount() is the number of CELLS (engine faces — triangles and, on a mixed mesh, quads; workplans/TRI_QUAD_MESHING_PLAN_2026-09-06.md). Every per-face array (readDepthsAt, readFaceFieldAt) is sized to it; the historical name is kept for its callers.
Implements IMesh2DSource.