# PetscViewerRegister
Adds a viewer to those available for use 
## Synopsis
```
#include "petscviewer.h" 
PetscErrorCode PetscViewerRegister(const char *sname, PetscErrorCode (*function)(PetscViewer))
```
Not Collective


## Input Parameters

- ***name_solver -*** name of a new user-defined viewer
- ***routine_create -*** routine to create method context





## Note
`PetscViewerRegister()` may be called multiple times to add several user-defined viewers.


## Sample usage
```none
   PetscViewerRegister("my_viewer_type",MyViewerCreate);
```


Then, your solver can be chosen with the procedural interface via
```none
PetscViewerSetType(viewer,"my_viewer_type")
```
or at runtime via the option
```none
-viewer_type my_viewer_type
```


## See Also
 `PetscViewerRegisterAll()`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/classes/viewer/interface/viewreg.c.html#PetscViewerRegister">src/sys/classes/viewer/interface/viewreg.c</A>


---
[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](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
