BoundaryFct bfct;
dirichlet_bc[0]=&bfct;
VectorTools<2>::interpolate_boundary_values(dof,dirichlet_bc,fe,boundary,boundary_values);
-u.reinit(f);
+u.reinit(f.size());
MatrixTools<2>::apply_boundary_values(boundary_values,A,u,f);
</code></pre>
<p>
<code>bfct</code>, its relation to boundaries <code>dirichlet_bc</code> and
the triangulation <code>dof, fe</code> and returns a
mapping <code>boundary_values</code> that maps values instead of functions
-to our boundaries. The function looks at <em>all</em> the boundaries. All we
+to our boundaries. The function looks at all the boundaries the index
+of which is listed in <code>dirichlet_bc</code> (in this example, all
+the boundaries with indicator 0). All we
ever need to do is specify the initial triangulation.
</li>
<li><code>apply_boundary_values</code> subsequently takes that mapping and
#include <lac/sparsematrix.h>
#include <grid/dof_constraints.h>
-int dim=2; // Work in two dimensions, could also be three
+const unsigned int dim=2; // Work in two dimensions, could also be three
SparseMatrixStruct<double> sparsity_pattern;
DoFHandler<dim> dof;
ConstraintMatrix<dim> hanging_nodes;
hanging_nodes.clear();
dof.make_sparsity_pattern(sparsity_pattern);
dof.make_hanging_nodes_constraints(hanging_nodes);
-dof.constraints.close();
+hanging_nodes.close();
hanging_nodes.condense(matrix_structure);
</code>
<code>void DoFHandler::renumber_dofs(const RenumberingMethod method,const bool use_constraints=false, const vector<int> &starting_points=vector<int>())</code><br>
or alternatively, the easier to use<br>
<code>void DoFHandler::renumber_dofs(const RenumberingMethod method)</code><br>
-The methods available are <code>Cuthill_McKey</code> and <code>reverse_Cuthill_McKey</code>. Both algorithms are usually better than the one used
+The methods available are <code>Cuthill_McKee</code> and <code>reverse_Cuthill_McKee</code>. Both algorithms are usually better than the one used
by <code>distribute_dofs</code> and neither is optimal (there is no algorithm
that accomplishes optimal results within a reasonable amount of time).
Both algorithms require a good index to start with to achieve good results.
<span class="example">Example:</span> We use the definitions from the
<a href="#ex_distribute">first example</a> given above. We renumber our
degrees of freedom with the
-<code>Cuthill_McKey</code> method.
+<code>Cuthill_McKee</code> method.
</p>
<pre class="example">
<code>
-dof.renumber_dofs(Cuthill_McKey);
+dof.renumber_dofs(Cuthill_McKee);
</code>
</pre>
<code>
#include <grid/tria.h>
-int dim=2; // Two dimensions; to create a cube set to three
+const unsigned int dim=2; // Two dimensions; to create a cube set to three
Triangulation<dim> tr;
tr.create_hypercube(-1,1);
#include <grid/tria.h>
#include <base/point.h>
-int dim=2; // For example
+const unsigned int dim=2; // For example
Triangulation<dim> tr;
Point<dim> centre(1,0); // Taking (1,0) as the centre of the ball
<code>
#include <grid/tria.h>
-int dim=2; // For example
+const unsigned int dim=2; // For example
Triangulation<dim> tr;
tr.create_hyper_L(-1,1);
</li>
<li>
<a href="#sparse">Sparse matrices</a>, i.e. matrices where the majority of
-cells has zero value.
+cells has zero value; these zeroes are not stored in order to save memory.
</li>
</ul>
<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.
+appropriate places. This example initializes two full matrices of doubles
+with 100 rows and 50 columns in two different ways.
</p>
<pre class="example">
<code>
FullMatrix<double> A;
A.reinit(100,50);
+
+// or, alternatively (important for const objects):
+
+FullMatrix<double> B(100,50);
+
</code>
</pre>
#include <lac/sparsematrix.h>
-int dim=2; // For example
+const unsigned int dim=2; // For example
SparseMatrixStruct<double> sparsity_pattern;
-SparseMatrix<double> sm;
+SparseMatrix<double> sparse_matrix;
DoFHandler<dim> dof;
// Your degrees of freedom must already be distributed
sparsity_pattern.compress();
-sm.reinit(sparsity_pattern);
+sparse_matrix.reinit(sparsity_pattern);
</code>
</pre>
in one row.
This number can be calculated with
<code>int DoFHandler::max_couplings_between_dofs()</code>.
+<em>Beware: This function was written to cope with refined grids only !
+If your grid consists exclusively of cells next to boundaries its
+return value will be wrong.</em>
This matrix structure can then be used to generate a matrix using
<code>void SparseMatrix::reinit(const SparseMatrixStruct &sparsity)</code>.
In cases of locally refined grids you will also need to take care of the constraints to your
#include <lac/sparsematrix.h>
-int dim=2; // For example
+const unsigned int dim=2; // For example
SparseMatrixStruct<double> sparsity_pattern;
DoFHandler<dim> dof;
ConstraintMatrix hanging_nodes; // Only necessary for locally refined grids
<p class="Example">
<span class="example">Example:</span>
The two lines below calculate trial functions for the two-dimensional finite element <code>fe</code> and
-for its faces using Gaussian quadrature. The first line calculates the trial
-function for the finite element associated with the degree of freedom <code>dof</code>,
-updating the values of the gradients and of the Jacobi determinant multiplied by a
-weight function given by the quadrature <code>qc</code>. The second line
-does the same for the faces of the finite element, updating the <code>JxW</code>
-values and the quadrature points.
+for its faces using Gaussian quadrature. The first line initializes
+an object for the trial function of
+function for the finite element associated with the degree of freedom
+handler <code>dof</code>, telling it to
+update the values of the gradients and of the Jacobi determinant
+multiplied by a
+weight function given by the quadrature <code>qc</code>
+whenever <code>fe_values.reinit(fe)</code> is called. The second line
+does the same for the faces of the finite element, telling it to update the
+<code>JxW</code> values and the quadrature points.
</p>
<pre class="example">
<code>
-// Calculate the trial functions on the cell faces.
+// Initialize the trial functions on the cell faces.
FEValues<2> fevalues(fe, qc, UpdateFlags(update_gradients |
update_JxW_values));
FEFaceValues<2> ffvalues(fe, qf,