Reference documentation for deal.II version 9.0.0
relaxation_block.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2010 - 2018 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_relaxation_block_h
17 #define dealii_relaxation_block_h
18 
19 #include <deal.II/base/subscriptor.h>
20 #include <deal.II/base/smartpointer.h>
21 #include <deal.II/lac/vector.h>
22 #include <deal.II/lac/precondition_block_base.h>
23 #include <deal.II/lac/sparsity_pattern.h>
24 
25 #include <vector>
26 #include <set>
27 
28 DEAL_II_NAMESPACE_OPEN
29 
53 template <typename MatrixType,
54  typename InverseNumberType = typename MatrixType::value_type,
55  typename VectorType = Vector<double> >
57  protected PreconditionBlockBase<InverseNumberType>
58 {
59 private:
63  typedef typename MatrixType::value_type number;
64 
68  typedef InverseNumberType value_type;
69 
70 public:
75 
82  class AdditionalData : public Subscriptor
83  {
84  public:
88  AdditionalData (const double relaxation = 1.,
89  const bool invert_diagonal = true,
90  const bool same_diagonal = false,
93  const double threshold = 0.,
94  VectorType *temp_ghost_vector = nullptr);
95 
101 
105  double relaxation;
106 
114 
124 
129 
139  double threshold = 0.;
140 
150  unsigned int kernel_size = 0;
151 
172  std::vector<std::vector<unsigned int> > order;
173 
182  mutable VectorType *temp_ghost_vector;
183 
187  std::size_t memory_consumption() const;
188  };
189 
199  void initialize (const MatrixType &A,
200  const AdditionalData &parameters);
201 
207  void clear();
208 
224  void invert_diagblocks();
225 
226 protected:
235  void do_step (
236  VectorType &dst,
237  const VectorType &prev,
238  const VectorType &src,
239  const bool backward) const;
240 
248 
253 
254 private:
258  void block_kernel(const size_type block_begin, const size_type block_end);
259 };
260 
261 
277 template <typename MatrixType,
278  typename InverseNumberType = typename MatrixType::value_type,
279  typename VectorType = Vector<double> >
280 class RelaxationBlockJacobi : public virtual Subscriptor,
281  protected RelaxationBlock<MatrixType, InverseNumberType, VectorType>
282 {
283 public:
287 // RelaxationBlockJacobi();
288 
292  typedef typename MatrixType::value_type number;
293 
298 
303 
308 
332  void step (VectorType &dst, const VectorType &rhs) const;
333 
337  void Tstep (VectorType &dst, const VectorType &rhs) const;
338 
343  void vmult (VectorType &dst, const VectorType &rhs) const;
344 
349  void Tvmult (VectorType &dst, const VectorType &rhs) const;
350 };
351 
352 
368 template <typename MatrixType,
369  typename InverseNumberType = typename MatrixType::value_type,
370  typename VectorType = Vector<double> >
371 class RelaxationBlockSOR : public virtual Subscriptor,
372  protected RelaxationBlock<MatrixType, InverseNumberType, VectorType>
373 {
374 public:
378 // RelaxationBlockSOR();
379 
383  typedef typename MatrixType::value_type number;
384 
389 
394 
399 
423  void step (VectorType &dst, const VectorType &rhs) const;
424 
428  void Tstep (VectorType &dst, const VectorType &rhs) const;
429 
434  void vmult (VectorType &dst, const VectorType &rhs) const;
435 
440  void Tvmult (VectorType &dst, const VectorType &rhs) const;
441 };
442 
443 
459 template <typename MatrixType,
460  typename InverseNumberType = typename MatrixType::value_type,
461  typename VectorType = Vector<double> >
462 class RelaxationBlockSSOR : public virtual Subscriptor,
463  protected RelaxationBlock<MatrixType, InverseNumberType, VectorType>
464 {
465 public:
469  typedef typename MatrixType::value_type number;
470 
475 
480 
485 
509  void step (VectorType &dst, const VectorType &rhs) const;
510 
514  void Tstep (VectorType &dst, const VectorType &rhs) const;
515 
520  void vmult (VectorType &dst, const VectorType &rhs) const;
521 
526  void Tvmult (VectorType &dst, const VectorType &rhs) const;
527 };
528 
529 
530 DEAL_II_NAMESPACE_CLOSE
531 
532 #endif
void vmult(VectorType &dst, const VectorType &rhs) const
std::size_t memory_consumption() const
void Tvmult(VectorType &dst, const VectorType &rhs) const
SmartPointer< const AdditionalData, RelaxationBlock< MatrixType, InverseNumberType, VectorType > > additional_data
InverseNumberType value_type
void vmult(VectorType &dst, const VectorType &rhs) const
PreconditionBlockBase< InverseNumberType >::Inversion inversion
MatrixType::value_type number
void Tvmult(VectorType &dst, const VectorType &rhs) const
void block_kernel(const size_type block_begin, const size_type block_end)
SmartPointer< const MatrixType, RelaxationBlock< MatrixType, InverseNumberType, VectorType > > A
void Tstep(VectorType &dst, const VectorType &rhs) const
unsigned int global_dof_index
Definition: types.h:88
AdditionalData(const double relaxation=1., const bool invert_diagonal=true, const bool same_diagonal=false, const typename PreconditionBlockBase< InverseNumberType >::Inversion inversion=PreconditionBlockBase< InverseNumberType >::gauss_jordan, const double threshold=0., VectorType *temp_ghost_vector=nullptr)
void step(VectorType &dst, const VectorType &rhs) const
void vmult(VectorType &dst, const VectorType &rhs) const
MatrixType::value_type number
void Tvmult(VectorType &dst, const VectorType &rhs) const
MatrixType::value_type number
void Tstep(VectorType &dst, const VectorType &rhs) const
std::vector< std::vector< unsigned int > > order
void invert_diagblocks()
void Tstep(VectorType &dst, const VectorType &rhs) const
types::global_dof_index size_type
void step(VectorType &dst, const VectorType &rhs) const
MatrixType::value_type number
void initialize(const MatrixType &A, const AdditionalData &parameters)
void step(VectorType &dst, const VectorType &rhs) const
void do_step(VectorType &dst, const VectorType &prev, const VectorType &src, const bool backward) const