48#ifndef OPENSWMM_ENGINE_HOT_START_MANAGER_HPP
49#define OPENSWMM_ENGINE_HOT_START_MANAGER_HPP
58struct SimulationContext;
115 std::vector<HotStartNodeRecord>
nodes;
116 std::vector<HotStartLinkRecord>
links;
170 const std::string& path);
205 std::function<
void(
const std::string&)> warn_cb = {});
230 static
bool write_file(const
HotStartFile& hs, const std::
string& path);
231 static
bool read_file (
HotStartFile& hs, const std::
string& path);
237 static uint32_t crc32(const uint8_t*
data, std::
size_t len) noexcept;
const double * data
Definition XSectBatch.cpp:550
Static utility class for hot start file operations.
Definition HotStartManager.hpp:153
static const std::string & last_io_error() noexcept
Description of the most recent I/O error (empty = none).
Definition HotStartManager.cpp:44
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:396
static HotStartFile * save(const SimulationContext &ctx, const std::string &path)
Capture current engine state and write to a hot start file.
Definition HotStartManager.cpp:322
static HotStartFile * open(const std::string &path)
Read and validate a hot start file.
Definition HotStartManager.cpp:381
static bool flush(HotStartFile &hs)
If the file is dirty, rewrite it to disk.
Definition HotStartManager.cpp:454
Definition Controls.cpp:24
In-memory hot start file data.
Definition HotStartManager.hpp:113
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:304
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:283
HotStartHeader header
Definition HotStartManager.hpp:114
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:311
bool dirty
True if set_*() was called.
Definition HotStartManager.hpp:120
std::vector< std::string > warnings
Populated by HotStartManager::apply()
Definition HotStartManager.hpp:122
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:290
std::vector< HotStartNodeRecord > nodes
Definition HotStartManager.hpp:115
std::string path
File path (for flush-on-close)
Definition HotStartManager.hpp:119
std::vector< HotStartLinkRecord > links
Definition HotStartManager.hpp:116
std::vector< HotStartSubcatchRecord > subcatches
Definition HotStartManager.hpp:117
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:297
Link hydraulic state at hot-start save time.
Definition HotStartManager.hpp:73
double depth
Definition HotStartManager.hpp:76
double volume
Definition HotStartManager.hpp:77
std::string id
Definition HotStartManager.hpp:74
double flow
Definition HotStartManager.hpp:75
Node hydraulic state at hot-start save time.
Definition HotStartManager.hpp:65
double volume
Definition HotStartManager.hpp:69
std::string id
Definition HotStartManager.hpp:66
double depth
Definition HotStartManager.hpp:67
double head
Definition HotStartManager.hpp:68
Subcatchment state at hot-start save time.
Definition HotStartManager.hpp:81
double runoff
Definition HotStartManager.hpp:83
double gwater
Definition HotStartManager.hpp:84
std::string id
Definition HotStartManager.hpp:82
Central, reentrant simulation context.
Definition SimulationContext.hpp:141