petsc-3.11.4 2019-09-28
Report Typos and Errors

VecView

Views a vector object.

Synopsis

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

Input Parameters

vec - the vector
viewer - an optional visualization context

Notes

The available visualization contexts include
PETSC_VIEWER_STDOUT_SELF - for sequential vectors
PETSC_VIEWER_STDOUT_WORLD - for parallel vectors created on PETSC_COMM_WORLD
PETSC_VIEWER_STDOUT_(comm) - for parallel vectors created on MPI communicator comm

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

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 PetscViewerPushFormat() 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_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

Notes

You can pass any number of vector objects, or other PETSc objects to the same viewer.

Notes for binary viewer: If you pass multiply vectors to a binary viewer you can read them back in in the same order

    with VecLoad().

   If the blocksize of the vector is greater than one then you must provide a unique prefix to
   the vector with PetscObjectSetOptionsPrefix((PetscObject)vec,"uniqueprefix"); BEFORE calling VecView() on the
   vector to be stored and then set that same unique prefix on the vector that you pass to VecLoad(). The blocksize
   information is stored in an ASCII file with the same name as the binary file plus a ".info" appended to the
   filename. If you copy the binary file, make sure you copy the associated .info file with it.

Notes for HDF5 Viewer: the name of the Vec (given with PetscObjectSetName() is the name that is used

   for the object in the HDF5 file. If you wish to store the same vector to the HDF5 viewer (with different values,
   obviously) several times, you must change its name each time before calling the VecView(). The name you use
   here should equal the name that you use in the Vec object that you use with VecLoad().

See the manual page for VecLoad() on the exact format the binary viewer stores the values in the file.

See Also

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

Level

beginner

Location

src/vec/vec/interface/vector.c

Examples

src/vec/vec/examples/tutorials/ex2.c.html
src/vec/vec/examples/tutorials/ex3.c.html
src/vec/vec/examples/tutorials/ex5.c.html
src/vec/vec/examples/tutorials/ex6.c.html
src/vec/vec/examples/tutorials/ex7.c.html
src/vec/vec/examples/tutorials/ex8.c.html
src/vec/vec/examples/tutorials/ex10.c.html
src/vec/vec/examples/tutorials/ex12.c.html
src/vec/vec/examples/tutorials/ex15.c.html
src/vec/vec/examples/tutorials/ex16.c.html
src/vec/vec/examples/tutorials/ex19.c.html

Implementations

VecView_DMComposite in src/dm/impls/composite/pack.c
VecView_MPI_Draw_DA1d in src/dm/impls/da/gr1.c
VecView_MPI_Draw_DA2d_Zoom in src/dm/impls/da/gr2.c
VecView_MPI_Draw_DA2d in src/dm/impls/da/gr2.c
VecView_MPI_HDF5_DA in src/dm/impls/da/gr2.c
VecView_MPI_DA in src/dm/impls/da/gr2.c
VecView_pforest in src/dm/impls/forest/p4est/pforest.c
VecView_pforest_Native in src/dm/impls/forest/p4est/pforest.c
VecView_Network_Seq in src/dm/impls/network/networkcreate.c
VecView_Network_MPI in src/dm/impls/network/networkcreate.c
VecView_Network in src/dm/impls/network/networkcreate.c
VecView_Plex_Local_Draw in src/dm/impls/plex/plex.c
VecView_Plex_Local_VTK in src/dm/impls/plex/plex.c
VecView_Plex_Local in src/dm/impls/plex/plex.c
VecView_Plex in src/dm/impls/plex/plex.c
VecView_Plex_Native in src/dm/impls/plex/plex.c
VecView_Plex_Local_HDF5_Internal in src/dm/impls/plex/plexhdf5.c
VecView_Plex_HDF5_Internal in src/dm/impls/plex/plexhdf5.c
VecView_Plex_HDF5_Native_Internal in src/dm/impls/plex/plexhdf5.c
VecView_MPI_ASCII in src/vec/vec/impls/mpi/pdvec.c
VecView_MPI_Binary in src/vec/vec/impls/mpi/pdvec.c
VecView_MPI_Draw_LG in src/vec/vec/impls/mpi/pdvec.c
VecView_MPI_Draw in src/vec/vec/impls/mpi/pdvec.c
VecView_MPI_Matlab in src/vec/vec/impls/mpi/pdvec.c
VecView_MPI_ADIOS in src/vec/vec/impls/mpi/pdvec.c
VecView_MPI_ADIOS2 in src/vec/vec/impls/mpi/pdvec.c
VecView_MPI_HDF5 in src/vec/vec/impls/mpi/pdvec.c
VecView_MPI in src/vec/vec/impls/mpi/pdvec.c
VecView_Nest in src/vec/vec/impls/nest/vecnest.c
VecView_Node in src/vec/vec/impls/node/vecnode.c
VecView_Seq_ASCII in src/vec/vec/impls/seq/bvec2.c
VecView_Seq_Draw_LG in src/vec/vec/impls/seq/bvec2.c
VecView_Seq_Draw in src/vec/vec/impls/seq/bvec2.c
VecView_Seq_Binary in src/vec/vec/impls/seq/bvec2.c
VecView_Seq_Matlab in src/vec/vec/impls/seq/bvec2.c
VecView_Seq in src/vec/vec/impls/seq/bvec2.c

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