Files
FESADev/src/fesa/io/hdf5/mitc4_file_hooks.h
T

43 lines
1.4 KiB
C++

#ifndef FESA_IO_HDF5_MITC4_FILE_HOOKS_H_
#define FESA_IO_HDF5_MITC4_FILE_HOOKS_H_
#include <hdf5.h>
#include <filesystem>
#include <functional>
#include <vector>
#include "fesa/core/status.h"
namespace fesa {
class Domain;
class AnalysisState;
class NonlinearAnalysisState;
class DynamicAnalysisState;
struct EigenAnalysisState;
struct Diagnostic;
namespace hdf5_internal {
// Private lifecycle fault seams. Production uses real closers and no callback.
// Injected closers must release the handle even when reporting failure.
struct Mitc4FileHooks {
herr_t (*candidate_close)(hid_t) = H5Fclose;
herr_t (*reader_close)(hid_t) = H5Fclose;
std::function<void(const std::filesystem::path&)> before_self_check;
};
Status WriteStaticFile(const std::filesystem::path&, const Domain&,
const AnalysisState&, const std::vector<Diagnostic>&, const Mitc4FileHooks& = {});
Status WriteNonlinearFile(const std::filesystem::path&, const Domain&,
const NonlinearAnalysisState&, const std::vector<Diagnostic>&, const Mitc4FileHooks& = {});
Status WriteDynamicFile(const std::filesystem::path&, const Domain&,
const DynamicAnalysisState&, const std::vector<Diagnostic>&, const Mitc4FileHooks& = {});
Status WriteEigenFile(const std::filesystem::path&, const Domain&,
const EigenAnalysisState&, const std::vector<Diagnostic>&, const Mitc4FileHooks& = {});
} // namespace hdf5_internal
} // namespace fesa
#endif // FESA_IO_HDF5_MITC4_FILE_HOOKS_H_