Skip to main content
`Ctrl`+`K`

# PetscViewerRestoreSubViewer

Restores a `PetscViewer` obtained with `PetscViewerGetSubViewer()`.

## Synopsis

    #include "petscviewer.h"
    PetscErrorCode PetscViewerRestoreSubViewer(PetscViewer viewer, MPI_Comm comm, PetscViewer *outviewer)

Collective

## Input Parameters

- viewer - the `PetscViewer` that was reproduced

- comm - the sub communicator

- outviewer - the subviewer to be returned

## Notes

Automatically runs `PetscViewerFlush()` on `outviewer`

Must be called by all MPI processes that share `viewer`, for processes that are not of interest you can pass `PETSC_COMM_SELF`.

## See Also

Viewers: Looking at PETSc Objects, `PetscViewer`, `PetscViewerSocketOpen()`, `PetscViewerASCIIOpen()`, `PetscViewerDrawOpen()`, `PetscViewerGetSubViewer()`, `PetscViewerFlush()`

## Level

advanced

## Location

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

## Examples

src/ts/tutorials/ex30.c
src/dm/tutorials/ex6.c
src/vec/vec/tutorials/ex9f.F90
src/vec/vec/tutorials/ex14f.F90

## Implementations

PetscViewerRestoreSubViewer_ASCII() in src/sys/classes/viewer/impls/ascii/filev.c
PetscViewerRestoreSubViewer_Binary() in src/sys/classes/viewer/impls/binary/binv.c
PetscViewerRestoreSubViewer_Draw() in src/sys/classes/viewer/impls/draw/drawv.c
PetscViewerRestoreSubViewer_String() in src/sys/classes/viewer/impls/string/stringv.c

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