Static utility class for hot start file operations.
More...
#include <HotStartManager.hpp>
|
| static HotStartFile * | save (const SimulationContext &ctx, const std::string &path) |
| | Capture current engine state and write to a hot start file (V1 format).
|
| |
| static HotStartFile * | save (const SimulationContext &ctx, const runoff::RunoffSolver *runoff, const groundwater::GWSolver *gw, const std::string &path) |
| | Capture current engine state including infiltration and GW (V2 format).
|
| |
| static HotStartFile * | open (const std::string &path) |
| | Read and validate a hot start file.
|
| |
| static int | apply (HotStartFile &hs, SimulationContext &ctx, std::function< void(const std::string &)> warn_cb={}) |
| | Apply hot start records to a simulation context.
|
| |
| static int | apply (HotStartFile &hs, SimulationContext &ctx, runoff::RunoffSolver *runoff, groundwater::GWSolver *gw, std::function< void(const std::string &)> warn_cb={}) |
| | Apply hot start records including infiltration and GW state.
|
| |
| static bool | flush (HotStartFile &hs) |
| | If the file is dirty, rewrite it to disk.
|
| |
| static const std::string & | last_io_error () noexcept |
| | Description of the most recent I/O error (empty = none).
|
| |
Static utility class for hot start file operations.
All operations on the binary file are handled here. The HotStartFile struct is the data carrier; HotStartManager provides the I/O logic.
◆ HotStartManager()
| openswmm::HotStartManager::HotStartManager |
( |
| ) |
|
|
delete |
◆ apply() [1/2]
Apply hot start records including infiltration and GW state.
Gap #54: extended apply that also restores infiltration model state and GW zone state when the file is V2 format.
- Parameters
-
| hs | Hot start file (from save() or open()). |
| ctx | Target simulation context (must be INITIALIZED). |
| runoff | RunoffSolver to restore infiltration state into (may be nullptr). |
| gw | GWSolver to restore GW zone state into (may be nullptr). |
| warn_cb | Optional callback for per-missing-object warnings. |
- Returns
- Number of missing-object warnings generated.
◆ apply() [2/2]
Apply hot start records to a simulation context.
For each record in the hot start file, the matching object (by string ID) in ctx is updated. Objects in the hot start that are absent from ctx generate warnings — they do not fail.
- Parameters
-
| hs | Hot start file (from save() or open()). |
| ctx | Target simulation context (must be INITIALIZED). |
| warn_cb | Optional callback for per-missing-object warnings. |
- Returns
- Number of missing-object warnings generated (0 = perfect match).
◆ flush()
If the file is dirty, rewrite it to disk.
- Returns
- true on success, false on I/O error.
◆ last_io_error()
| const std::string & openswmm::HotStartManager::last_io_error |
( |
| ) |
|
|
staticnoexcept |
Description of the most recent I/O error (empty = none).
◆ open()
| HotStartFile * openswmm::HotStartManager::open |
( |
const std::string & |
path | ) |
|
|
static |
Read and validate a hot start file.
Validates magic, version, and CRC32. Loads all records into memory.
- Parameters
-
- Returns
- Heap-allocated
HotStartFile* on success, nullptr on error.
◆ save() [1/2]
Capture current engine state including infiltration and GW (V2 format).
Gap #54: extends V1 save with per-subcatchment infiltration model state (6-element flat array) and GW zone state (theta, lower_depth). Writes version=2 header.
- Parameters
-
| ctx | Simulation context (must be RUNNING or ENDED). |
| runoff | RunoffSolver providing infiltration state (may be nullptr). |
| gw | GWSolver providing GW zone state (may be nullptr). |
| path | Output file path. |
◆ save() [2/2]
Capture current engine state and write to a hot start file (V1 format).
- Parameters
-
| ctx | Simulation context (must be RUNNING or ENDED). |
| path | Output file path. |
- Returns
- Heap-allocated
HotStartFile* on success (caller owns), or nullptr on I/O error (error description in last_io_error).
The documentation for this class was generated from the following files: