50 lines
2.1 KiB
C++
50 lines
2.1 KiB
C++
#ifndef FESA_IO_HDF5_THERMAL_HDF5_SELF_CHECK_H_
|
|
#define FESA_IO_HDF5_THERMAL_HDF5_SELF_CHECK_H_
|
|
|
|
#include <hdf5.h>
|
|
|
|
#include <filesystem>
|
|
#include <functional>
|
|
#include <vector>
|
|
|
|
#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<void(hid_t)> before_write;
|
|
std::function<void(const std::filesystem::path&)> before_self_check;
|
|
std::function<void(const std::filesystem::path&)> 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<Diagnostic>& 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<Diagnostic>& diagnostics,
|
|
herr_t (*close_reader)(hid_t) = H5Fclose);
|
|
} // namespace fesa::hdf5_internal
|
|
#endif // FESA_IO_HDF5_THERMAL_HDF5_SELF_CHECK_H_
|