PetscOptionsCreateViewer#
Creates a viewer appropriate for the type indicated by the user
Synopsis#
#include "petscviewer.h"
PetscErrorCode PetscOptionsCreateViewer(MPI_Comm comm, PetscOptions options, const char pre[], const char name[], PetscViewer *viewer, PetscViewerFormat *format, PetscBool *set)
Collective
Input Parameters#
comm - the communicator to own the viewer
options - options database, use
NULL
for default global databasepre - the string to prepend to the name or
NULL
name - the options database name that will be checked for
Output Parameters#
viewer - the viewer, pass
NULL
if not neededformat - the
PetscViewerFormat
requested by the user, passNULL
if not neededset -
PETSC_TRUE
if found, elsePETSC_FALSE
Notes#
The argument has the following form
type:filename:format:filemode
where all parts are optional, but you need to include the colon to access the next part. The mode argument must a valid PetscFileMode
, i.e. read, write, append, update, or append_update. For example, to read from an HDF5 file, use
hdf5:sol.h5::read
If no value is provided ascii:stdout is used
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 unless :append is given filename opens in write mode, overwriting what was already there
binary[:[filename][:[format][:append]]] - defaults to the file binaryoutput
draw[:drawtype[:filename]] - for example, draw:tikz, draw:tikz:figure.tex or draw:x
socket[:port] - defaults to the standard output port
saws[:communicatorname] - publishes object to the Scientific Application Webserver (SAWs)
You can control whether calls to this function create a viewer (or return early with *set of PETSC_FALSE
) with
PetscOptionsPushCreateViewerOff()
. This is useful if calling many small subsolves, in which case XXXViewFromOptions can take
an appreciable fraction of the runtime.
If PETSc is configured with --with-viewfromoptions=0
this function always returns with *set of PETSC_FALSE
This routine is thread-safe for accessing predefined PetscViewer
s like PETSC_VIEWER_STDOUT_SELF
but not for accessing
files by name.
See Also#
Viewers: Looking at PETSc Objects, PetscViewerDestroy()
, PetscOptionsGetReal()
, PetscOptionsHasName()
, PetscOptionsGetString()
,
PetscOptionsGetIntArray()
, PetscOptionsGetRealArray()
, PetscOptionsBool()
PetscOptionsInt()
, PetscOptionsString()
, PetscOptionsReal()
,
PetscOptionsName()
, PetscOptionsBegin()
, PetscOptionsEnd()
, PetscOptionsHeadBegin()
,
PetscOptionsStringArray()
, PetscOptionsRealArray()
, PetscOptionsScalar()
,
PetscOptionsBoolGroupBegin()
, PetscOptionsBoolGroup()
, PetscOptionsBoolGroupEnd()
,
PetscOptionsFList()
, PetscOptionsEList()
, PetscOptionsPushCreateViewerOff()
, PetscOptionsPopCreateViewerOff()
,
PetscOptionsCreateViewerOff()
Level#
intermediate
Location#
Examples#
src/ts/tutorials/ex53.c
src/sys/classes/viewer/tutorials/ex2.c
src/snes/tutorials/ex56.c
src/snes/tutorials/ex62.c
src/snes/tutorials/ex17.c
src/vec/vec/utils/tagger/tutorials/ex1.c
src/snes/tutorials/ex36.c
Index of all Viewer routines
Table of Contents for all manual pages
Index of all manual pages