79#ifndef OPENSWMM_ENGINE_HOT_START_MANAGER_HPP
80#define OPENSWMM_ENGINE_HOT_START_MANAGER_HPP
125 double infil[6] = {0, 0, 0, 0, 0, 0};
160 std::vector<HotStartNodeRecord>
nodes;
161 std::vector<HotStartLinkRecord>
links;
246 const std::string& path);
263 const std::string& path);
298 std::function<
void(
const std::string&)> warn_cb = {});
317 std::function<
void(
const std::string&)> warn_cb = {});
343 SimulationContext& ctx,
344 std::function<
void(
const std::string&)> warn_cb = {});
365 const SimulationContext& ctx);
376 static bool flush(HotStartFile& hs);
390 static
bool write_file(const HotStartFile& hs, const std::
string& path);
391 static
bool read_file (HotStartFile& hs, const std::
string& path);
397 static uint32_t crc32(const uint8_t* data, std::
size_t len) noexcept;
static int save_legacy_routing(const std::string &path, const SimulationContext &ctx)
Write the current routing state as a legacy EPA SWMM5 .hsf (SAVE HOTSTART), byte-format-compatible wi...
Definition HotStartManager.cpp:1209
static int apply_legacy_routing(const std::string &path, SimulationContext &ctx, std::function< void(const std::string &)> warn_cb={})
Read a legacy EPA SWMM5 .hsf (USE HOTSTART) file and apply its routing state to the context,...
Definition HotStartManager.cpp:1029
static const std::string & last_io_error() noexcept
Description of the most recent I/O error (empty = none).
Definition HotStartManager.cpp:67
static int apply(HotStartFile &hs, SimulationContext &ctx, std::function< void(const std::string &)> warn_cb={})
Apply hot start records to a simulation context.
Definition HotStartManager.cpp:882
static HotStartFile * save(const SimulationContext &ctx, const std::string &path)
Capture current engine state and write to a hot start file (V1 format).
Definition HotStartManager.cpp:690
static HotStartFile * open(const std::string &path)
Read and validate a hot start file.
Definition HotStartManager.cpp:867
static bool flush(HotStartFile &hs)
If the file is dirty, rewrite it to disk.
Definition HotStartManager.cpp:1285
Definition Groundwater.hpp:173
Definition Runoff.hpp:114
Definition HotStartManager.hpp:91
Definition HotStartManager.hpp:90
Definition NodeCoupling.cpp:16
In-memory hot start file data.
Definition HotStartManager.hpp:158
bool set_link_depth(const std::string &id, double v)
Set depth for a stored link. Returns false if id not found.
Definition HotStartManager.cpp:447
std::vector< double > gw_ledger
the 9 cumulative terms (m3)
Definition HotStartManager.hpp:193
bool set_node_depth(const std::string &id, double v)
Set depth for a stored node. Returns false if id not found.
Definition HotStartManager.cpp:426
HotStartHeader header
Definition HotStartManager.hpp:159
std::vector< double > link_species
Definition HotStartManager.hpp:173
bool set_subcatch_runoff(const std::string &id, double v)
Set runoff for a stored subcatchment. Returns false if id not found.
Definition HotStartManager.cpp:454
bool dirty
True if set_*() was called.
Definition HotStartManager.hpp:196
std::vector< std::string > warnings
Populated by HotStartManager::apply()
Definition HotStartManager.hpp:198
std::vector< double > node_species
Definition HotStartManager.hpp:172
bool set_node_head(const std::string &id, double v)
Set head for a stored node. Returns false if id not found.
Definition HotStartManager.cpp:433
std::vector< HotStartNodeRecord > nodes
Definition HotStartManager.hpp:160
std::vector< double > gw_theta_sigma
closure-B layers, layer-major
Definition HotStartManager.hpp:192
std::vector< std::string > species
Definition HotStartManager.hpp:171
std::string path
File path (for flush-on-close)
Definition HotStartManager.hpp:195
uint32_t gw_n_cells
Definition HotStartManager.hpp:188
std::vector< HotStartLinkRecord > links
Definition HotStartManager.hpp:161
std::vector< double > gw_hu
unsaturated storage (m of water)
Definition HotStartManager.hpp:191
std::vector< HotStartSubcatchRecord > subcatches
Definition HotStartManager.hpp:162
std::vector< double > gw_hg
saturated thickness (m)
Definition HotStartManager.hpp:190
uint32_t gw_m_layers
Definition HotStartManager.hpp:189
bool set_link_flow(const std::string &id, double v)
Set flow for a stored link. Returns false if id not found.
Definition HotStartManager.cpp:440
Link hydraulic state at hot-start save time.
Definition HotStartManager.hpp:108
double depth
Definition HotStartManager.hpp:111
double age
A2a (V3): water age (seconds); -1 = not tracked / pre-V3 file.
Definition HotStartManager.hpp:114
double volume
Definition HotStartManager.hpp:112
std::string id
Definition HotStartManager.hpp:109
double flow
Definition HotStartManager.hpp:110
Node hydraulic state at hot-start save time.
Definition HotStartManager.hpp:98
double age
A2a (V3): water age (seconds); -1 = not tracked / pre-V3 file.
Definition HotStartManager.hpp:104
double volume
Definition HotStartManager.hpp:102
std::string id
Definition HotStartManager.hpp:99
double depth
Definition HotStartManager.hpp:100
double head
Definition HotStartManager.hpp:101
Subcatchment state at hot-start save time.
Definition HotStartManager.hpp:118
double gw_lower_depth
lower zone depth (ft)
Definition HotStartManager.hpp:129
double infil[6]
flat 6-elem state (model-dependent)
Definition HotStartManager.hpp:125
double runoff
Definition HotStartManager.hpp:120
int infil_model
Definition HotStartManager.hpp:124
double gw_theta
upper zone moisture content
Definition HotStartManager.hpp:128
double gwater
Definition HotStartManager.hpp:121
std::string id
Definition HotStartManager.hpp:119
Central, reentrant simulation context.
Definition SimulationContext.hpp:353