Skip to main content
`Ctrl`+`K`

# 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 optionname[])

Collective

## Input Parameters

- obj - the object

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

- optionname - option string that is used to activate viewing

## Options Database Key

- -optionname_view [viewertype]:… - option name and values. In actual usage this would be something like `-mat_coarse_view`

## 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. 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)

This is 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/snes/tutorials/ex55.c
src/snes/tutorials/ex69.c
src/ts/tutorials/ex30.c
src/snes/tutorials/ex27.c
src/snes/tutorials/ex5.c
src/ts/tutorials/ex11.c
src/snes/tutorials/ex62.c
src/vec/vec/utils/tagger/tutorials/ex1.c
src/dm/field/tutorials/ex1.c
src/dm/impls/swarm/tutorials/ex1f90.F90

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