63#ifndef OPENSWMM_ENGINE_HOT_START_MANAGER_HPP
64#define OPENSWMM_ENGINE_HOT_START_MANAGER_HPP
73struct SimulationContext;
105 double infil[6] = {0, 0, 0, 0, 0, 0};
140 std::vector<HotStartNodeRecord>
nodes;
141 std::vector<HotStartLinkRecord>
links;
195 const std::string& path);
212 const std::string& path);
247 std::function<
void(
const std::string&)> warn_cb = {});
266 std::function<
void(
const std::string&)> warn_cb = {});
277 static bool flush(HotStartFile& hs);
291 static
bool write_file(const HotStartFile& hs, const std::
string& path);
292 static
bool read_file (HotStartFile& hs, const std::
string& path);
298 static uint32_t crc32(const uint8_t*
data, std::
size_t len) noexcept;
const double * data
Definition XSectBatch.cpp:567
Static utility class for hot start file operations.
Definition HotStartManager.hpp:178
static const std::string & last_io_error() noexcept
Description of the most recent I/O error (empty = none).
Definition HotStartManager.cpp:46
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:513
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:345
static HotStartFile * open(const std::string &path)
Read and validate a hot start file.
Definition HotStartManager.cpp:498
static bool flush(HotStartFile &hs)
If the file is dirty, rewrite it to disk.
Definition HotStartManager.cpp:619
Definition Groundwater.hpp:124
Definition NodeCoupling.cpp:15
In-memory hot start file data.
Definition HotStartManager.hpp:138
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:327
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:306
HotStartHeader header
Definition HotStartManager.hpp:139
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:334
bool dirty
True if set_*() was called.
Definition HotStartManager.hpp:145
std::vector< std::string > warnings
Populated by HotStartManager::apply()
Definition HotStartManager.hpp:147
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:313
std::vector< HotStartNodeRecord > nodes
Definition HotStartManager.hpp:140
std::string path
File path (for flush-on-close)
Definition HotStartManager.hpp:144
std::vector< HotStartLinkRecord > links
Definition HotStartManager.hpp:141
std::vector< HotStartSubcatchRecord > subcatches
Definition HotStartManager.hpp:142
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:320
Link hydraulic state at hot-start save time.
Definition HotStartManager.hpp:90
double depth
Definition HotStartManager.hpp:93
double volume
Definition HotStartManager.hpp:94
std::string id
Definition HotStartManager.hpp:91
double flow
Definition HotStartManager.hpp:92
Node hydraulic state at hot-start save time.
Definition HotStartManager.hpp:82
double volume
Definition HotStartManager.hpp:86
std::string id
Definition HotStartManager.hpp:83
double depth
Definition HotStartManager.hpp:84
double head
Definition HotStartManager.hpp:85
Subcatchment state at hot-start save time.
Definition HotStartManager.hpp:98
double gw_lower_depth
lower zone depth (ft)
Definition HotStartManager.hpp:109
double infil[6]
flat 6-elem state (model-dependent)
Definition HotStartManager.hpp:105
double runoff
Definition HotStartManager.hpp:100
int infil_model
Definition HotStartManager.hpp:104
double gw_theta
upper zone moisture content
Definition HotStartManager.hpp:108
double gwater
Definition HotStartManager.hpp:101
std::string id
Definition HotStartManager.hpp:99
Central, reentrant simulation context.
Definition SimulationContext.hpp:274