16 #ifndef dealii_mg_block_smoother_h
17 #define dealii_mg_block_smoother_h
20 #include <deal.II/base/config.h>
22 #include <deal.II/base/mg_level_object.h>
23 #include <deal.II/base/smartpointer.h>
25 #include <deal.II/lac/block_vector.h>
26 #include <deal.II/lac/linear_operator.h>
27 #include <deal.II/lac/vector_memory.h>
29 #include <deal.II/multigrid/mg_smoother.h>
33 DEAL_II_NAMESPACE_OPEN
50 template <
typename MatrixType,
class RelaxationType,
typename number>
62 const unsigned int steps = 1,
90 template <
class MGMatrixType,
class MGRelaxationType>
112 smooth(
const unsigned int level,
152 template <
typename MatrixType,
class RelaxationType,
typename number>
155 const unsigned int steps,
157 const bool symmetric,
165 template <
typename MatrixType,
class RelaxationType,
typename number>
167 const unsigned int steps,
169 const bool symmetric,
174 , mem(&this->vector_memory)
178 template <
typename MatrixType,
class RelaxationType,
typename number>
182 unsigned int i = matrices.min_level(), max_level = matrices.max_level();
183 for (; i <= max_level; ++i)
191 template <
typename MatrixType,
class RelaxationType,
typename number>
192 template <
class MGMatrixType,
class MGRelaxationType>
195 const MGMatrixType & m,
196 const MGRelaxationType &s)
198 const unsigned int min = m.min_level();
199 const unsigned int max = m.max_level();
201 matrices.resize(
min,
max);
202 smoothers.resize(
min,
max);
204 for (
unsigned int i =
min; i <=
max; ++i)
209 matrices[i] = linear_operator<BlockVector<number>>(
211 smoothers[i] = linear_operator<BlockVector<number>>(matrices[i], s[i]);
216 template <
typename MatrixType,
class RelaxationType,
typename number>
225 template <
typename MatrixType,
class RelaxationType,
typename number>
229 return sizeof(*this) + matrices.memory_consumption() +
230 smoothers.memory_consumption() +
231 this->vector_memory.memory_consumption();
235 template <
typename MatrixType,
class RelaxationType,
typename number>
238 const unsigned int level,
244 unsigned int maxlevel = matrices.max_level();
245 unsigned int steps2 = this->steps;
248 steps2 *= (1 << (maxlevel - level));
256 if (this->symmetric && (steps2 % 2 == 0))
259 for (
unsigned int i = 0; i < steps2; ++i)
263 matrices[level].vmult(*r, u);
264 r->sadd(-1., 1., rhs);
265 smoothers[level].Tvmult(*d, *r);
269 matrices[level].vmult(*r, u);
270 r->sadd(-1., 1., rhs);
271 smoothers[level].vmult(*d, *r);
281 DEAL_II_NAMESPACE_CLOSE