Reference documentation for deal.II version 9.0.0
mg_base.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 1999 - 2017 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_mg_base_h
17 #define dealii_mg_base_h
18 
19 /*
20  * This file contains some abstract base classes
21  * used by Multigrid.
22  */
23 
24 #include <deal.II/base/config.h>
25 #include <deal.II/base/subscriptor.h>
26 #include <deal.II/base/smartpointer.h>
27 #include <deal.II/lac/vector.h>
28 
29 
30 DEAL_II_NAMESPACE_OPEN
31 
34 
35 
46 template <typename VectorType>
47 class MGMatrixBase : public Subscriptor
48 {
49 public:
50  /*
51  * Virtual destructor.
52  */
53  virtual ~MGMatrixBase() = default;
54 
58  virtual void vmult (const unsigned int level,
59  VectorType &dst,
60  const VectorType &src) const = 0;
61 
65  virtual void vmult_add (const unsigned int level,
66  VectorType &dst,
67  const VectorType &src) const = 0;
68 
72  virtual void Tvmult (const unsigned int level,
73  VectorType &dst,
74  const VectorType &src) const = 0;
75 
79  virtual void Tvmult_add (const unsigned int level,
80  VectorType &dst,
81  const VectorType &src) const = 0;
82 
86  virtual unsigned int get_minlevel() const = 0;
87 
91  virtual unsigned int get_maxlevel() const = 0;
92 };
93 
94 
102 template <typename VectorType>
104 {
105 public:
109  virtual ~MGCoarseGridBase () = default;
110 
114  virtual void operator() (const unsigned int level,
115  VectorType &dst,
116  const VectorType &src) const = 0;
117 };
118 
119 
167 template <typename VectorType>
169 {
170 public:
174  virtual ~MGTransferBase() = default;
175 
186  virtual void prolongate (const unsigned int to_level,
187  VectorType &dst,
188  const VectorType &src) const = 0;
189 
205  virtual void restrict_and_add (const unsigned int from_level,
206  VectorType &dst,
207  const VectorType &src) const = 0;
208 };
209 
210 
211 
233 template <typename VectorType>
235 {
236 public:
240  virtual ~MGSmootherBase() = default;
241 
245  virtual void clear() = 0;
246 
251  virtual void smooth (const unsigned int level,
252  VectorType &u,
253  const VectorType &rhs) const = 0;
254 
273  virtual void apply (const unsigned int level,
274  VectorType &u,
275  const VectorType &rhs) const;
276 };
277 
280 DEAL_II_NAMESPACE_CLOSE
281 
282 #endif
virtual void prolongate(const unsigned int to_level, VectorType &dst, const VectorType &src) const =0
virtual void operator()(const unsigned int level, VectorType &dst, const VectorType &src) const =0
virtual ~MGTransferBase()=default
virtual void Tvmult(const unsigned int level, VectorType &dst, const VectorType &src) const =0
virtual void clear()=0
virtual void vmult(const unsigned int level, VectorType &dst, const VectorType &src) const =0
virtual ~MGSmootherBase()=default
virtual void vmult_add(const unsigned int level, VectorType &dst, const VectorType &src) const =0
virtual void smooth(const unsigned int level, VectorType &u, const VectorType &rhs) const =0
virtual unsigned int get_maxlevel() const =0
virtual void apply(const unsigned int level, VectorType &u, const VectorType &rhs) const
Definition: mg_base.cc:32
virtual void Tvmult_add(const unsigned int level, VectorType &dst, const VectorType &src) const =0
virtual void restrict_and_add(const unsigned int from_level, VectorType &dst, const VectorType &src) const =0
virtual ~MGCoarseGridBase()=default
virtual unsigned int get_minlevel() const =0