<h1>Results</h1>

The program has, after having been run, produced two files of
DoF locations and sparsity patterns each (once for the original numbering
and once after renumbering), along with one mesh file.

Let us start with the DoF locations. There is no particularly convenient
program to visualize this kind of information, but we can resort to
<a href="http://www.gnuplot.info/">GNUPLOT</a> (one of the simpler visualization
programs; maybe not the easiest to use since it is command line driven, but
also universally available on all Linux and other Unix-like systems). The
command that produces the following pictures reads as follows:
```
plot [-0.1:2.1][-1.1:1.1] "mesh.gnuplot" with lines, "dof-locations-1.gnuplot" using 1:2:3 with labels point offset .3,.2 font "4,6"
```
This may be cryptic, but what exactly this does is also not particularly important and you shouldn't
spend too much time understanding what it does. Rather, the important part is
to look at what we get as output:
<table style="width:60%" align="center">
  <tr>
    <td><img src="https://www.dealii.org/images/steps/developer/step-2.dof-locations-1.png" alt=""></td>
    <td><img src="https://www.dealii.org/images/steps/developer/step-2.dof-locations-2.png" alt=""></td>
  </tr>
</table>
What these figures show is (i) a numeric label attached to each vertex -- the
DoF index, and (ii) that the original enumeration on the left differs from
the renumbered one on the right. Which of the two is "better" is of course
a different question (with the answer depending on what we want to do
with these degrees of freedom); the important point is that for the
same mesh, one can come up with many different enumerations of the degrees
of freedom.

As for the sparsity patterns, we can visualize these by opening the
<code>.svg</code> files in a web browser. The pictures below
represent the matrix, and every red square denotes an entry which
might be nonzero. (Whether the entry actually is
zero or not depends on the equation under consideration, but the
indicated positions in the matrix tell us which shape functions can
and which can't couple when discretizing a local, i.e. differential,
equation.)
<table style="width:60%" align="center">
  <tr>
    <td><img src="https://www.dealii.org/images/steps/developer/step-2.sparsity-1.svg" alt=""></td>
    <td><img src="https://www.dealii.org/images/steps/developer/step-2.sparsity-2.svg" alt=""></td>
  </tr>
</table>

The different regions in the left picture, indicated by kinks in the lines and
single dots on the left and top, represent the degrees of
freedom on the different refinement levels of the triangulation.  As
can be seen in the right picture, the sparsity pattern is much better
clustered around the main diagonal of the matrix after
renumbering. Although this might not be apparent, the number of
nonzero entries is the same in both pictures, of course.



<h3> Possibilities for extensions </h3>

Just as with step-1, you may want to play with the program a bit to
familiarize yourself with deal.II. For example, in the
<code>distribute_dofs</code> function, we use linear finite elements
(that's what the argument "1" to the FE_Q object is). Explore how the
sparsity pattern changes if you use higher order elements, for example
cubic or quintic ones (by using 3 and 5 as the respective arguments).
You might also want to see where DoFs are now located -- but for that
you likely want to work with a mesh with fewer cells because DoFs
are now also located on edges and in the interior of cells.

You could also explore how the sparsity pattern changes by refining
the mesh. You will see that not only the size of the matrix
changes, but also its bandwidth (the distance from the diagonal of
those nonzero elements of the matrix that are farthest away from the
diagonal), though the ratio of bandwidth to size typically shrinks,
i.e. the matrix clusters more around the diagonal.

Another idea of experiments would be to try other renumbering
strategies than Cuthill-McKee from the DoFRenumbering namespace and see how
they affect the sparsity pattern.

You can also visualize the output using <a
href="http://www.gnuplot.info/">GNUPLOT</a> (which we have already
used above) by
changing from <code>print_svg()</code> to <code>print_gnuplot()</code>
in <code>distribute_dofs()</code> and <code>renumber_dofs()</code> (and
using the file ending `.gnuplot` instead of `.svg`):
@code
examples/\step-2> gnuplot

        G N U P L O T
        Version 3.7 patchlevel 3
        last modified Thu Dec 12 13:00:00 GMT 2002
        System: Linux 2.6.11.4-21.10-default

        Copyright(C) 1986 - 1993, 1998 - 2002
        Thomas Williams, Colin Kelley and many others

        Type `help` to access the on-line reference manual
        The gnuplot FAQ is available from
        http://www.gnuplot.info/gnuplot-faq.html

        Send comments and requests for help to <info-gnuplot@dartmouth.edu>
        Send bugs, suggestions and mods to <bug-gnuplot@dartmouth.edu>


Terminal type set to 'x11'
gnuplot> set style data points
gnuplot> plot "sparsity-pattern-1.gnuplot"
@endcode
