:orphan: # PetscViewerRegister Adds a viewer to those available for use with `PetscViewerSetType()` ## Synopsis ``` #include "petscviewer.h" PetscErrorCode PetscViewerRegister(const char *sname, PetscErrorCode (*function)(PetscViewer)) ``` Not Collective ## Input Parameters - ***sname -*** name of a new user-defined viewer - ***function -*** 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 [](sec_viewers), `PetscViewerRegisterAll()` ## Level developer ## Location src/sys/classes/viewer/interface/viewreg.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)