feat(hex8): connect Solid CLI and atomic HDF5 output
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
#ifndef FESA_IO_HDF5_SOLID_HDF5_SELF_CHECK_H_
|
||||
#define FESA_IO_HDF5_SOLID_HDF5_SELF_CHECK_H_
|
||||
#include <hdf5.h>
|
||||
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <variant>
|
||||
|
||||
#include "fesa/results/solid_results_writer.h"
|
||||
#include "io/hdf5/hdf5_raii.h"
|
||||
namespace fesa::hdf5_internal {
|
||||
/// @brief Exact prescribed Solid compound columns; width>1 denotes a fixed
|
||||
/// array.
|
||||
struct SolidColumn {
|
||||
std::string name;
|
||||
std::size_t width{1};
|
||||
std::variant<std::vector<std::uint64_t>, std::vector<std::uint8_t>,
|
||||
std::vector<double>, std::vector<std::string>>
|
||||
values;
|
||||
};
|
||||
struct SolidTable {
|
||||
std::string path;
|
||||
std::size_t rows{0};
|
||||
std::vector<SolidColumn> columns;
|
||||
std::map<std::string, std::string> strings;
|
||||
};
|
||||
struct SolidData {
|
||||
std::string path;
|
||||
std::vector<hsize_t> dimensions;
|
||||
std::vector<double> values;
|
||||
std::map<std::string, std::string> strings;
|
||||
std::map<std::string, std::uint64_t> integers;
|
||||
std::map<std::string, double> doubles;
|
||||
};
|
||||
/// @brief Expected RN64 serialization inventory, never a rounded-only physics
|
||||
/// check.
|
||||
struct SolidPlan {
|
||||
std::map<std::string, std::string> metadata;
|
||||
std::vector<std::uint8_t> mask;
|
||||
std::vector<SolidTable> tables;
|
||||
std::vector<SolidData> datasets;
|
||||
};
|
||||
/// @brief Private fault seams around real writes/readback/close/replace.
|
||||
struct SolidFileHooks {
|
||||
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;
|
||||
};
|
||||
using SolidStateView =
|
||||
std::variant<std::reference_wrapper<const SolidStaticState>,
|
||||
std::reference_wrapper<const SolidFrequencyState>,
|
||||
std::reference_wrapper<const SolidDynamicAnalysisState>>;
|
||||
Result<SolidPlan> BuildSolidPlan(const Domain&, SolidStateView,
|
||||
const std::vector<Diagnostic>&);
|
||||
Status WriteSolidFile(const std::filesystem::path&, const Domain&,
|
||||
SolidStateView, const std::vector<Diagnostic>&,
|
||||
const SolidFileHooks& = {});
|
||||
Status SelfCheckSolidFile(const std::filesystem::path&, const SolidPlan&,
|
||||
herr_t (*reader_close)(hid_t) = H5Fclose);
|
||||
Hdf5Handle SolidColumnType(const SolidColumn&, bool native);
|
||||
} // namespace fesa::hdf5_internal
|
||||
#endif
|
||||
Reference in New Issue
Block a user