:orphan:
# PetscViewerHDF5WriteObjectAttribute
Write an attribute to the dataset matching the given `PetscObject` by name 
## Synopsis
```
#include "petscviewerhdf5.h" 
PetscErrorCode PetscViewerHDF5WriteObjectAttribute(PetscViewer viewer, PetscObject obj, const char name[], PetscDataType datatype, const void *value)
```
Collective


## Input Parameters

- ***viewer   -*** The `PETSCVIEWERHDF5` viewer
- ***obj      -*** The object whose name is used to lookup the parent dataset, relative to the current group.
- ***name     -*** The attribute name
- ***datatype -*** The attribute type
- ***value    -*** The attribute value





## Note
This fails if the path current_group/object_name doesn't resolve to a dataset (the path doesn't exist or is not a dataset).
You might want to check first if it does using `PetscViewerHDF5HasObject()`.


## See Also
 [](sec_viewers), `PETSCVIEWERHDF5`, `PetscViewerHDF5Open()`, `PetscViewerHDF5WriteAttribute()`, `PetscViewerHDF5ReadObjectAttribute()`, `PetscViewerHDF5HasObjectAttribute()`,
`PetscViewerHDF5HasObject()`, `PetscViewerHDF5PushGroup()`, `PetscViewerHDF5PopGroup()`, `PetscViewerHDF5GetGroup()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/classes/viewer/impls/hdf5/hdf5v.c.html#PetscViewerHDF5WriteObjectAttribute">src/sys/classes/viewer/impls/hdf5/hdf5v.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/classes/viewer/impls/hdf5/hdf5v.c)


[Index of all Viewer routines](index.md)  
[Table of Contents for all manual pages](/manualpages/index.md)  
[Index of all manual pages](/manualpages/singleindex.md)  
