feat(nonlinear-static-newton-raphson): step 9 - nonlinear-hdf5-schema-v1-writer
This commit is contained in:
@@ -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."),
|
||||
|
||||
Reference in New Issue
Block a user