#include "petscviewerhdf5.h" PetscErrorCode PetscViewerHDF5ReadAttribute(PetscViewer viewer, const char parent[], const char name[], PetscDataType datatype, const void *defaultValue, void *value)Collective
viewer | - The HDF5 viewer | |
parent | - The parent dataset/group name | |
name | - The attribute name | |
datatype | - The attribute type | |
defaultValue | - The pointer to the default value |
value | - The pointer to the read HDF5 attribute value |
flg = PETSC_FALSE;
PetscCall(PetscViewerHDF5ReadAttribute(viewer,name,"attr",PETSC_BOOL,&flg,&flg));is valid, but make sure the default value is initialized.
If the datatype is PETSC_STRING, the output string is newly allocated so one must PetscFree() it when no longer needed.
If parent starts with '/', it is taken as an absolute path overriding currently pushed group, else parent is relative to the current pushed group. NULL means the current pushed group.