const bool use_constraints = false,
const vector<int> &starting_points = vector<int>());
+ /**
+ * 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 #dSMatrixStruct::compress()#.
+ */
+ void make_sparsity_pattern (const unsigned int level,
+ dSMatrixStruct &sparsity) const;
/*--------------------------------------*/
/*@}*/
/*---------------------------------------*/
+
+ /**
+ * Return the number of degrees of freedom
+ * on the specified level.
+ * Included in this number are those
+ * DoFs which are constrained by
+ * hanging nodes.
+ */
+ unsigned int n_dofs (const unsigned int level) const;
+
+ /**
+ * Exception.
+ */
+ DeclException1 (ExcInvalidLevel,
+ int,
+ << "The level index " << arg1 << "was not in the valid range.");
private:
const bool use_constraints = false,
const vector<int> &starting_points = vector<int>());
+ /**
+ * 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 #dSMatrixStruct::compress()#.
+ */
+ void make_sparsity_pattern (const unsigned int level,
+ dSMatrixStruct &sparsity) const;
/*--------------------------------------*/
/*@}*/
/*---------------------------------------*/
+
+ /**
+ * Return the number of degrees of freedom
+ * on the specified level.
+ * Included in this number are those
+ * DoFs which are constrained by
+ * hanging nodes.
+ */
+ unsigned int n_dofs (const unsigned int level) const;
+
+ /**
+ * Exception.
+ */
+ DeclException1 (ExcInvalidLevel,
+ int,
+ << "The level index " << arg1 << "was not in the valid range.");
private:
#include <grid/tria.h>
#include <grid/geometry_info.h>
#include <fe/fe.h>
-
+#include <lac/dsmatrix.h>
/* ------------------------ MGVertexDoFs ----------------------------------- */
+template <int dim>
+unsigned int MGDoFHandler<dim>::n_dofs (const unsigned int level) const {
+ Assert (level < mg_used_dofs.size(), ExcInvalidLevel(level));
+
+ return mg_used_dofs[level];
+};
+
+
+
+template <int dim>
+void MGDoFHandler<dim>::make_sparsity_pattern (const unsigned int level,
+ dSMatrixStruct &sparsity) const {
+ Assert (selected_fe != 0, ExcNoFESelected());
+ Assert (sparsity.n_rows() == n_dofs(level),
+ ExcDifferentDimensions (sparsity.n_rows(), n_dofs(level)));
+ Assert (sparsity.n_cols() == n_dofs(level),
+ ExcDifferentDimensions (sparsity.n_cols(), n_dofs(level)));
+
+ const unsigned int total_dofs = selected_fe->total_dofs;
+ vector<int> dofs_on_this_cell(total_dofs);
+ cell_iterator cell = begin_active(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<total_dofs; ++i)
+ for (unsigned int j=0; j<total_dofs; ++j)
+ sparsity.add (dofs_on_this_cell[i],
+ dofs_on_this_cell[j]);
+ };
+};
+
+
#if deal_II_dimension == 1
#include <grid/tria.h>
#include <grid/geometry_info.h>
#include <fe/fe.h>
-
+#include <lac/dsmatrix.h>
/* ------------------------ MGVertexDoFs ----------------------------------- */
+template <int dim>
+unsigned int MGDoFHandler<dim>::n_dofs (const unsigned int level) const {
+ Assert (level < mg_used_dofs.size(), ExcInvalidLevel(level));
+
+ return mg_used_dofs[level];
+};
+
+
+
+template <int dim>
+void MGDoFHandler<dim>::make_sparsity_pattern (const unsigned int level,
+ dSMatrixStruct &sparsity) const {
+ Assert (selected_fe != 0, ExcNoFESelected());
+ Assert (sparsity.n_rows() == n_dofs(level),
+ ExcDifferentDimensions (sparsity.n_rows(), n_dofs(level)));
+ Assert (sparsity.n_cols() == n_dofs(level),
+ ExcDifferentDimensions (sparsity.n_cols(), n_dofs(level)));
+
+ const unsigned int total_dofs = selected_fe->total_dofs;
+ vector<int> dofs_on_this_cell(total_dofs);
+ cell_iterator cell = begin_active(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<total_dofs; ++i)
+ for (unsigned int j=0; j<total_dofs; ++j)
+ sparsity.add (dofs_on_this_cell[i],
+ dofs_on_this_cell[j]);
+ };
+};
+
+
#if deal_II_dimension == 1