23#include "../../../../include/openswmm/plugin_sdk/IOutputPlugin.hpp"
69class Default2DOutputPlugin final :
public IOutputPlugin {
75 explicit Default2DOutputPlugin(std::string h5_path);
76 ~Default2DOutputPlugin()
override;
79 Default2DOutputPlugin(
const Default2DOutputPlugin&) =
delete;
80 Default2DOutputPlugin& operator=(
const Default2DOutputPlugin&) =
delete;
86 PluginState state() const noexcept
override {
return state_; }
88 int initialize(
const std::vector<std::string>& init_args,
89 const IPluginComponentInfo* info)
override;
91 int validate(
const SimulationContext& ctx)
override;
93 int prepare(
const SimulationContext& ctx)
override;
95 int update(
const SimulationSnapshot& snapshot)
override;
97 int finalize(
const SimulationContext& ctx)
override;
99 const char* last_error_message() const noexcept
override {
100 return last_error_.c_str();
112 void prepareMeshAndDatasets(
const MeshData& mesh);
115 std::string h5_path_;
117 std::string last_error_;
119 hid_t file_id_ = H5I_INVALID_HID;
122 hid_t ds_time_ = H5I_INVALID_HID;
123 hid_t ds_face_depth_ = H5I_INVALID_HID;
124 hid_t ds_face_head_ = H5I_INVALID_HID;
125 hid_t ds_face_grad_hx_ = H5I_INVALID_HID;
126 hid_t ds_face_grad_hy_ = H5I_INVALID_HID;
127 hid_t ds_face_grad_hx_lim_ = H5I_INVALID_HID;
128 hid_t ds_face_grad_hy_lim_ = H5I_INVALID_HID;
129 hid_t ds_face_rainfall_ = H5I_INVALID_HID;
130 hid_t ds_face_coupling_flux_ = H5I_INVALID_HID;
131 hid_t ds_face_net_source_ = H5I_INVALID_HID;
132 hid_t ds_edge_flux_ = H5I_INVALID_HID;
133 hid_t ds_node_head_ = H5I_INVALID_HID;
135 hsize_t n_faces_ = 0;
136 hsize_t n_nodes_ = 0;
137 hsize_t n_steps_ = 0;
140 void writeMeshTopology(
const SimulationContext& ctx);
141 hid_t createUnlimitedDataset(
const char* name,
int rank,
143 const hsize_t* chunk_dims);
144 void writeStringAttr(hid_t loc,
const char* name,
const char* value);
145 void extendAndWrite2D(hid_t ds,
const double*
data, hsize_t n_cols);
146 void extendAndWrite3D(hid_t ds,
const double*
data, hsize_t dim1, hsize_t dim2);
const double * data
Definition XSectBatch.cpp:567
PluginState
Plugin lifecycle states.
Definition PluginState.hpp:67
StmtPtr prepare(sqlite3 *db, const std::string &sql)
Definition GpkgUtils.hpp:66
Definition NodeCoupling.cpp:15