VecLoadIntoVector

Loads a vector that has been stored in binary format with VecView().

Synopsis

int VecLoadIntoVector(Viewer viewer,Vec vec)
Collective on Viewer

Input Parameters

viewer - binary file viewer, obtained from ViewerBinaryOpen()
vec - vector to contain files values (must be of correct length)

Notes

The input file must contain the full global vector, as written by the routine VecView().

Use VecLoad() to create the vector as the values are read in

Notes for advanced users

Most users should not need to know the details of the binary storage format, since VecLoad() and VecView() completely hide these details. But for anyone who's interested, the standard binary matrix storage format is
     int    VEC_COOKIE
     int    number of rows
     Scalar *values of all nonzeros

Note for Cray users, the int's stored in the binary file are 32 bit integers; not 64 as they are represented in the memory, so if you write your own routines to read/write these binary files from the Cray you need to adjust the integer sizes that you read in, see PetscReadBinary() and PetscWriteBinary() to see how this may be done.

In addition, PETSc automatically does the byte swapping for machines that store the bytes reversed, e.g. DEC alpha, freebsd, linux, nt and the paragon; thus if you write your own binary read/write routines you have to swap the bytes; see PetscReadBinary() and PetscWriteBinary() to see how this may be done.

Keywords

vector, load, binary, input

See Also

ViewerBinaryOpen(), VecView(), MatLoad(), VecLoad()

Level:intermediate
Location:src/vec/interface/vector.c
Vector Index
Table of Contents