#ifndef FESA_IO_HDF5_THERMAL_HDF5_SELF_CHECK_H_ #define FESA_IO_HDF5_THERMAL_HDF5_SELF_CHECK_H_ #include #include #include #include #include "fesa/analysis/thermal_analysis_state.h" #include "fesa/core/status.h" #include "fesa/model/domain.h" namespace fesa { struct Diagnostic; } namespace fesa::hdf5_internal { /// @brief Supplies private lifecycle fault seams around the real HDF5 /// operations. /// @note Production uses default closers and no callbacks. Test closers must /// release their handle even when reporting an injected close failure. struct ThermalFileHooks { herr_t (*candidate_close)(hid_t) = H5Fclose; herr_t (*reader_close)(hid_t) = H5Fclose; std::function before_write; std::function before_self_check; std::function before_finalize; }; /// @brief Executes the actual candidate/write/check/close/finalize lifecycle. Status WriteThermalFile(const std::filesystem::path& output_path, const Domain& domain, const ThermalAnalysisState& state, const std::vector& diagnostics, const ThermalFileHooks& hooks = {}); /// @brief Maps section-local thermal material indices into the global Domain /// table. std::uint64_t GlobalThermalMaterialId(const Domain& domain, std::size_t local); /// @brief Checks supplied immutable source/initial/schedule inventories before /// writing. Status ValidateThermalOutput(const Domain& domain, const ThermalAnalysisState& state); /// @brief Checks every mandatory thermal field, value and attribute before /// publication. Status SelfCheckThermalFile(const std::filesystem::path& path, const Domain& domain, const ThermalAnalysisState& state, const std::vector& diagnostics, herr_t (*close_reader)(hid_t) = H5Fclose); } // namespace fesa::hdf5_internal #endif // FESA_IO_HDF5_THERMAL_HDF5_SELF_CHECK_H_