![]() |
SWMMVis
6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
|
Two-level QAbstractItemModel for the Simulation Status dock. More...
#include <simulationstatusmodel.h>
Public Member Functions | |
| SimulationStatusModel (QObject *parent=nullptr) | |
| int | addJob (const QString &instanceName, const QString &inpPath, const QString &engineVersion=QString()) |
| int | addOrReuseJobForModel (SWMMVisProjectWindow *model, const QString &instanceName, const QString &inpPath, const QString &engineVersion=QString()) |
| Add or reuse a job row bound to a model instance. | |
| int | ensureJobForModel (SWMMVisProjectWindow *model, const QString &instanceName, const QString &inpPath, const QString &engineVersion) |
| Return the job row bound to (model, engine version), creating an Idle row if none exists yet. Used so an opened model shows its simulation start / end dates before any run. | |
| void | updateProgress (int jobId, double fraction, const QDateTime ¤tSimDate, double runoffErrFrac=0.0, double routingErrFrac=0.0, double avgTimestepSec=0.0, double twoDErrFrac=qQNaN()) |
| Update progress for a running job. | |
| void | updateTwoDSolverStats (int jobId, const QString &backend, int momentum, int ltsTiers, qint64 steps, const QVector< qint64 > &tierCells) |
| void | setSimulationDates (int jobId, const QDateTime &startSimDate, const QDateTime &endSimDate) |
| void | addWarning (int jobId, int code, const QString &message) |
| void | finishJob (int jobId, bool success, int errCode, const QString &errMsg, double runoffErrFrac, double routingErrFrac, double twoDErrFrac=qQNaN()) |
| const SimulationJobRecord * | jobRecord (int jobId) const |
| int | jobIdForRow (int row) const |
| QList< int > | clearJobsForModel (SWMMVisProjectWindow *model) |
| Remove every row bound to the given model. | |
| QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const override |
| QModelIndex | parent (const QModelIndex &child) const override |
| int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
| int | columnCount (const QModelIndex &parent=QModelIndex()) const override |
| QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override |
| QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override |
Static Public Attributes | |
| static constexpr int | ColName = 0 |
| static constexpr int | ColStatus = 1 |
| static constexpr int | ColProgress = 2 |
| static constexpr int | ColStartDate = 3 |
| static constexpr int | ColCurrentDate = 4 |
| static constexpr int | ColEndDate = 5 |
| static constexpr int | ColRunoffErr = 6 |
| static constexpr int | ColRoutingErr = 7 |
| static constexpr int | ColTwoDErr = 8 |
| static constexpr int | ColDuration = 9 |
| static constexpr int | ColAvgTimestep = 10 |
| static constexpr int | ColVersion = 11 |
| static constexpr int | Col2DBackend = 12 |
| "cpu · LOCAL_INERTIAL", "—" for 1D runs | |
| static constexpr int | ColLtsTiers = 13 |
| "4 tiers · t3 84 %" | |
| static constexpr int | NumColumns = 14 |
Two-level QAbstractItemModel for the Simulation Status dock.
Level-0 rows: one per simulation job. Level-1 rows: individual warning messages under each job.
Columns (level-0): 0 Name project file name 1 Status Running / Success / Failed / Cancelled 2 Progress "45.2 %" while running 3 Sim Time decimal days (updated each step) 4 Runoff Err % (populated after finish) 5 Routing Err % (populated after finish) 6 2D Err % ("—" when the run has no 2D model) 7 Duration wall-clock seconds once finished 8 Avg Timestep running average engine step size (seconds)
Level-1 columns: Col 0 carries the warning text; others are empty.
|
explicit |
| int SimulationStatusModel::addJob | ( | const QString & | instanceName, |
| const QString & | inpPath, | ||
| const QString & | engineVersion = QString() |
||
| ) |
Add a new job row; returns the job id.
| int SimulationStatusModel::addOrReuseJobForModel | ( | SWMMVisProjectWindow * | model, |
| const QString & | instanceName, | ||
| const QString & | inpPath, | ||
| const QString & | engineVersion = QString() |
||
| ) |
Add or reuse a job row bound to a model instance.
If the model already has a row (was run before), reuse and reset it. Otherwise, create a new row. Returns the job id (reused or new).
| void SimulationStatusModel::addWarning | ( | int | jobId, |
| int | code, | ||
| const QString & | message | ||
| ) |
Append a warning child under the given job.
| QList< int > SimulationStatusModel::clearJobsForModel | ( | SWMMVisProjectWindow * | model | ) |
Remove every row bound to the given model.
Used when the project's output is removed or the project window is closed — the rows describe runs against that model and become meaningless once it goes away. Returns the job IDs that were removed so the caller can drop the matching per-job state it owns (runner handles, running-progress map, etc.).
|
override |
|
override |
| int SimulationStatusModel::ensureJobForModel | ( | SWMMVisProjectWindow * | model, |
| const QString & | instanceName, | ||
| const QString & | inpPath, | ||
| const QString & | engineVersion | ||
| ) |
Return the job row bound to (model, engine version), creating an Idle row if none exists yet. Used so an opened model shows its simulation start / end dates before any run.
| void SimulationStatusModel::finishJob | ( | int | jobId, |
| bool | success, | ||
| int | errCode, | ||
| const QString & | errMsg, | ||
| double | runoffErrFrac, | ||
| double | routingErrFrac, | ||
| double | twoDErrFrac = qQNaN() |
||
| ) |
Mark a job finished.
| runoffErrFrac | runoff continuity error fraction (e.g. 0.001 = 0.1 %) |
| routingErrFrac | routing continuity error fraction |
| twoDErrFrac | 2D surface continuity error fraction; NaN = no 2D model |
|
override |
|
override |
| int SimulationStatusModel::jobIdForRow | ( | int | row | ) | const |
Return the job id at the given top-level row, or -1 if out of range.
| const SimulationJobRecord * SimulationStatusModel::jobRecord | ( | int | jobId | ) | const |
Return a copy of the record for the given job id, or nullptr if not found.
|
override |
|
override |
| void SimulationStatusModel::setSimulationDates | ( | int | jobId, |
| const QDateTime & | startSimDate, | ||
| const QDateTime & | endSimDate | ||
| ) |
Set the engine-side simulation start / end dates for a job.
| void SimulationStatusModel::updateProgress | ( | int | jobId, |
| double | fraction, | ||
| const QDateTime & | currentSimDate, | ||
| double | runoffErrFrac = 0.0, |
||
| double | routingErrFrac = 0.0, |
||
| double | avgTimestepSec = 0.0, |
||
| double | twoDErrFrac = qQNaN() |
||
| ) |
Update progress for a running job.
| runoffErrFrac | Live continuity error fraction (0.001 = 0.1 %). |
| routingErrFrac | Ditto for routing. |
| twoDErrFrac | Ditto for the 2D surface; NaN = no 2D model. |
| void SimulationStatusModel::updateTwoDSolverStats | ( | int | jobId, |
| const QString & | backend, | ||
| int | momentum, | ||
| int | ltsTiers, | ||
| qint64 | steps, | ||
| const QVector< qint64 > & | tierCells | ||
| ) |
2D solver telemetry from SimulationRunner::twoDSolverStats: the backend label, momentum closure (0 LOCAL_INERTIAL, 1 FULL_SWE, 2 DIFFUSIVE_WAVE), configured LTS_TIERS, cumulative marcher substeps and the rebuild-sampled cells per LTS tier. Drives the "2D Solver" and "LTS Tiers" columns.
|
staticconstexpr |
"cpu · LOCAL_INERTIAL", "—" for 1D runs
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
"4 tiers · t3 84 %"
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |