feat(nonlinear-static-newton-raphson): step 9 - nonlinear-hdf5-schema-v1-writer

This commit is contained in:
KOKO\Mimi
2026-08-24 15:19:07 +09:00
parent 0978b019ce
commit dd3c6191c8
10 changed files with 2146 additions and 4 deletions
+28
View File
@@ -138,6 +138,34 @@ void WriteUint64Attribute(const hid_t object, const char* name,
"Unable to write an HDF5 integer attribute.");
}
void WriteUint8Attribute(const hid_t object, const char* name,
const std::uint8_t value) {
Hdf5Handle space{RequireHdf5Id(H5Screate(H5S_SCALAR),
"Unable to create an attribute space."),
H5Sclose};
Hdf5Handle attribute{
RequireHdf5Id(H5Acreate2(object, name, H5T_STD_U8LE, space.Get(),
H5P_DEFAULT, H5P_DEFAULT),
"Unable to create an HDF5 uint8 attribute."),
H5Aclose};
RequireHdf5(H5Awrite(attribute.Get(), H5T_NATIVE_UINT8, &value),
"Unable to write an HDF5 uint8 attribute.");
}
void WriteDoubleAttribute(const hid_t object, const char* name,
const double value) {
Hdf5Handle space{RequireHdf5Id(H5Screate(H5S_SCALAR),
"Unable to create an attribute space."),
H5Sclose};
Hdf5Handle attribute{
RequireHdf5Id(H5Acreate2(object, name, H5T_IEEE_F64LE, space.Get(),
H5P_DEFAULT, H5P_DEFAULT),
"Unable to create an HDF5 float64 attribute."),
H5Aclose};
RequireHdf5(H5Awrite(attribute.Get(), H5T_NATIVE_DOUBLE, &value),
"Unable to write an HDF5 float64 attribute.");
}
Hdf5Handle CreateGroup(const hid_t file, const char* path) {
Hdf5Handle link_properties{RequireHdf5Id(H5Pcreate(H5P_LINK_CREATE),
"Unable to create link properties."),