:orphan:
# PetscViewerDestroy
Destroys a `PetscViewer`.
## Synopsis
```
#include "petscviewer.h"
PetscErrorCode PetscViewerDestroy(PetscViewer *viewer)
```
Collective
## Input Parameter
- ***viewer -*** the `PetscViewer` to be destroyed.
## See Also
[](sec_viewers), `PetscViewer`, `PetscViewerCreate()`, `PetscViewerSocketOpen()`, `PetscViewerASCIIOpen()`, `PetscViewerCreate()`, `PetscViewerDrawOpen()`
## Level
beginner
## Location
src/sys/classes/viewer/interface/view.c
## Examples
src/dm/impls/forest/tutorials/ex1.c
src/dm/impls/plex/tutorials/ex1.c
src/dm/impls/plex/tutorials/ex1f90.F90
src/dm/impls/plex/tutorials/ex5.c
src/dm/impls/stag/tutorials/ex4.c
src/dm/impls/stag/tutorials/ex6.c
src/dm/tutorials/ex1.c
src/dm/tutorials/ex10.c
src/dm/tutorials/ex15.c
src/dm/tutorials/ex2.c
src/dm/tutorials/ex20.c
## Implementations
PetscViewerDestroy_ExodusII in src/dm/impls/plex/plexexodusii.c
PetscViewerDestroy_ADIOS in src/sys/classes/viewer/impls/adios/adios.c
PetscViewerDestroy_SAWs in src/sys/classes/viewer/impls/ams/ams.c
PetscViewerDestroy_ASCII in src/sys/classes/viewer/impls/ascii/filev.c
PetscViewerDestroy_Binary in src/sys/classes/viewer/impls/binary/binv.c
PetscViewerDestroy_CGNS in src/sys/classes/viewer/impls/cgns/cgnsv.c
PetscViewerDestroy_Draw in src/sys/classes/viewer/impls/draw/drawv.c
PetscViewerDestroy_GLVis in src/sys/classes/viewer/impls/glvis/glvis.c
PetscViewerDestroy_HDF5 in src/sys/classes/viewer/impls/hdf5/hdf5v.c
PetscViewerDestroy_Mathematica in src/sys/classes/viewer/impls/mathematica/mathematica.c
PetscViewerDestroy_Matlab in src/sys/classes/viewer/impls/matlab/vmatlab.c
PetscViewerDestroy_Socket in src/sys/classes/viewer/impls/socket/send.c
PetscViewerDestroy_String in src/sys/classes/viewer/impls/string/stringv.c
PetscViewerDestroy_VTK in src/sys/classes/viewer/impls/vtk/vtkv.c
PetscViewerDestroy_VU in src/sys/classes/viewer/impls/vu/petscvu.c
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/classes/viewer/interface/view.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)