* Write the sparsity structure of the matrix belonging to the specified @p
* level. The sparsity pattern is not compressed, so before creating the
* actual matrix you have to compress the matrix yourself, using
- * <tt>SparseMatrixStruct::compress()</tt>.
+ * <tt>SparsityPatternType::compress()</tt>.
*
- * There is no need to consider hanging nodes here, since only one level is
- * considered.
+ * The optional AffineConstraints argument allows to define constraints of
+ * the level matrices like Dirichlet boundary conditions. Note that there is
+ * need to consider hanging nodes on the typical level matrices, since only
+ * one level is considered. See DoFTools::make_sparsity_pattern() for more
+ * details about the arguments.
*/
- template <int dim, int spacedim, typename SparsityPatternType>
+ template <int dim,
+ int spacedim,
+ typename SparsityPatternType,
+ typename number = double>
void
- make_sparsity_pattern(const DoFHandler<dim, spacedim> &dof_handler,
- SparsityPatternType & sparsity,
- const unsigned int level);
+ make_sparsity_pattern(
+ const DoFHandler<dim, spacedim> &dof_handler,
+ SparsityPatternType & sparsity,
+ const unsigned int level,
+ const AffineConstraints<number> &constraints = AffineConstraints<number>(),
+ const bool keep_constrained_dofs = true);
/**
* Make a sparsity pattern including fluxes of discontinuous Galerkin
- template <int dim, int spacedim, typename SparsityPatternType>
+ template <int dim,
+ int spacedim,
+ typename SparsityPatternType,
+ typename number>
void
make_sparsity_pattern(const DoFHandler<dim, spacedim> &dof,
SparsityPatternType & sparsity,
- const unsigned int level)
+ const unsigned int level,
+ const AffineConstraints<number> &constraints,
+ const bool keep_constrained_dofs)
{
const types::global_dof_index n_dofs = dof.n_dofs(level);
(void)n_dofs;
dof.get_triangulation().locally_owned_subdomain())
{
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]);
+ constraints.add_entries_local_to_global(dofs_on_this_cell,
+ sparsity,
+ keep_constrained_dofs);
}
}
template void
make_sparsity_pattern<deal_II_dimension,
deal_II_space_dimension,
- PATTERN>(
+ PATTERN,
+ double>(
const DoFHandler<deal_II_dimension, deal_II_space_dimension> &,
PATTERN &,
- const unsigned int);
+ const unsigned int,
+ const AffineConstraints<double> &,
+ const bool);
+
+ template void
+ make_sparsity_pattern<deal_II_dimension,
+ deal_II_space_dimension,
+ PATTERN,
+ float>(
+ const DoFHandler<deal_II_dimension, deal_II_space_dimension> &,
+ PATTERN &,
+ const unsigned int,
+ const AffineConstraints<float> &,
+ const bool);
#endif
\}
}