16 #ifndef dealii_mg_sparse_matrix_collection_h 17 #define dealii_mg_sparse_matrix_collection_h 19 #include <deal.II/lac/vector.h> 20 #include <deal.II/lac/sparse_matrix.h> 21 #include <deal.II/lac/dynamic_sparsity_pattern.h> 22 #include <deal.II/multigrid/mg_base.h> 23 #include <deal.II/multigrid/mg_tools.h> 24 #include <deal.II/base/mg_level_object.h> 28 DEAL_II_NAMESPACE_OPEN
39 template <
typename number>
43 void resize(
const unsigned int minlevel,
const unsigned int maxlevel);
45 template <
typename DoFHandlerType>
46 void reinit(
const DoFHandlerType &dof_handler);
61 template <
typename number>
65 matrix.resize(minlevel, maxlevel);
66 matrix.clear_elements();
67 matrix_up.resize(minlevel+1, maxlevel);
68 matrix_up.clear_elements();
69 matrix_down.resize(minlevel+1, maxlevel);
70 matrix_down.clear_elements();
71 matrix_in.resize(minlevel, maxlevel);
72 matrix_in.clear_elements();
73 matrix_out.resize(minlevel, maxlevel);
74 matrix_out.clear_elements();
75 sparsity.resize(minlevel, maxlevel);
76 sparsity_edge.resize(minlevel, maxlevel);
80 template <
typename number>
81 template <
typename DoFHandlerType>
83 SparseMatrixCollection<number>::reinit(
const DoFHandlerType &dof_handler)
85 AssertIndexRange(sparsity.max_level(), dof_handler.get_triangulation().n_levels());
87 for (
unsigned int level=sparsity.min_level();
88 level<=sparsity.max_level(); ++level)
92 sparsity[level].copy_from(dsp);
93 matrix[level].reinit(sparsity[level]);
94 matrix_in[level].reinit(sparsity[level]);
95 matrix_out[level].reinit(sparsity[level]);
99 ci_sparsity.
reinit(dof_handler.n_dofs(level-1), dof_handler.n_dofs(level));
101 sparsity_edge[level].copy_from(ci_sparsity);
102 matrix_up[level].reinit(sparsity_edge[level]);
103 matrix_down[level].reinit(sparsity_edge[level]);
108 template <
typename number>
110 SparseMatrixCollection<number>::set_zero()
121 DEAL_II_NAMESPACE_CLOSE
Contents is actually a matrix.
#define AssertIndexRange(index, range)
void reinit(const size_type m, const size_type n, const IndexSet &rowset=IndexSet())