File: MatLoad.html

package info (click to toggle)
petsc 2.2.0-4
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 64,404 kB
  • ctags: 284,528
  • sloc: ansic: 223,999; python: 11,758; makefile: 7,707; fortran: 6,327; cpp: 4,104; sh: 3,387; csh: 41; asm: 6
file content (139 lines) | stat: -rw-r--r-- 7,075 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML3.2 EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="DOCTEXT">
<TITLE>MatLoad</TITLE>
</HEAD>
<BODY BGCOLOR="FFFFFF">
<A NAME="MatLoad"><H1>MatLoad</H1></A>
Loads a matrix that has been stored in binary format with <A HREF="../Mat/MatView.html#MatView">MatView</A>().  The matrix format is determined from the options database. Generates a parallel MPI matrix if the communicator has more than one processor.  The default matrix type is AIJ. 
<H3><FONT COLOR="#CC3333">Synopsis</FONT></H3>
<PRE>
#include "petscmat.h"  
int MatLoad(PetscViewer viewer,const MatType outtype,Mat *newmat)
</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>viewer </B></TD><TD>- binary file viewer, created with <A HREF="../Viewer/PetscViewerBinaryOpen.html#PetscViewerBinaryOpen">PetscViewerBinaryOpen</A>()
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>outtype </B></TD><TD>- type of matrix desired, for example <A HREF="../Mat/MATSEQAIJ.html#MATSEQAIJ">MATSEQAIJ</A>,
<A HREF="../Mat/MATMPIROWBS.html#MATMPIROWBS">MATMPIROWBS</A>, etc.  See types in petsc/include/petscmat.h.
</TD></TR></TABLE>
<P>
<H3><FONT COLOR="#CC3333">Output Parameters</FONT></H3>
<DT><B>newmat </B> -new matrix
<br>
<P>
<H3><FONT COLOR="#CC3333">Basic Options Database Keys</FONT></H3>
<TABLE border="0" cellpadding="0" cellspacing="0">
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-matload_type seqaij   </B></TD><TD>- AIJ type
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-matload_type mpiaij   </B></TD><TD>- parallel AIJ type
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-matload_type seqbaij  </B></TD><TD>- block AIJ type
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-matload_type mpibaij  </B></TD><TD>- parallel block AIJ type
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-matload_type seqsbaij </B></TD><TD>- block symmetric AIJ type
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-matload_type mpisbaij </B></TD><TD>- parallel block symmetric AIJ type
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-matload_type seqbdiag </B></TD><TD>- block diagonal type
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-matload_type mpibdiag </B></TD><TD>- parallel block diagonal type
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-matload_type mpirowbs </B></TD><TD>- parallel rowbs type
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-matload_type seqdense </B></TD><TD>- dense type
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-matload_type mpidense </B></TD><TD>- parallel dense type
</TD></TR>
<TR><TD WIDTH=40></TD><TD ALIGN=LEFT VALIGN=TOP><B>-matload_symmetric </B></TD><TD>- matrix in file is symmetric
</TD></TR></TABLE>
<P>
<H3><FONT COLOR="#CC3333">More Options Database Keys</FONT></H3>
Used with block matrix formats (<A HREF="../Mat/MATSEQBAIJ.html#MATSEQBAIJ">MATSEQBAIJ</A>, <A HREF="../Mat/MATMPIBDIAG.html#MATMPIBDIAG">MATMPIBDIAG</A>, ...) to specify
block <A HREF="../Sys/size.html#size">size</A>
<DT><B>-matload_block_size &lt;bs&gt;</B> -
Used to specify block diagonal numbers for <A HREF="../Mat/MATSEQBDIAG.html#MATSEQBDIAG">MATSEQBDIAG</A> and <A HREF="../Mat/MATMPIBDIAG.html#MATMPIBDIAG">MATMPIBDIAG</A> formats
<br>
<DT><B>-matload_bdiag_diags &lt;s1,s2,s3,...&gt;</B> -

<br>
<P>
<H3><FONT COLOR="#CC3333">Notes</FONT></H3>
<A HREF="../Mat/MatLoad.html#MatLoad">MatLoad</A>() automatically loads into the options database any options
given in the file filename.info where filename is the name of the file
that was passed to the <A HREF="../Viewer/PetscViewerBinaryOpen.html#PetscViewerBinaryOpen">PetscViewerBinaryOpen</A>(). The options in the info
file will be ignored if you use the -matload_ignore_info option.
<P>
In parallel, each processor can load a subset of rows (or the
entire matrix).  This routine is especially useful when a large
matrix is stored on disk and only part of it existsis desired on each
processor.  For example, a parallel solver may access only some of
the rows from each processor.  The algorithm used here reads
relatively small blocks of data rather than reading the entire
matrix and then subsetting it.
<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="../Mat/MatLoad.html#MatLoad">MatLoad</A>() and <A HREF="../Mat/MatView.html#MatView">MatView</A>() completely hide these details.
But for anyone who's interested, the standard binary matrix storage
format is
<P>
<pre>
   int    MAT_FILE_COOKIE
</pre>
<pre>
   int    number of rows
</pre>
<pre>
   int    number of columns
</pre>
<pre>
   int    total number of nonzeros
</pre>
<pre>
   int    *number nonzeros in each row
</pre>
<pre>
   int    *column indices of all nonzeros (starting index is zero)
</pre>
<pre>
   <A HREF="../Sys/PetscScalar.html#PetscScalar">PetscScalar</A> *values of all nonzeros
</pre>
<P>
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.
<P>
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.
<P>
<H3><FONT COLOR="#CC3333">Keywords</FONT></H3>
 matrix, load, binary, input
<BR>
<P>
<H3><FONT COLOR="#CC3333">See Also</FONT></H3>
 <A HREF="../Viewer/PetscViewerBinaryOpen.html#PetscViewerBinaryOpen">PetscViewerBinaryOpen</A>(), <A HREF="../Mat/MatView.html#MatView">MatView</A>(), <A HREF="../Vec/VecLoad.html#VecLoad">VecLoad</A>()
<BR>
<P>
<P><B><P><B><FONT COLOR="#CC3333">Level:</FONT></B>beginner
<BR><FONT COLOR="#CC3333">Location:</FONT></B><A HREF="../../../src/mat/utils/matio.c.html#MatLoad">src/mat/utils/matio.c</A>
<BR><A HREF="./index.html">Index of all Mat 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/mat/examples/tutorials/ex1.c.html">src/mat/examples/tutorials/ex1.c.html</A><BR>
<A HREF="../../../src/mat/examples/tutorials/ex4.c.html">src/mat/examples/tutorials/ex4.c.html</A><BR>
<A HREF="../../../src/ksp/examples/tutorials/ex10.c.html">src/ksp/examples/tutorials/ex10.c.html</A><BR>
<A HREF="../../../src/ksp/examples/tutorials/ex27.c.html">src/ksp/examples/tutorials/ex27.c.html</A><BR>
</BODY></HTML>