136class Default2DOutputPlugin final :
public IOutputPlugin {
142 explicit Default2DOutputPlugin(std::string h5_path);
143 ~Default2DOutputPlugin()
override;
146 Default2DOutputPlugin(
const Default2DOutputPlugin&) =
delete;
147 Default2DOutputPlugin& operator=(
const Default2DOutputPlugin&) =
delete;
153 PluginState state() const noexcept
override {
return state_; }
155 int initialize(
const std::vector<std::string>& init_args,
156 const IPluginComponentInfo* info)
override;
158 int validate(
const SimulationContext& ctx)
override;
160 int prepare(
const SimulationContext& ctx)
override;
162 int update(
const SimulationSnapshot& snapshot)
override;
164 int finalize(
const SimulationContext& ctx)
override;
166 const char* last_error_message() const noexcept
override {
167 return last_error_.c_str();
179 void prepareMeshAndDatasets(
const MeshData& mesh);
194 void setMeshCoordinateScale(
double metres_per_model_unit);
208 std::string configureOutput(
const SolverOptions2D& opts,
double report_step_sec);
211 unsigned reportVariables() const noexcept {
return report_vars_; }
215 hid_t storage_type_ = H5T_NATIVE_DOUBLE;
216 int compression_ = 4;
217 unsigned report_vars_ = 0x7FFu;
218 std::vector<std::string> species_filter_;
219 std::vector<int> species_rows_;
220 double report_2d_step_days_ = 0.0;
221 double next_due_days_ = -1.0;
222 bool want(
unsigned bit)
const noexcept {
return (report_vars_ & bit) != 0; }
224 void writeSpeciesRows(
const double* all, hsize_t n_species_in);
226 std::string h5_path_;
228 std::string last_error_;
230 std::string model_crs_;
231 double metres_per_model_unit_ = 1.0;
233 hid_t file_id_ = H5I_INVALID_HID;
236 hid_t ds_time_ = H5I_INVALID_HID;
237 hid_t ds_face_depth_ = H5I_INVALID_HID;
238 hid_t ds_face_head_ = H5I_INVALID_HID;
239 hid_t ds_face_grad_hx_ = H5I_INVALID_HID;
240 hid_t ds_face_grad_hy_ = H5I_INVALID_HID;
241 hid_t ds_face_grad_hx_lim_ = H5I_INVALID_HID;
242 hid_t ds_face_grad_hy_lim_ = H5I_INVALID_HID;
243 hid_t ds_face_rainfall_ = H5I_INVALID_HID;
244 hid_t ds_face_coupling_flux_ = H5I_INVALID_HID;
245 hid_t ds_face_net_source_ = H5I_INVALID_HID;
246 hid_t ds_face_infil_rate_ = H5I_INVALID_HID;
247 hid_t ds_face_infil_cum_ = H5I_INVALID_HID;
248 hid_t ds_face_rain_cum_ = H5I_INVALID_HID;
252 hid_t ds_face_species_conc_ = H5I_INVALID_HID;
253 hsize_t n_species_ = 0;
254 hid_t ds_face_vx_ = H5I_INVALID_HID;
255 hid_t ds_face_vy_ = H5I_INVALID_HID;
256 hid_t ds_face_continuity_err_ = H5I_INVALID_HID;
257 hid_t ds_edge_flux_ = H5I_INVALID_HID;
258 hid_t ds_node_head_ = H5I_INVALID_HID;
259 hid_t ds_node_depth_ = H5I_INVALID_HID;
262 hid_t ds_face_max_depth_ = H5I_INVALID_HID;
263 hid_t ds_face_max_velocity_ = H5I_INVALID_HID;
264 hid_t ds_face_max_continuity_err_ = H5I_INVALID_HID;
266 hsize_t n_faces_ = 0;
267 hsize_t n_nodes_ = 0;
268 hsize_t edge_stride_ = 3;
269 hsize_t n_steps_ = 0;
272 void writeMeshTopology(
const SimulationContext& ctx);
274 void writeCrsVariable();
279 hid_t createUnlimitedDataset(
const char* name,
int rank,
281 const hsize_t* chunk_dims,
283 void writeStringAttr(hid_t loc,
const char* name,
const char* value);
284 void writeDoubleAttr(hid_t loc,
const char* name,
double value);
285 void extendAndWrite2D(hid_t ds,
const double* data, hsize_t n_cols);
286 void extendAndWrite3D(hid_t ds,
const double* data, hsize_t dim1, hsize_t dim2);
288 hid_t createFaceEnvelopeDataset(
const char* name,
const char* long_name,
291 void writeFaceEnvelope(hid_t ds,
const double* data);
Interface for output-writing plugins.
PluginState
Plugin lifecycle states.
Definition PluginState.hpp:83
StmtPtr prepare(sqlite3 *db, const std::string &sql)
Definition GpkgUtils.hpp:105
int validate(const std::string &expr_str, std::string &msg, int &col)
Validate a treatment expression without touching engine state.
Definition Treatment.cpp:346
Definition NodeCoupling.cpp:16
SoA storage for 2D mixed triangle/quad mesh geometry and topology.
Definition MeshData.hpp:67
Configuration for the 2D surface routing solver.
Definition SolverOptions2D.hpp:208