# VecView

Views a vector object.

### Synopsis

    #include "petscvec.h"
    PetscErrorCode PETSCVEC_DLLEXPORT VecView(Vec vec,PetscViewer viewer)

Collective on Vec

### Input Parameters

| v | - the vector
| viewer | - an optional visualization context

### Notes

The available visualization contexts include

| PETSC_VIEWER_STDOUT_SELF | - standard output (default)
| PETSC_VIEWER_STDOUT_WORLD | - synchronized standard output where only the first processor opens the file. All other processors send their data to the first processor to print.

You can change the format the vector is printed using the option PetscViewerSetFormat().

The user can open alternative visualization contexts with

| PetscViewerASCIIOpen() | - Outputs vector to a specified file
| PetscViewerBinaryOpen() | - Outputs vector in binary to a specified file; corresponding input uses VecLoad()
| PetscViewerDrawOpen() | - Outputs vector to an X window display
| PetscViewerSocketOpen() | - Outputs vector to Socket viewer

The user can call PetscViewerSetFormat() to specify the output format of ASCII printed objects (when using PETSC_VIEWER_STDOUT_SELF, PETSC_VIEWER_STDOUT_WORLD and PetscViewerASCIIOpen). Available formats include

| PETSC_VIEWER_ASCII_DEFAULT | - default, prints vector contents
| PETSC_VIEWER_ASCII_MATLAB | - prints vector contents in Matlab format
| PETSC_VIEWER_ASCII_INDEX | - prints vector contents, including indices of vector elements
| PETSC_VIEWER_ASCII_COMMON | - prints vector contents, using a format common among all vector types

### See Also

PetscViewerASCIIOpen(), PetscViewerDrawOpen(), PetscDrawLGCreate(),
PetscViewerSocketOpen(), PetscViewerBinaryOpen(), VecLoad(), PetscViewerCreate(), PetscRealView(), PetscScalarView(), PetscIntView()

Level:beginner
Location:src/vec/interface/vector.c
Index of all Vec routines
Table of Contents for all manual pages
Index of all manual pages

### Examples

src/vec/examples/tutorials/ex2.c.html
src/vec/examples/tutorials/ex3.c.html
src/vec/examples/tutorials/ex5.c.html
src/vec/examples/tutorials/ex6.c.html
src/vec/examples/tutorials/ex7.c.html
src/vec/examples/tutorials/ex8.c.html
src/vec/examples/tutorials/ex12.c.html
src/vec/examples/tutorials/ex16.c.html
src/vec/examples/tutorials/ex17.c.html
src/vec/examples/tutorials/ex2f.F.html
src/vec/examples/tutorials/ex3f.F.html