PetscObjectViewFromOptions#

Processes command line options to determine if/how a PetscObject is to be viewed.

Synopsis#

#include "petscsys.h"    
PetscErrorCode PetscObjectViewFromOptions(PetscObject obj, PetscObject bobj, const char name[])

Collective

Input Parameters#

  • obj - the object

  • bobj - optional other object that provides prefix (if NULL then the prefix in obj is used)

  • name - option string that is used to activate viewing. It typically ends with _view.

Options Database Key#

  • -name [viewertype][:…] - option name and values. In actual usage the key might be something like -vec_view

Notes#

For a viewertype that represents files, including ascii, binary, matlab, vu, vtk, glvis, cgns, and hdf5, the argument has the following form

    viewertype[:filename[:format[:filemode]]]

where all parts are optional, but you need to include the colon to access the next part. filename is the name of the file where the object data will be stored. format is the string name of a PetscViewerFormat, for example, default or ascii_info. filemode can be append to indicate the file named filename should be appended to and not replaced, while read indicates the file is for reading.

For example, to read from an HDF5 file, use

    hdf5:sol.h5::read

For a viewertype of draw the argument is of the form

  draw[:drawtype[:filename]]

where drawtype is, for example, tikz or x and filename indicates where the data is to be saved if it is not directly displayed.

Other formats, such as

  socket[:port]
  saws[:communicatorname]

that send the data to a Unix socket or publish the object to the Scientific Application Webserver (SAWs) exist.

If no value is provided ascii:stdout is used

This function is usually not called directly but is called by, for example, MatViewFromOptions().

See Also#

PetscObject, PetscObjectView(), PetscOptionsCreateViewer()

Level#

developer

Location#

src/sys/objects/destroy.c

Examples#

src/ts/tutorials/ex30.c
src/dm/impls/swarm/tutorials/ex1f90.F90
src/snes/tutorials/ex69.c
src/snes/tutorials/ex62.c
src/snes/tutorials/ex55.c
src/vec/vec/utils/tagger/tutorials/ex1.c
src/snes/tutorials/ex5.c
src/ts/tutorials/ex11.c
src/snes/tutorials/ex27.c
src/dm/field/tutorials/ex1.c


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