petsc-3.7.1 2016-05-15
Report Typos and Errors

# PetscOptionsGetViewer

Gets a viewer appropriate for the type indicated by the user

### Synopsis

    #include "petscviewer.h"
    PetscErrorCode  PetscOptionsGetViewer(MPI_Comm comm,const char pre[],const char name[],PetscViewer *viewer,PetscViewerFormat *format,PetscBool  *set)

Collective on MPI_Comm Many br

### Input Parameters

| comm | - the communicator to own the viewer Many br
| pre | - the string to prepend to the name or NULL Many br
| name | - the option one is seeking Many br

### Output Parameter

| viewer | - the viewer, pass NULL if not needed Many br
| format | - the PetscViewerFormat requested by the user, pass NULL if not needed Many br
| set | - PETSC_TRUE if found, else PETSC_FALSE Many br

Many br

Notes: If no value is provided ascii:stdout is used Many br

          ascii[:[filename][:[format][:append]]]    defaults to stdout - format can be one of ascii_info, ascii_info_detail, or ascii_matlab,

for example ascii::ascii_info prints just the information about the object not all details Many brunless :append is given filename opens in write mode, overwriting what was already there Many br

          binary[:[filename][:[format][:append]]]   defaults to the file binaryoutput

          draw[:drawtype]                           for example, draw:tikz  or draw:x

          socket[:port]                             defaults to the standard output port

          saws[:communicatorname]                    publishes object to the Scientific Application Webserver (SAWs)

Use PetscViewerDestroy() after using the viewer, otherwise a memory leak will occur Many br

If PETSc is configured with --with-viewfromoptions=0 this function always returns with *set of PETSC_FALSE Many br

### See Also

PetscOptionsGetReal(), PetscOptionsHasName(), PetscOptionsGetString(),
PetscOptionsGetIntArray(), PetscOptionsGetRealArray(), PetscOptionsBool() Many brPetscOptionsInt(), PetscOptionsString(), PetscOptionsReal(), PetscOptionsBool(), Many brPetscOptionsName(), PetscOptionsBegin(), PetscOptionsEnd(), PetscOptionsHead(), Many brPetscOptionsStringArray(),PetscOptionsRealArray(), PetscOptionsScalar(), Many brPetscOptionsBoolGroupBegin(), PetscOptionsBoolGroup(), PetscOptionsBoolGroupEnd(), Many brPetscOptionsFList(), PetscOptionsEList() Many br

Level:intermediate
Location:src/sys/classes/viewer/interface/viewreg.c
Index of all Viewer routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/sys/classes/viewer/examples/tutorials/ex2.c.html
src/sys/examples/tutorials/ex15.c.html
src/dm/impls/forest/examples/tutorials/ex1.c.html