|
| static HotStartFile * | save (const SimulationContext &ctx, const std::string &path) |
| | Capture current engine state and write a feature-dependent native hot start.
|
| |
| static HotStartFile * | save (const SimulationContext &ctx, const runoff::RunoffSolver *runoff, const groundwater::GWSolver *gw, const std::string &path) |
| | Capture native engine state including optional infiltration and groundwater solvers.
|
| |
| static HotStartFile * | save_with_engine_checkpoint (const SimulationContext &ctx, const runoff::RunoffSolver *runoff, const groundwater::GWSolver *gw, const std::string &path, const std::string &engine_checkpoint) |
| | Capture a native hot start with an optional complete engine-session checkpoint.
|
| |
| static HotStartFile * | open (const std::string &path) |
| | Read and validate a hot start file.
|
| |
| static bool | is_native_file (const std::string &path) noexcept |
| | Probe the native hot-start magic without parsing records.
|
| |
| 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 int | apply_legacy_routing (const std::string &path, SimulationContext &ctx, std::function< void(const std::string &)> warn_cb={}, std::vector< double > *runoff=nullptr, LegacySpeciesTrailer *species=nullptr) |
| | Read a legacy EPA SWMM5 .hsf (USE HOTSTART) file and apply its routing state to the context, BY OBJECT INDEX (the legacy format stores node/link state in object order, no IDs).
|
| |
| static bool | apply_species_surface (const LegacySpeciesTrailer &tr, SimulationContext &ctx, const std::function< void(const std::string &)> &warn) |
| | Apply a legacy trailer surface block by reaction-species name.
|
| |
| static std::size_t | legacy_runoff_size (const SimulationContext &ctx, int n_land) |
| | Number of doubles in legacy's runoff section (hotstart.c saveRunoff) for the current model with n_land land uses.
|
| |
| static int | save_legacy_routing (const std::string &path, const SimulationContext &ctx, const std::vector< double > *runoff=nullptr) |
| | Write the current routing state as a legacy EPA SWMM5 .hsf (SAVE HOTSTART), byte-format-compatible with legacy readRouting() and apply_legacy_routing() above.
|
| |
| static bool | flush (HotStartFile &hs) |
| | Rewrite a dirty native hot-start object to its stored path.
|
| |
| static const std::string & | last_io_error () noexcept |
| | Description of the most recent I/O error (empty = none).
|
| |
| int openswmm::HotStartManager::apply_legacy_routing |
( |
const std::string & | path, |
|
|
SimulationContext & | ctx, |
|
|
std::function< void(const std::string &)> | warn_cb = {}, |
|
|
std::vector< double > * | runoff = nullptr, |
|
|
LegacySpeciesTrailer * | species = nullptr ) |
|
static |
Read a legacy EPA SWMM5 .hsf (USE HOTSTART) file and apply its routing state to the context, BY OBJECT INDEX (the legacy format stores node/link state in object order, no IDs).
Mirrors legacy hotstart.c readRouting(): sets each node's depth + lateral inflow and each link's flow + depth + setting, all stored as float in internal units (ft, cfs). Also restores node/link pollutant concentrations (current and old) and v4 storage HRT. Supports legacy versions 1–4. Subcatchment state is skipped with a warning; this is a routing-only restore. Derived hydraulic state (head, volumes, old-step values) is recomputed by the caller. Cold quality seeds must not overwrite the restored concentrations.
- Parameters
-
| path | Absolute path to the legacy .hsf file. |
| ctx | Allocated target context; node/link/pollutant counts must match the file. |
| warn_cb | Optional warning callback. |
| runoff | When given, receives the file's runoff section (legacy_runoff_size() doubles) for the caller to apply once the hydrology and quality state exist; when null the section is skipped with a warning. |
- Returns
- 0 on success; non-zero error code otherwise (description in last_io_error()).
- Parameters
-
| [out] | species | Optional trailer destination for deferred surface-species application; NULL discards it. |
- Note
- Parsing applies records incrementally; later failure does not roll back earlier context mutations.
| std::size_t openswmm::HotStartManager::legacy_runoff_size |
( |
const SimulationContext & | ctx, |
|
|
int | n_land ) |
|
static |
Number of doubles in legacy's runoff section (hotstart.c saveRunoff) for the current model with n_land land uses.
Per subcatchment: 3 sub-area ponded depths + runoff (4), infiltration state (6), +4 with groundwater, +15 with a snowpack, and when pollutants exist runoff and ponded quality (2 per pollutant) plus per land use the buildup of each pollutant and the date it was last swept.
- Parameters
-
| [in] | ctx | Borrowed model counts and subcatchment aquifer/snowpack references. |
| [in] | n_land | Land-use count; negative treated as zero. |
- Returns
- Number of native double slots, not bytes; caller ensures size_t arithmetic does not overflow.
| int openswmm::HotStartManager::save_legacy_routing |
( |
const std::string & | path, |
|
|
const SimulationContext & | ctx, |
|
|
const std::vector< double > * | runoff = nullptr ) |
|
static |
Write the current routing state as a legacy EPA SWMM5 .hsf (SAVE HOTSTART), byte-format-compatible with legacy readRouting() and apply_legacy_routing() above.
Mirrors legacy hotstart.c saveHotstart()+saveRunoff()+ saveRouting() for the "SWMM5-HOTSTART4" version: 15-char stamp + object counts (nSub, nLand, nNodes, nLinks, nPollut, flowUnits as int32), then one double record per subcatchment (ponded depths, runoff, infiltration, groundwater, snowpack, quality, buildup — the runoff argument), then per node depth, latFlow[, storage hrt], qual[] and per link flow, depth, setting, qual[] — all float, internal units (ft, cfs). Storage residence time is preserved when quality state is allocated, and otherwise written as zero.
- Parameters
-
| path | Absolute path for the .hsf file. |
| ctx | Source context (final routing state). |
| runoff | Legacy runoff section (legacy_runoff_size() doubles for the model's land uses), written between the header and the routing records. Null writes no runoff section and zero land uses, which only a model without subcatchments can read back. |
- Returns
- 0 on success; non-zero on file-open/write error (description in last_io_error()).