]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Finished page.
authorschrage <schrage@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 23 Apr 1999 13:12:06 +0000 (13:12 +0000)
committerschrage <schrage@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 23 Apr 1999 13:12:06 +0000 (13:12 +0000)
git-svn-id: https://svn.dealii.org/trunk@1202 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/tutorial/chapter-1.elements/matrix_generation.html

index e0de64eba1544142e9f7634ca946eb8ffeed99bc..09ad3d2352bb5ad55946ffee31f100915706a53a 100644 (file)
 
 <h1>Matrix and Vector Generation</h1>
 
+<h2>Different kinds of matrices</h2>
+<p>
+There are several kinds of matrices we will deal with: 
+</p>
+<ul>
+<li>
+<a href="#full">Full matrices</a>, i.e. matrices where the majority of 
+cells have non-zero values.
+</li>
+<li>
+<a href="#block">Block sparse matrices</a> where the matrix is assumed to 
+consist of blocks on the diagonal.
+</li>
+<li>
+<a href="#sparse">Sparse matrices</a>, i.e. matrices where the majority of 
+cells has zero value.
+</li>
+</ul>
+
+<h3><a name="full">The full matrix</a></h3>
+
+<p>
+The full matrix is assumed to have mostly cells of non-zero value. 
+Therefore it consumes a lot of memory, much more than the other matrix types.
+It is initialized using <code>FullMatrix::reinit(const unsigned
+int rows, const unsigned int cols)</code>.
+</p>
+
+<p class="Example">
+<span class="example">Example:</span> We show the include files you need, 
+the definitions and the function calls. Make sure to use them in their
+appropriate places. This example initializes a full matrix of doubles
+with 100 rows and 50 columns.
+</p>
+<pre class="example">
+<code>
+#include &lt;grid/dof.h&gt;
+#include &lt;lac/fullmatrix.h&gt;
+
+FullMatrix&lt;double&gt; A;
+
+A.reinit(100,50);
+</code>
+</pre>
+
+
+<h3><a name="sparse">The sparse matrix</a></h3>
+
+<p>
+A sparse matrix is a matrix with mostly zero elements. In other words,
+it is possible to store this matrix efficiently, which can be important
+for large systems of equations. Before generating a sparse matrix you 
+will have to generate a 
+<a href="matrix_structure.html">sparse matrix structure</a> 
+to initialize the sparse matrix with. This is simply due to the fact that
+before you can generate a memory-efficient matrix for your special
+problem you need information about the matrix structure, i.e. where
+the matrix has non-zero entries.
+</p>
 
 
 <p class="Example">
@@ -39,7 +98,7 @@ DoFHandler&lt;dim&gt; dof;
 
 smstruct.reinit(dof.n_dofs(),dof.n_dofs(),dof.max_couplings_between_dofs());
 
-// If you grid is locally refined, <a href="matrix_structure.html#smstruct">condense the hanging nodes</a> into the
+// If your grid is locally refined, <a href="matrix_structure.html#smstruct">condense the hanging nodes</a> into the
 // structure.
 
 smstruct.compress();
@@ -48,6 +107,48 @@ sm.reinit(smstruct);
 </code>
 </pre>
 
+<h3><a name="block">The block sparse matrix</a></h3>
+
+<p>
+A block matrix is assumed to consist of blocks on the diagonal with all
+the blocks having the same size.
+It is initialized using 
+<code>BlockSparseMatrix::reinit(const SparseMatrixStruct &amp;sparsity)</code>
+Since this is a sparse matrix, i.e. a matrix that can be
+stored efficiently, we need to generate a matrix structure first, like for the 
+sparse matrix. In fact, the block sparse matrix is just a specialization of
+the sparse matrix.
+</p>
+
+<p class="Example">
+<span class="example">Example:</span> We show the include files you need, 
+the definitions and the function calls. Make sure to use them in their
+appropriate places. 
+</p>
+<pre class="example">
+<code>
+#include &lt;grid/dof.h&gt;
+#include &lt;lac/blocksparsematrix.h&gt;
+
+int dim=2; // 2 Dimensions, could also be three
+SparseMatrixStruct&lt;double&gt; smstruct;
+DoFHandler&lt;dim&gt; dof;
+BlockSparseMatrix&lt;double&gt; A;
+
+
+// Your degrees of freedom must already be distributed
+
+smstruct.reinit(dof.n_dofs(),dof.n_dofs(),dof.max_couplings_between_dofs());
+
+// If your grid is locally refined, <a href="matrix_structure.html#smstruct">condense the hanging nodes</a> into the
+// structure.
+
+smstruct.compress();
+
+A.reinit(smstruct);
+</code>
+</pre>
+
 
 <!-- Page Foot -->
 <hr>

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.