PetscViewerAndFormatCreate — PETSc 3.23.0 documentation

Skip to main content
`Ctrl`+`K`

# 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

Viewers: Looking at PETSc Objects, `PetscViewer`, `PetscViewerAndFormat`, `PetscViewerFormat`, `PetscViewerSocketOpen()`, `PetscViewerASCIIOpen()`, `PetscViewerCreate()`, `PetscViewerDrawOpen()`, `PetscViewerAndFormatDestroy()`

## Level

developer

## Location

src/sys/classes/viewer/interface/view.c

## Examples

src/ts/tutorials/ex7.c
src/ksp/ksp/tutorials/ex2f.F90
src/ts/tutorials/ex12.c
src/ts/tutorials/ex52.c
src/snes/tutorials/ex30.c

Index of all Viewer routines
Table of Contents for all manual pages
Index of all manual pages