:orphan:
# PetscViewerCreate
Creates a viewing context. A `PetscViewer` represents a file, a graphical window, a Unix socket or a variety of other ways of viewing a PETSc object
## Synopsis
```
#include "petscviewer.h"
PetscErrorCode PetscViewerCreate(MPI_Comm comm, PetscViewer *inviewer)
```
Collective
## Input Parameter
- ***comm -*** MPI communicator
## Output Parameter
- ***inviewer -*** location to put the `PetscViewer` context
## See Also
[](sec_viewers), `PetscViewer`, `PetscViewerDestroy()`, `PetscViewerSetType()`, `PetscViewerType`
## Level
advanced
## Location
src/sys/classes/viewer/interface/viewreg.c
## Examples
src/dm/impls/plex/tutorials/ex1.c
src/dm/impls/plex/tutorials/ex1f90.F90
src/dm/tutorials/ex15.c
src/dm/tutorials/ex20.c
src/dm/tutorials/ex21.c
src/ksp/ksp/tutorials/ex43.c
src/ksp/ksp/tutorials/ex70.c
src/mat/tutorials/ex10.c
src/snes/tutorials/ex12.c
src/sys/classes/viewer/tutorials/ex1.c
src/ts/tutorials/ex11.c
## Implementations
PetscViewerCreate_ExodusII in src/dm/impls/plex/plexexodusii.c
PetscViewerCreate_ADIOS in src/sys/classes/viewer/impls/adios/adios.c
PetscViewerCreate_SAWs in src/sys/classes/viewer/impls/ams/ams.c
PetscViewerCreate_ASCII in src/sys/classes/viewer/impls/ascii/filev.c
PetscViewerCreate_Binary in src/sys/classes/viewer/impls/binary/binv.c
PetscViewerCreate_CGNS in src/sys/classes/viewer/impls/cgns/cgnsv.c
PetscViewerCreate_Draw in src/sys/classes/viewer/impls/draw/drawv.c
PetscViewerCreate_GLVis in src/sys/classes/viewer/impls/glvis/glvis.c
PetscViewerCreate_HDF5 in src/sys/classes/viewer/impls/hdf5/hdf5v.c
PetscViewerCreate_Mathematica in src/sys/classes/viewer/impls/mathematica/mathematica.c
PetscViewerCreate_Matlab in src/sys/classes/viewer/impls/matlab/vmatlab.c
PetscViewerCreate_Socket in src/sys/classes/viewer/impls/socket/send.c
PetscViewerCreate_String in src/sys/classes/viewer/impls/string/stringv.c
PetscViewerCreate_VTK in src/sys/classes/viewer/impls/vtk/vtkv.c
PetscViewerCreate_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/viewreg.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)