64#ifndef OPENSWMMVIS_IO_MESH2DH5READER_H
65#define OPENSWMMVIS_IO_MESH2DH5READER_H
121 bool isOpen() const noexcept {
return file_id_ >= 0; }
124 const QString&
path() const noexcept {
return path_; }
127 const QString&
lastError() const noexcept {
return last_error_; }
153 std::vector<double>& vy,
154 std::vector<double>& vz)
const;
167 bool readTriangles(std::vector<std::array<int, 3>>& tris)
const;
197 bool readTimes(std::vector<double>& times)
const;
205 bool readDepthsAt(
int timeIdx, std::vector<float>& depths)
const;
217 std::vector<float>& values)
const;
235 bool readFaceEnvelope(
const char* dataset, std::vector<float>& values)
const;
294 std::vector<float>&
nx,
295 std::vector<float>&
ny)
const;
299 int64_t file_id_ = -1;
301 mutable int cached_n_vert_ = -1;
302 mutable int cached_n_face_ = -1;
303 mutable int cached_face_width_ = -1;
304 mutable int cached_has_node_head_ = -1;
305 mutable int cached_has_node_depth_ = -1;
306 mutable int cached_has_edge_flux_ = -1;
307 mutable std::map<std::string, bool> cached_has_face_field_;
308 mutable QString last_error_;
311 mutable bool cached_cells_loaded_ =
false;
312 mutable std::vector<std::array<int, 4>> cached_cells_;
313 mutable std::vector<std::array<int, 3>> cached_display_tris_;
314 mutable std::vector<int> cached_face_map_;
316 bool readDim_(
const char* dataset,
int axis,
int& out)
const;
317 bool setError_(
const QString& msg)
const;
318 bool loadCells_()
const;
Definition mesh2dh5reader.h:99
bool readFaceFieldAt(const char *dataset, int timeIdx, std::vector< float > &values) const
Read one time slice of any per-face [nTime, nFace] dataset (e.g. Mesh2_face_rainfall,...
Definition mesh2dh5reader.cpp:541
void close()
Close the file (idempotent; called automatically on destruction).
Definition mesh2dh5reader.cpp:175
int timeCount() const
Current number of time steps written to /time.
Definition mesh2dh5reader.cpp:498
bool readDepthsAt(int timeIdx, std::vector< float > &depths) const
Read one time slice of /Mesh2_face_depth.
Definition mesh2dh5reader.cpp:525
bool readFaceEnvelope(const char *dataset, std::vector< float > &values) const
Read a time-INVARIANT per-face [nFace] dataset — the engine's run envelopes (Mesh2_face_max_depth,...
Definition mesh2dh5reader.cpp:591
bool isOpen() const noexcept
Definition mesh2dh5reader.h:121
bool open(const QString &path)
Open the HDF5 file read-only.
Definition mesh2dh5reader.cpp:150
bool hasFaceField(const char *dataset) const
True iff dataset exists at the file root (probe cached).
Definition mesh2dh5reader.cpp:530
int edgeStride() const
Width of the file's per-edge datasets (/Mesh2_face_nodes dim 1): 3 for an all-triangle file,...
Definition mesh2dh5reader.cpp:307
bool readEdgeGeometry(std::vector< float > &length, std::vector< float > &nx, std::vector< float > &ny) const
Read time-invariant edge length + outward unit normal.
Definition mesh2dh5reader.cpp:837
static constexpr int kEdgeStride
Edge slots per cell in every per-edge array this reader returns (== mesh::kEdgeStride; asserted in th...
Definition mesh2dh5reader.h:133
bool readEdgeFluxAt(int timeIdx, std::vector< float > &flux) const
Read one time slice of /Mesh2_edge_flux.
Definition mesh2dh5reader.cpp:753
int displayTriangleCount() const
Number of DISPLAY triangles returned by readTriangles (cells + quads; == cellCount() for an all-trian...
Definition mesh2dh5reader.cpp:317
int triangleCount() const
Number of mesh CELLS (/Mesh2_face_nodes row count — the file's face count, triangles and quads alike)...
Definition mesh2dh5reader.cpp:227
int cellCount() const
Number of mesh cells (== triangleCount).
Definition mesh2dh5reader.h:142
int vertexCount() const
Number of mesh vertices (/Mesh2_node_x length).
Definition mesh2dh5reader.cpp:220
Mesh2DH5Reader & operator=(const Mesh2DH5Reader &)=delete
bool readTimes(std::vector< double > ×) const
Read all time values. Resizes output.
Definition mesh2dh5reader.cpp:506
bool readVertexSignedDepthsAt(int timeIdx, std::vector< float > &depths) const
Read one time slice of /Mesh2_node_depth — the engine's wet-masked, depth-weighted SIGNED vertex dept...
Definition mesh2dh5reader.cpp:694
Mesh2DH5Reader(const Mesh2DH5Reader &)=delete
bool readMeshGeometry(std::vector< double > &vx, std::vector< double > &vy, std::vector< double > &vz) const
Read vertex coordinates into vx,vy,vz. Resizes output.
Definition mesh2dh5reader.cpp:234
bool readCoordinateReference(CoordinateReference &out) const
Read the /crs georeferencing variable (engine 6.0+).
Definition mesh2dh5reader.cpp:265
bool readTriangles(std::vector< std::array< int, 3 > > &tris) const
Read the DISPLAY sub-triangle fan. tris[i] = {v0,v1,v2}; one entry per triangle cell,...
Definition mesh2dh5reader.cpp:487
const QString & lastError() const noexcept
Last error message from a failing open/read call.
Definition mesh2dh5reader.h:127
bool readCells(std::vector< std::array< int, 4 > > &cells) const
Read the cells verbatim. cells[c] = {v0,v1,v2,v3}, with v3 = −1 for a triangle (cyclic order for a qu...
Definition mesh2dh5reader.cpp:480
const std::vector< int > & triangleFaceMap() const
Display triangle → cell index (parallel to readTriangles; the identity for an all-triangle file)....
Definition mesh2dh5reader.h:172
~Mesh2DH5Reader()
Definition mesh2dh5reader.cpp:148
bool readVertexHeadsAt(int timeIdx, std::vector< double > &heads) const
Read one time slice of /Mesh2_node_head — the engine's pseudo-Laplacian vertex-head reconstruction.
Definition mesh2dh5reader.cpp:635
const QString & path() const noexcept
Current path (empty if not open).
Definition mesh2dh5reader.h:124
std::vector< double > nx
Definition mesh2dresultsexport.cpp:448
std::vector< mesh::MeshTriangle > cells
Definition mesh2dresultsexport.cpp:102
std::vector< double > ny
Definition mesh2dresultsexport.cpp:448
double length
Definition meshpatch.cpp:64
Definition gdaldrivers.h:22
How a 2D result source's XY coordinates relate to the model's CRS.
Definition mesh2dh5reader.h:91
double metresPerModelUnit
stored = model x this
Definition mesh2dh5reader.h:93
bool declared
true when read from a /crs variable
Definition mesh2dh5reader.h:95
QString storedUnits
unit of the stored coords, e.g. "m"
Definition mesh2dh5reader.h:94
QString crs
model CRS, verbatim; empty if undeclared
Definition mesh2dh5reader.h:92