* other basis functions on a cell adjacent to the boundary vanish at the
* boundary itself, except for those which are located on the boundary.
*
- * @author Wolfgang Bangerth and others, 1999
+ * @author Wolfgang Bangerth and others, 1998, 1999
*/
class DoFTools
{
-
+/**
+ * This class manages degrees of freedom for a multilevel hierarchy of
+ * grids. It does mostly the same as does the #DoDHandler# class, but
+ * it uses a separate enumeration of the degrees of freedom on each
+ * level. For example, a vertex has several DoF numbers, one for each
+ * level of the triangulation on which it exists.
+ *
+ * At present, multilevel algorithms are not fully functional, so this
+ * documentation is still very brief.
+//TODO: Extend MGDoFHandler doc
+ *
+ * @author Wolfgang Bangerth, 1998, 1999
+ */
template <int dim>
-class MGDoFHandler
- :
- public DoFHandler<dim>
+class MGDoFHandler : public DoFHandler<dim>
{
public:
typedef typename MGDoFDimensionInfo<dim>::raw_line_iterator raw_line_iterator;
void renumber_dofs (const unsigned int level,
const vector<int> &new_numbers);
- /**
- * Write the sparsity structure of the
- * matrix belonging to the specified
- * #level# including constrained
- * degrees of freedom into the
- * matrix structure. The sparsity pattern
- * does not include entries introduced by
- * the elimination of constrained nodes.
- * The sparsity
- * pattern is not compressed, since if
- * you want to call
- * #ConstraintMatrix::condense(1)#
- * afterwards, new entries have to be
- * added. However, if you don't want to call
- * #ConstraintMatrix::condense(1)#, you
- * have to compress the matrix yourself,
- * using #SparseMatrixStruct::compress()#.
- */
- void make_sparsity_pattern (const unsigned int level,
- SparseMatrixStruct &sparsity) const;
-
/*--------------------------------------*/
/**
--- /dev/null
+/*---------------------------- mg_dof_tools.h ---------------------------*/
+/* $Id$ */
+#ifndef __mg_dof_tools_H
+#define __mg_dof_tools_H
+/*---------------------------- mg_dof_tools.h ---------------------------*/
+
+
+#include <lac/forward_declarations.h>
+#include <grid/forward_declarations.h>
+
+
+/**
+ * This is a collection of functions operating on, and manipulating
+ * the numbers of degrees of freedom in a multilevel triangulation. It
+ * is similar in purpose and function to the #DoFTools# class, but
+ * operates on #MGDoFHandler# objects instead of #DoFHandler#
+ * objects. See there and the documentation of the member functions
+ * for more information.
+ *
+ * All member functions are static, so there is no need to create an
+ * object of class #DoFTools#.
+ *
+ * @author Wolfgang Bangerth and others, 1999
+ */
+class MGDoFTools
+{
+ public:
+ /**
+ * Write the sparsity structure
+ * of the matrix belonging to the
+ * specified #level# including
+ * constrained degrees of freedom
+ * into the matrix structure. The
+ * sparsity pattern does not
+ * include entries introduced by
+ * the elimination of constrained
+ * nodes. The sparsity pattern
+ * is not compressed, since if
+ * you want to call
+ * #ConstraintMatrix::condense(1)#
+ * afterwards, new entries have
+ * to be added. However, if you
+ * don't want to call
+ * #ConstraintMatrix::condense(1)#,
+ * you have to compress the
+ * matrix yourself, using
+ * #SparseMatrixStruct::compress()#.
+ */
+ template <int dim>
+ static void
+ make_sparsity_pattern (const MGDoFHandler<dim> &dof_handler,
+ const unsigned int level,
+ SparseMatrixStruct &sparsity);
+};
+
+
+
+/*---------------------------- mg_dof_tools.h ---------------------------*/
+/* end of #ifndef __mg_dof_tools_H */
+#endif
+/*---------------------------- mg_dof_tools.h ---------------------------*/
-
+/**
+ * This class manages degrees of freedom for a multilevel hierarchy of
+ * grids. It does mostly the same as does the #DoDHandler# class, but
+ * it uses a separate enumeration of the degrees of freedom on each
+ * level. For example, a vertex has several DoF numbers, one for each
+ * level of the triangulation on which it exists.
+ *
+ * At present, multilevel algorithms are not fully functional, so this
+ * documentation is still very brief.
+//TODO: Extend MGDoFHandler doc
+ *
+ * @author Wolfgang Bangerth, 1998, 1999
+ */
template <int dim>
-class MGDoFHandler
- :
- public DoFHandler<dim>
+class MGDoFHandler : public DoFHandler<dim>
{
public:
typedef typename MGDoFDimensionInfo<dim>::raw_line_iterator raw_line_iterator;
void renumber_dofs (const unsigned int level,
const vector<int> &new_numbers);
- /**
- * Write the sparsity structure of the
- * matrix belonging to the specified
- * #level# including constrained
- * degrees of freedom into the
- * matrix structure. The sparsity pattern
- * does not include entries introduced by
- * the elimination of constrained nodes.
- * The sparsity
- * pattern is not compressed, since if
- * you want to call
- * #ConstraintMatrix::condense(1)#
- * afterwards, new entries have to be
- * added. However, if you don't want to call
- * #ConstraintMatrix::condense(1)#, you
- * have to compress the matrix yourself,
- * using #SparseMatrixStruct::compress()#.
- */
- void make_sparsity_pattern (const unsigned int level,
- SparseMatrixStruct &sparsity) const;
-
/*--------------------------------------*/
/**
--- /dev/null
+/*---------------------------- mg_dof_tools.h ---------------------------*/
+/* $Id$ */
+#ifndef __mg_dof_tools_H
+#define __mg_dof_tools_H
+/*---------------------------- mg_dof_tools.h ---------------------------*/
+
+
+#include <lac/forward_declarations.h>
+#include <grid/forward_declarations.h>
+
+
+/**
+ * This is a collection of functions operating on, and manipulating
+ * the numbers of degrees of freedom in a multilevel triangulation. It
+ * is similar in purpose and function to the #DoFTools# class, but
+ * operates on #MGDoFHandler# objects instead of #DoFHandler#
+ * objects. See there and the documentation of the member functions
+ * for more information.
+ *
+ * All member functions are static, so there is no need to create an
+ * object of class #DoFTools#.
+ *
+ * @author Wolfgang Bangerth and others, 1999
+ */
+class MGDoFTools
+{
+ public:
+ /**
+ * Write the sparsity structure
+ * of the matrix belonging to the
+ * specified #level# including
+ * constrained degrees of freedom
+ * into the matrix structure. The
+ * sparsity pattern does not
+ * include entries introduced by
+ * the elimination of constrained
+ * nodes. The sparsity pattern
+ * is not compressed, since if
+ * you want to call
+ * #ConstraintMatrix::condense(1)#
+ * afterwards, new entries have
+ * to be added. However, if you
+ * don't want to call
+ * #ConstraintMatrix::condense(1)#,
+ * you have to compress the
+ * matrix yourself, using
+ * #SparseMatrixStruct::compress()#.
+ */
+ template <int dim>
+ static void
+ make_sparsity_pattern (const MGDoFHandler<dim> &dof_handler,
+ const unsigned int level,
+ SparseMatrixStruct &sparsity);
+};
+
+
+
+/*---------------------------- mg_dof_tools.h ---------------------------*/
+/* end of #ifndef __mg_dof_tools_H */
+#endif
+/*---------------------------- mg_dof_tools.h ---------------------------*/
/* $Id$ */
+#include <lac/sparse_matrix.h>
#include <dofs/dof_accessor.h>
#include <grid/tria_iterator.h>
#include <dofs/dof_handler.h>
#include <dofs/mg_dof_handler.h>
#include <dofs/dof_constraints.h>
+#include <dofs/dof_tools.h>
+#include <dofs/mg_dof_tools.h>
#include <fe/fe.h>
#include <numerics/dof_renumbering.h>
-#include <dofs/dof_tools.h>
-#include <lac/sparse_matrix.h>
#include <vector>
#include <map>
// make the connection graph
SparseMatrixStruct sparsity (dof_handler.n_dofs(level),
dof_handler.max_couplings_between_dofs());
- dof_handler.make_sparsity_pattern (level, sparsity);
+ MGDoFTools::make_sparsity_pattern (dof_handler, level, sparsity);
const int n_dofs = sparsity.n_rows();
// store the new dof numbers; -1 means
-template <int dim>
-void MGDoFHandler<dim>::make_sparsity_pattern (const unsigned int level,
- SparseMatrixStruct &sparsity) const {
- Assert (selected_fe != 0, ExcNoFESelected());
- Assert (sparsity.n_rows() == n_dofs(level),
- ExcDimensionMismatch (sparsity.n_rows(), n_dofs(level)));
- Assert (sparsity.n_cols() == n_dofs(level),
- ExcDimensionMismatch (sparsity.n_cols(), n_dofs(level)));
-
- const unsigned int dofs_per_cell = selected_fe->dofs_per_cell;
- vector<int> dofs_on_this_cell(dofs_per_cell);
- cell_iterator cell = begin(level),
- endc = end(level);
- for (; cell!=endc; ++cell)
- {
- cell->get_mg_dof_indices (dofs_on_this_cell);
- // make sparsity pattern for this cell
- for (unsigned int i=0; i<dofs_per_cell; ++i)
- for (unsigned int j=0; j<dofs_per_cell; ++j)
- sparsity.add (dofs_on_this_cell[i],
- dofs_on_this_cell[j]);
- };
-};
-
-
-
#if deal_II_dimension == 1
template <>
--- /dev/null
+/* $Id$ */
+
+#include <lac/sparse_matrix.h>
+#include <dofs/mg_dof_handler.h>
+#include <dofs/mg_dof_accessor.h>
+#include <grid/tria_iterator.h>
+#include <dofs/mg_dof_tools.h>
+#include <fe/fe.h>
+
+
+template <int dim>
+void MGDoFTools::make_sparsity_pattern (const MGDoFHandler<dim> &mg_dof_handler,
+ const unsigned int level,
+ SparseMatrixStruct &sparsity)
+{
+ Assert (sparsity.n_rows() == mg_dof_handler.n_dofs(level),
+ ExcDimensionMismatch (sparsity.n_rows(), mg_dof_handler.n_dofs(level)));
+ Assert (sparsity.n_cols() == mg_dof_handler.n_dofs(level),
+ ExcDimensionMismatch (sparsity.n_cols(), mg_dof_handler.n_dofs(level)));
+
+ const unsigned int dofs_per_cell = mg_dof_handler.get_fe().dofs_per_cell;
+ vector<int> dofs_on_this_cell(dofs_per_cell);
+ MGDoFHandler<dim>::cell_iterator cell = mg_dof_handler.begin(level),
+ endc = mg_dof_handler.end(level);
+ for (; cell!=endc; ++cell)
+ {
+ cell->get_mg_dof_indices (dofs_on_this_cell);
+ // make sparsity pattern for this cell
+ for (unsigned int i=0; i<dofs_per_cell; ++i)
+ for (unsigned int j=0; j<dofs_per_cell; ++j)
+ sparsity.add (dofs_on_this_cell[i],
+ dofs_on_this_cell[j]);
+ };
+};
+
+
+
+// explicit instantiations
+template void MGDoFTools::make_sparsity_pattern (const MGDoFHandler<deal_II_dimension> &,
+ const unsigned int,
+ SparseMatrixStruct &);
+
-template <int dim>
-void MGDoFHandler<dim>::make_sparsity_pattern (const unsigned int level,
- SparseMatrixStruct &sparsity) const {
- Assert (selected_fe != 0, ExcNoFESelected());
- Assert (sparsity.n_rows() == n_dofs(level),
- ExcDimensionMismatch (sparsity.n_rows(), n_dofs(level)));
- Assert (sparsity.n_cols() == n_dofs(level),
- ExcDimensionMismatch (sparsity.n_cols(), n_dofs(level)));
-
- const unsigned int dofs_per_cell = selected_fe->dofs_per_cell;
- vector<int> dofs_on_this_cell(dofs_per_cell);
- cell_iterator cell = begin(level),
- endc = end(level);
- for (; cell!=endc; ++cell)
- {
- cell->get_mg_dof_indices (dofs_on_this_cell);
- // make sparsity pattern for this cell
- for (unsigned int i=0; i<dofs_per_cell; ++i)
- for (unsigned int j=0; j<dofs_per_cell; ++j)
- sparsity.add (dofs_on_this_cell[i],
- dofs_on_this_cell[j]);
- };
-};
-
-
-
#if deal_II_dimension == 1
template <>
--- /dev/null
+/* $Id$ */
+
+#include <lac/sparse_matrix.h>
+#include <dofs/mg_dof_handler.h>
+#include <dofs/mg_dof_accessor.h>
+#include <grid/tria_iterator.h>
+#include <dofs/mg_dof_tools.h>
+#include <fe/fe.h>
+
+
+template <int dim>
+void MGDoFTools::make_sparsity_pattern (const MGDoFHandler<dim> &mg_dof_handler,
+ const unsigned int level,
+ SparseMatrixStruct &sparsity)
+{
+ Assert (sparsity.n_rows() == mg_dof_handler.n_dofs(level),
+ ExcDimensionMismatch (sparsity.n_rows(), mg_dof_handler.n_dofs(level)));
+ Assert (sparsity.n_cols() == mg_dof_handler.n_dofs(level),
+ ExcDimensionMismatch (sparsity.n_cols(), mg_dof_handler.n_dofs(level)));
+
+ const unsigned int dofs_per_cell = mg_dof_handler.get_fe().dofs_per_cell;
+ vector<int> dofs_on_this_cell(dofs_per_cell);
+ MGDoFHandler<dim>::cell_iterator cell = mg_dof_handler.begin(level),
+ endc = mg_dof_handler.end(level);
+ for (; cell!=endc; ++cell)
+ {
+ cell->get_mg_dof_indices (dofs_on_this_cell);
+ // make sparsity pattern for this cell
+ for (unsigned int i=0; i<dofs_per_cell; ++i)
+ for (unsigned int j=0; j<dofs_per_cell; ++j)
+ sparsity.add (dofs_on_this_cell[i],
+ dofs_on_this_cell[j]);
+ };
+};
+
+
+
+// explicit instantiations
+template void MGDoFTools::make_sparsity_pattern (const MGDoFHandler<deal_II_dimension> &,
+ const unsigned int,
+ SparseMatrixStruct &);
+
#include <numerics/multigrid.templates.h>
#include <numerics/mg_smoother.h>
#include <dofs/dof_tools.h>
+#include <dofs/mg_dof_tools.h>
#include "helmholtz.h"
{
mgstruct[i].reinit(mgdof.n_dofs(i), mgdof.n_dofs(i),
mgdof.max_couplings_between_dofs());
- mgdof.make_sparsity_pattern(i, mgstruct[i]);
+ MGDoFTools::make_sparsity_pattern(mgdof, i, mgstruct[i]);
mgstruct[i].compress();
mgA[i].reinit(mgstruct[i]);
#include <numerics/mg_smoother.h>
#include <numerics/multigrid.templates.h>
#include <dofs/dof_tools.h>
+#include <dofs/mg_dof_tools.h>
#include <fstream>
{
mgstruct[i].reinit(mgdof.n_dofs(i), mgdof.n_dofs(i),
mgdof.max_couplings_between_dofs());
- mgdof.make_sparsity_pattern(i, mgstruct[i]);
+ MGDoFTools::make_sparsity_pattern(mgdof, i, mgstruct[i]);
mgstruct[i].compress();
mgA[i].reinit(mgstruct[i]);