PetscViewerHDF5ReadAttribute#

Read an attribute

Synopsis#

#include "petscviewerhdf5.h" 
PetscErrorCode PetscViewerHDF5ReadAttribute(PetscViewer viewer, const char parent[], const char name[], PetscDataType datatype, const void *defaultValue, void *value)

Collective

Input Parameters#

  • viewer - The PETSCVIEWERHDF5 viewer

  • parent - The parent dataset/group name

  • name - The attribute name

  • datatype - The attribute type

  • defaultValue - The pointer to the default value

Output Parameter#

  • value - The pointer to the read HDF5 attribute value

Notes#

If defaultValue is NULL and the attribute is not found, an error occurs.

If defaultValue is not NULL and the attribute is not found, defaultValue is copied to value.

The pointers defaultValue and value can be the same; for instance

  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.

See Also#

Viewers: Looking at PETSc Objects, PETSCVIEWERHDF5, PetscViewerHDF5Open(), PetscViewerHDF5ReadObjectAttribute(), PetscViewerHDF5WriteAttribute(), PetscViewerHDF5HasAttribute(), PetscViewerHDF5HasObject(), PetscViewerHDF5PushGroup(), PetscViewerHDF5PopGroup(), PetscViewerHDF5GetGroup()

Level#

advanced

Location#

src/sys/classes/viewer/impls/hdf5/hdf5v.c


Index of all Viewer routines
Table of Contents for all manual pages
Index of all manual pages