:orphan:
# 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
```none
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()`, `PetscOptionsGetViewer()`
## Level
developer
## Location
src/sys/objects/destroy.c
## Examples
src/dm/field/tutorials/ex1.c
src/dm/impls/swarm/tutorials/ex1f90.F90
src/snes/tutorials/ex5.c
src/snes/tutorials/ex55.c
src/snes/tutorials/ex62.c
src/snes/tutorials/ex69.c
src/ts/tutorials/ex11.c
src/vec/vec/utils/tagger/tutorials/ex1.c
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/objects/destroy.c)
[Index of all Sys routines](index.md)
[Table of Contents for all manual pages](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)