17 #ifndef __deal2__mg_block_smoother_h
18 #define __deal2__mg_block_smoother_h
21 #include <deal.II/base/config.h>
22 #include <deal.II/base/smartpointer.h>
23 #include <deal.II/lac/pointer_matrix.h>
24 #include <deal.II/lac/vector_memory.h>
25 #include <deal.II/lac/block_vector.h>
26 #include <deal.II/multigrid/mg_base.h>
27 #include <deal.II/base/mg_level_object.h>
47 template <
class MATRIX,
class RELAX,
typename number>
57 const unsigned int steps = 1,
60 const bool transpose =
false,
85 template <
class MGMATRIX,
class MGRELAX>
136 virtual void smooth (
const unsigned int level,
188 template <
class MATRIX,
class RELAX,
typename number>
192 const unsigned int steps,
194 const bool symmetric,
200 symmetric(symmetric),
201 transpose(transpose),
207 template <
class MATRIX,
class RELAX,
typename number>
211 unsigned int i=matrices.min_level(),
212 max_level=matrices.max_level();
213 for (; i<=max_level; ++i)
221 template <
class MATRIX,
class RELAX,
typename number>
222 template <
class MGMATRIX,
class MGRELAX>
228 const unsigned int min = m.min_level();
229 const unsigned int max = m.max_level();
231 matrices.resize(min, max);
232 smoothers.resize(min, max);
234 for (
unsigned int i=min; i<=
max; ++i)
237 smoothers[i] = &s[i];
241 template <
class MATRIX,
class RELAX,
typename number>
250 template <
class MATRIX,
class RELAX,
typename number>
259 template <
class MATRIX,
class RELAX,
typename number>
268 template <
class MATRIX,
class RELAX,
typename number>
277 template <
class MATRIX,
class RELAX,
typename number>
286 template <
class MATRIX,
class RELAX,
typename number>
289 const unsigned int level,
293 deallog.
push(
"Smooth");
295 unsigned int maxlevel = matrices.max_level();
296 unsigned int steps2 = steps;
299 steps2 *= (1<<(maxlevel-level));
307 if (symmetric && (steps2 % 2 == 0))
312 for (
unsigned int i=0; i<steps2; ++i)
317 matrices[level].vmult(*r,u);
319 smoothers[level].Tvmult(*d, *r);
324 matrices[level].vmult(*r,u);
326 smoothers[level].vmult(*d, *r);
341 DEAL_II_NAMESPACE_CLOSE
void set_transpose(const bool)
void set_steps(const unsigned int)
void reinit(const unsigned int num_blocks, const size_type block_size=0, const bool fast=false)
VectorizedArray< Number > min(const ::VectorizedArray< Number > &x, const ::VectorizedArray< Number > &y)
SymmetricTensor< rank, dim, Number > transpose(const SymmetricTensor< rank, dim, Number > &t)
VectorMemory< BlockVector< number > > & mem
void initialize(const MGMATRIX &matrices, const MGRELAX &smoothers)
MGSmootherBlock(VectorMemory< BlockVector< number > > &mem, const unsigned int steps=1, const bool variable=false, const bool symmetric=false, const bool transpose=false, const bool reverse=false)
void set_reverse(const bool)
void sadd(const value_type s, const BlockVectorBase &V)
void set_variable(const bool)
void push(const std::string &text)
virtual void smooth(const unsigned int level, BlockVector< number > &u, const BlockVector< number > &rhs) const
MGLevelObject< PointerMatrix< RELAX, BlockVector< number > > > smoothers
void set_symmetric(const bool)
VectorizedArray< Number > max(const ::VectorizedArray< Number > &x, const ::VectorizedArray< Number > &y)
MGLevelObject< PointerMatrix< MATRIX, BlockVector< number > > > matrices