80class Default2DOutputPlugin final :
public IOutputPlugin {
86 explicit Default2DOutputPlugin(std::string h5_path);
87 ~Default2DOutputPlugin()
override;
90 Default2DOutputPlugin(
const Default2DOutputPlugin&) =
delete;
91 Default2DOutputPlugin& operator=(
const Default2DOutputPlugin&) =
delete;
97 PluginState state() const noexcept
override {
return state_; }
99 int initialize(
const std::vector<std::string>& init_args,
100 const IPluginComponentInfo* info)
override;
102 int validate(
const SimulationContext& ctx)
override;
104 int prepare(
const SimulationContext& ctx)
override;
106 int update(
const SimulationSnapshot& snapshot)
override;
108 int finalize(
const SimulationContext& ctx)
override;
110 const char* last_error_message() const noexcept
override {
111 return last_error_.c_str();
123 void prepareMeshAndDatasets(
const MeshData& mesh);
126 std::string h5_path_;
128 std::string last_error_;
130 hid_t file_id_ = H5I_INVALID_HID;
133 hid_t ds_time_ = H5I_INVALID_HID;
134 hid_t ds_face_depth_ = H5I_INVALID_HID;
135 hid_t ds_face_head_ = H5I_INVALID_HID;
136 hid_t ds_face_grad_hx_ = H5I_INVALID_HID;
137 hid_t ds_face_grad_hy_ = H5I_INVALID_HID;
138 hid_t ds_face_grad_hx_lim_ = H5I_INVALID_HID;
139 hid_t ds_face_grad_hy_lim_ = H5I_INVALID_HID;
140 hid_t ds_face_rainfall_ = H5I_INVALID_HID;
141 hid_t ds_face_coupling_flux_ = H5I_INVALID_HID;
142 hid_t ds_face_net_source_ = H5I_INVALID_HID;
143 hid_t ds_face_vx_ = H5I_INVALID_HID;
144 hid_t ds_face_vy_ = H5I_INVALID_HID;
145 hid_t ds_face_continuity_err_ = H5I_INVALID_HID;
146 hid_t ds_edge_flux_ = H5I_INVALID_HID;
147 hid_t ds_node_head_ = H5I_INVALID_HID;
150 hid_t ds_face_max_depth_ = H5I_INVALID_HID;
151 hid_t ds_face_max_velocity_ = H5I_INVALID_HID;
152 hid_t ds_face_max_continuity_err_ = H5I_INVALID_HID;
154 hsize_t n_faces_ = 0;
155 hsize_t n_nodes_ = 0;
156 hsize_t n_steps_ = 0;
159 void writeMeshTopology(
const SimulationContext& ctx);
160 hid_t createUnlimitedDataset(
const char* name,
int rank,
162 const hsize_t* chunk_dims);
163 void writeStringAttr(hid_t loc,
const char* name,
const char* value);
164 void writeDoubleAttr(hid_t loc,
const char* name,
double value);
165 void extendAndWrite2D(hid_t ds,
const double* data, hsize_t n_cols);
166 void extendAndWrite3D(hid_t ds,
const double* data, hsize_t dim1, hsize_t dim2);
168 hid_t createFaceEnvelopeDataset(
const char* name,
const char* long_name,
171 void writeFaceEnvelope(hid_t ds,
const double* data);
Interface for output-writing plugins.
PluginState
Plugin lifecycle states.
Definition PluginState.hpp:67
StmtPtr prepare(sqlite3 *db, const std::string &sql)
Definition GpkgUtils.hpp:89
Definition NodeCoupling.cpp:15
SoA storage for 2D triangular mesh geometry and topology.
Definition MeshData.hpp:34