petsc-3.12.5 2020-03-29
Report Typos and Errors

PetscViewerGetSubViewer

Creates a new PetscViewer (same type as the old) that lives on a subcommunicator

Synopsis

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

Input Parameter

viewer -the PetscViewer to be reproduced

Output Parameter

outviewer -new PetscViewer

Notes

Call PetscViewerRestoreSubViewer() to return this PetscViewer, NOT PetscViewerDestroy()

This is most commonly used to view a sequential object that is part of a parallel object. For example block Jacobi PC view could use this to obtain a PetscViewer that is used with the sequential KSP on one block of the preconditioner.

Between the calls to PetscViewerGetSubViewer() and PetscViewerRestoreSubViewer() the original viewer should not be used

PETSCVIEWERDRAW and PETSCVIEWERBINARY only support returning a singleton viewer on rank 0, all other ranks will return a NULL viewer

Developer Notes

There is currently incomplete error checking that the user does not use the original viewer between the the calls to PetscViewerGetSubViewer() and PetscViewerRestoreSubViewer(). If the user does there could be errors in the viewing that go undetected or crash the code.

See Also

PetscViewerSocketOpen(), PetscViewerASCIIOpen(), PetscViewerDrawOpen(), PetscViewerRestoreSubViewer()

Level

advanced

Location

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

Examples

src/vec/vec/examples/tutorials/ex9f.F90.html
src/vec/vec/examples/tutorials/ex14f.F90.html
src/dm/examples/tutorials/ex6.c.html

Implementations

PetscViewerGetSubViewer_ASCII in src/sys/classes/viewer/impls/ascii/filev.c
PetscViewerGetSubViewer_Binary in src/sys/classes/viewer/impls/binary/binv.c
PetscViewerGetSubViewer_Draw in src/sys/classes/viewer/impls/draw/drawv.c
PetscViewerGetSubViewer_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