File: VecLoad.html

package info (click to toggle)
petsc 3.7.5%2Bdfsg1-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 163,864 kB
  • ctags: 618,438
  • sloc: ansic: 515,133; python: 29,793; makefile: 20,458; fortran: 18,998; cpp: 6,515; f90: 3,914; sh: 1,012; xml: 621; objc: 445; csh: 240; java: 13
file content (89 lines) | stat: -rw-r--r-- 6,431 bytes parent folder | download
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
83
84
85
86
87
88
89
<!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.7.5 2017-01-01</b></div>
   <div id="bugreport" align=right><a href="mailto:petsc-maint@mcs.anl.gov?subject=Typo or Error in Documentation &body=Please describe the typo or error in the documentation: petsc-3.7.5 v3.7.5 docs/manualpages/Vec/VecLoad.html "><small>Report Typos and Errors</small></a></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 binary and the blocksize of the vector is greater than one then you must provide a unique prefix to
the vector with PetscObjectSetOptionsPrefix((<A HREF="../Sys/PetscObject.html#PetscObject">PetscObject</A>)vec,"uniqueprefix"); BEFORE calling <A HREF="../Vec/VecView.html#VecView">VecView</A>() on the
vector to be stored and then set that same unique prefix on the vector that you pass to <A HREF="../Vec/VecLoad.html#VecLoad">VecLoad</A>(). 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.
<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/ex6.c.html">src/vec/vec/examples/tutorials/ex6.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/dm/examples/tutorials/ex10.c.html">src/dm/examples/tutorials/ex10.c.html</A><BR>
<A HREF="../../../src/dm/examples/tutorials/ex15.c.html">src/dm/examples/tutorials/ex15.c.html</A><BR>
<A HREF="../../../src/ksp/ksp/examples/tutorials/ex10.c.html">src/ksp/ksp/examples/tutorials/ex10.c.html</A><BR>
</BODY></HTML>