<code>void DoFHandler::distribute_dofs(const FiniteElement<dim> &)</code><br>
The argument to <code>distribute_dofs</code> is a finite element that describes
how many degrees of freedom are located on vertices, lines etc.
+(<code>FiniteElement</code> objects have much more functionality than only storing
+these numbers. This functionality is discussed partly in the chapter on
+<a href="matrix_generation.html">matrix and vector
+generation</a>
+and partly in URL_NEEDS_TO_BE_SET.)
<code>distribute_dofs</code> works its way through the triangulation cell by
cell, starting at the coarsest level, and numbers every degree of freedom that is not yet numbered.
For non-multigrid algorithms it considers only active cells, i.e. cells
The hyper-L is mainly of use in testing grid refinement, error estimates etc.
Boundary conditions of the form <code>u=g</code> on the faces of the original
hypercube and <code>∂<sub>n</sub>u=0</code> on the "inner" faces resulting
-from the smaller hypercube taken away.
+from the smaller hypercube taken away are chosen, this will usually lead to
+a singular solution because of the reentrant corner; these singularities
+can be used to test the efficiency of error estimators.
</p>
<p class="example">
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
+ "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html>
+<head>
+<!-- deal.II tutorial template
+ Jan Schrage <schrage@gaia.iwr.uni-heidelberg.de> 1999
+-->
+
+<title>Hanging Nodes</title>
+ <link href="../dealtut.css" rel="StyleSheet" title="deal.II Tutorial">
+ <meta name="author" content="Jan Schrage <schrage@gaia.iwr.uni-heidelberg.de>">
+ <meta name="keywords" content="deal.II,deal.II tutorial,deal II">
+</head>
+
+<!-- Page Body -->
+<body lang="en">
+
+<h1>Hanging Nodes</h1>
+
+
+<!-- Page Foot -->
+<hr>
+<table class="navbar">
+<tr>
+ <td>
+ <a href="toc.html">Back to this chapter's index</a>
+ </td>
+ <td>
+ <a href="../index.html" target="_top">Back to the tutorial index</a>
+ </td>
+</tr>
+</table>
+<hr>
+<address>
+<a href="mailto:schrage@gaia.iwr.uni-heidelberg.de">Jan Schrage</a></address>
+<p>
+Last modified: $Date$
+</p>
+</body>
+</html>
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
+ "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html>
+<head>
+<!-- deal.II tutorial template
+ Jan Schrage <schrage@gaia.iwr.uni-heidelberg.de> 1999
+-->
+
+<title>Matrix and Vector Generation</title>
+ <link href="../dealtut.css" rel="StyleSheet" title="deal.II Tutorial">
+ <meta name="author" content="Jan Schrage <schrage@gaia.iwr.uni-heidelberg.de>">
+ <meta name="keywords" content="deal.II,deal.II tutorial,deal II">
+</head>
+
+<!-- Page Body -->
+<body lang="en">
+
+<h1>Matrix and Vector Generation</h1>
+
+
+
+<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 sparse square matrix structure.
+</p>
+<pre class="example">
+<code>
+#include <grid/dof.h>
+#include <lac/sparsematrix.h>
+
+
+int dim=2; // For example
+SparseMatrixStruct<double> smstruct;
+SparseMatrix<double> sm;
+DoFHandler<dim> dof;
+
+// Your degrees of freedom must already be distributed
+
+smstruct.reinit(dof.n_dofs(),dof.n_dofs(),dof.max_couplings_between_dofs());
+sm.reinit(smstruct);
+</code>
+</pre>
+
+
+<!-- Page Foot -->
+<hr>
+<table class="navbar">
+<tr>
+ <td>
+ <a href="toc.html">Back to this chapter's index</a>
+ </td>
+ <td>
+ <a href="../index.html" target="_top">Back to the tutorial index</a>
+ </td>
+</tr>
+</table>
+<hr>
+<address>
+<a href="mailto:schrage@gaia.iwr.uni-heidelberg.de">Jan Schrage</a></address>
+<p>
+Last modified: $Date$
+</p>
+</body>
+</html>
need to ascertain where the components of your matrix are non-zero
and generate a structure for storing the matrix accordingly.
This structure
-is then used to actually initialize the matrix.
+is then used to actually initialize the matrix, i.e.
+tell the matrix for which elements to allocate memory.
</p>
<h3>The Standard Sparse Matrix</h3>
<h3>Compression of Matrix Structures</h3>
<p>
-Sparse matrix structure can (and indeed must) be compressed. They can be
-compressed because it saves memory and they must be compressed because
-the classes dealing with sparse matrices require it.
+Sparse matrix structures can (and indeed must) be compressed before they are used
+in objects of the class <code>SparseMatrix<></code> that actually hold the matrix
+data. The reason for this is the way matrix structures and matrices are generated:
+<ul>
+ <li>Initially a fixed number of non-zero entries is allocated for each matrix row.
+ Usually, though, rows will have much less entries than this maximum number. Rows
+ rows corresponding to degrees of freedom
+ on cells with hanging nodes have more entries than rows corresponding to degrees of freedom
+ in regular regions of the grid.
+ </li>
+ <li> When you compress the matrix structure
+ you stop adding new non-zero entries and all unused entries in each row
+ are deleted. Thus memory is saved.
+ </li>
+ <li> Only now are you allowed to associate this matrix structure
+ to a matrix object which then allocates memory for each non-zero entry,
+ rather than for the maximum number of non-zero entries of each row.
+ </li>
+</ul>
+
The appropriate function is <code>void SparseMatrixStruct::compress()</code>.
+</p>
<p class="Example">
<span class="example">Example:</span> Starting from <a href="#smstruct">the example above</a>, we
<p>
<b><a href="parameters.html">Parameter Input</a></b>
</p>
- <p>explaining how to use a parameter file for configuration
- of your program.
+ <p>explaining how to use a parameter file for configuring
+ your program.
</p>
</li>
</ol>
hanging_nodes.clear();
dof.make_constraint_matrix(hanging_nodes);
hanging_nodes.condense(matrix_structure);
+ matrix_structure.compress();
// The problem has the form Au=f.
A.reinit(matrix_structure);
for (unsigned step = 0; step < 3 ; ++step)
{
- if (!step)
+ if (step == 0)
lap.remesh(firstgrid);
else
{
-body { bgcolor: white; background-color: white; }
+body { background-image: none;
+ background-color: white;
+ }
+frameset { background-color: white;
+ border-color: white;
+ }
span.parhead { font-weight: bold;
}