:orphan: # PetscViewerAndFormatCreate Creates a `PetscViewerAndFormat` struct. ## Synopsis ``` #include "petscviewer.h" PetscErrorCode PetscViewerAndFormatCreate(PetscViewer viewer, PetscViewerFormat format, PetscViewerAndFormat **vf) ``` Collective ## Input Parameters - ***viewer -*** the viewer - ***format -*** the format ## Output Parameter - ***vf -*** viewer and format object ## Notes This increases the reference count of the viewer. Use `PetscViewerAndFormatDestroy()` to free the struct This is used as the context variable for many of the `TS`, `SNES`, and `KSP` monitor functions This construct exists because it allows one to keep track of the use of a `PetscViewerFormat` without requiring the format in the viewer to be permanently changed. ## See Also [](sec_viewers), `PetscViewer`, `PetscViewerAndFormat`, `PetscViewerFormat`, `PetscViewerSocketOpen()`, `PetscViewerASCIIOpen()`, `PetscViewerCreate()`, `PetscViewerDrawOpen()`, `PetscViewerAndFormatDestroy()` ## Level developer ## Location src/sys/classes/viewer/interface/view.c ## Examples src/ksp/ksp/tutorials/ex2f.F90
src/snes/tutorials/ex30.c
src/ts/tutorials/ex12.c
src/ts/tutorials/ex52.c
src/ts/tutorials/ex7.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)