1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML3.2 EN">
<HTML>
<HEAD> <link rel="canonical" href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecLoad.html" />
<META NAME="GENERATOR" CONTENT="DOCTEXT">
<TITLE>VecLoad</TITLE>
</HEAD>
<BODY BGCOLOR="FFFFFF">
<div id="version" align=right><b>petsc-3.4.2 2013-07-02</b></div>
<A NAME="VecLoad"><H1>VecLoad</H1></A>
Loads a vector that has been stored in binary or HDF5 format with <A HREF="../Vec/VecView.html#VecView">VecView</A>().
<H3><FONT COLOR="#CC3333">Synopsis</FONT></H3>
<PRE>
#include "petscvec.h"
PetscErrorCode VecLoad(Vec newvec, PetscViewer viewer)
</PRE>
Collective on <A HREF="../Viewer/PetscViewer.html#PetscViewer">PetscViewer</A>
<P>
<H3><FONT COLOR="#CC3333">Input Parameters</FONT></H3>
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>newvec </B></TD><TD>- the newly loaded vector, this needs to have been created with <A HREF="../Vec/VecCreate.html#VecCreate">VecCreate</A>() or
some related function before a call to <A HREF="../Vec/VecLoad.html#VecLoad">VecLoad</A>().
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>viewer </B></TD><TD>- binary file viewer, obtained from <A HREF="../Viewer/PetscViewerBinaryOpen.html#PetscViewerBinaryOpen">PetscViewerBinaryOpen</A>() or
HDF5 file viewer, obtained from <A HREF="../Viewer/PetscViewerHDF5Open.html#PetscViewerHDF5Open">PetscViewerHDF5Open</A>()
</TD></TR></TABLE>
<P>
<P>
<H3><FONT COLOR="#CC3333">Notes</FONT></H3>
Defaults to the standard Seq or MPI <A HREF="../Vec/Vec.html#Vec">Vec</A>, if you want some other type of <A HREF="../Vec/Vec.html#Vec">Vec</A> call <A HREF="../Vec/VecSetFromOptions.html#VecSetFromOptions">VecSetFromOptions</A>()
before calling this.
<P>
The input file must contain the full global vector, as
written by the routine <A HREF="../Vec/VecView.html#VecView">VecView</A>().
<P>
If the type or size of newvec is not set before a call to <A HREF="../Vec/VecLoad.html#VecLoad">VecLoad</A>, PETSc
sets the type and the local and global sizes.If type and/or
sizes are already set, then the same are used.
<P>
IF using HDF5, you must assign the <A HREF="../Vec/Vec.html#Vec">Vec</A> the same name as was used in the <A HREF="../Vec/Vec.html#Vec">Vec</A>
that was stored in the file using <A HREF="../Sys/PetscObjectSetName.html#PetscObjectSetName">PetscObjectSetName</A>(). Otherwise you will
get the error message: "Cannot H5DOpen2() with <A HREF="../Vec/Vec.html#Vec">Vec</A> name NAMEOFOBJECT"
<P>
<H3><FONT COLOR="#CC3333">Notes for advanced users</FONT></H3>
Most users should not need to know the details of the binary storage
format, since <A HREF="../Vec/VecLoad.html#VecLoad">VecLoad</A>() and <A HREF="../Vec/VecView.html#VecView">VecView</A>() completely hide these details.
But for anyone who's interested, the standard binary matrix storage
format is
<PRE>
int VEC_FILE_CLASSID
int number of rows
<A HREF="../Sys/PetscScalar.html#PetscScalar">PetscScalar</A> *values of all entries
</PRE>
<P>
In addition, PETSc automatically does the byte swapping for
machines that store the bytes reversed, e.g. DEC alpha, freebsd,
linux, Windows and the paragon; thus if you write your own binary
read/write routines you have to swap the bytes; see <A HREF="../Sys/PetscBinaryRead.html#PetscBinaryRead">PetscBinaryRead</A>()
and <A HREF="../Sys/PetscBinaryWrite.html#PetscBinaryWrite">PetscBinaryWrite</A>() to see how this may be done.
<P>
<P>
<H3><FONT COLOR="#CC3333">See Also</FONT></H3>
<A HREF="../Viewer/PetscViewerBinaryOpen.html#PetscViewerBinaryOpen">PetscViewerBinaryOpen</A>(), <A HREF="../Vec/VecView.html#VecView">VecView</A>(), <A HREF="../Mat/MatLoad.html#MatLoad">MatLoad</A>(), <A HREF="../Vec/VecLoad.html#VecLoad">VecLoad</A>()
<BR><P><B><P><B><FONT COLOR="#CC3333">Level:</FONT></B>intermediate
<BR><FONT COLOR="#CC3333">Location:</FONT></B><A HREF="../../../src/vec/vec/interface/vector.c.html#VecLoad">src/vec/vec/interface/vector.c</A>
<BR><A HREF="./index.html">Index of all Vec routines</A>
<BR><A HREF="../../index.html">Table of Contents for all manual pages</A>
<BR><A HREF="../singleindex.html">Index of all manual pages</A>
<P><H3><FONT COLOR="#CC3333">Examples</FONT></H3>
<A HREF="../../../src/vec/vec/examples/tutorials/ex5.c.html">src/vec/vec/examples/tutorials/ex5.c.html</A><BR>
<A HREF="../../../src/vec/vec/examples/tutorials/ex10.c.html">src/vec/vec/examples/tutorials/ex10.c.html</A><BR>
<A HREF="../../../src/vec/vec/examples/tutorials/ex19.c.html">src/vec/vec/examples/tutorials/ex19.c.html</A><BR>
<A HREF="../../../src/vec/vec/examples/tutorials/ex42.c.html">src/vec/vec/examples/tutorials/ex42.c.html</A><BR>
<A HREF="../../../src/vec/vec/examples/tutorials/ex42a.c.html">src/vec/vec/examples/tutorials/ex42a.c.html</A><BR>
<A HREF="../../../src/mat/examples/tutorials/ex12.c.html">src/mat/examples/tutorials/ex12.c.html</A><BR>
<A HREF="../../../src/dm/examples/tutorials/ex9.c.html">src/dm/examples/tutorials/ex9.c.html</A><BR>
<A HREF="../../../src/ksp/ksp/examples/tutorials/ex10.c.html">src/ksp/ksp/examples/tutorials/ex10.c.html</A><BR>
<A HREF="../../../src/ksp/ksp/examples/tutorials/ex27.c.html">src/ksp/ksp/examples/tutorials/ex27.c.html</A><BR>
<A HREF="../../../src/ksp/ksp/examples/tutorials/ex41.c.html">src/ksp/ksp/examples/tutorials/ex41.c.html</A><BR>
<A HREF="../../../src/snes/examples/tutorials/ex53.c.html">src/snes/examples/tutorials/ex53.c.html</A><BR>
</BODY></HTML>
|