Reference documentation for deal.II version 8.4.2
relaxation_block.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2010 - 2016 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 
50 template <typename MatrixType, typename inverse_type=typename MatrixType::value_type>
52  protected PreconditionBlockBase<inverse_type>
53 {
54 private:
58  typedef typename MatrixType::value_type number;
59 
63  typedef inverse_type value_type;
64 
65 public:
70 
77  class AdditionalData : public Subscriptor
78  {
79  public:
83  AdditionalData (const double relaxation = 1.,
84  const bool invert_diagonal = true,
85  const bool same_diagonal = false);
86 
92 
96  double relaxation;
97 
105 
119 
127  double threshold;
128 
149  std::vector<std::vector<unsigned int> > order;
153  std::size_t memory_consumption() const;
154  };
155 
165  void initialize (const MatrixType &A,
166  const AdditionalData &parameters);
167 
173  void clear();
174 
178  bool empty () const;
179 
184  value_type el(size_type i,
185  size_type j) const;
186 
202  void invert_diagblocks();
203 
204 protected:
213  template <typename number2>
214  void do_step (
215  Vector<number2> &dst,
216  const Vector<number2> &prev,
217  const Vector<number2> &src,
218  const bool backward) const;
226 
231 };
232 
233 
249 template<typename MatrixType, typename inverse_type = typename MatrixType::value_type>
250 class RelaxationBlockJacobi : public virtual Subscriptor,
251  protected RelaxationBlock<MatrixType, inverse_type>
252 {
253 public:
257 // RelaxationBlockJacobi();
258 
262  typedef typename MatrixType::value_type number;
263 
268 
273 
278 
303  template <typename number2>
304  void step (Vector<number2> &dst, const Vector<number2> &rhs) const;
305 
309  template <typename number2>
310  void Tstep (Vector<number2> &dst, const Vector<number2> &rhs) const;
311 
315  std::size_t memory_consumption() const;
316 };
317 
318 
334 template<typename MatrixType, typename inverse_type = typename MatrixType::value_type>
335 class RelaxationBlockSOR : public virtual Subscriptor,
336  protected RelaxationBlock<MatrixType, inverse_type>
337 {
338 public:
342 // RelaxationBlockSOR();
343 
347  typedef typename MatrixType::value_type number;
348 
353 
358 
363 
388  template <typename number2>
389  void step (Vector<number2> &dst, const Vector<number2> &rhs) const;
390 
394  template <typename number2>
395  void Tstep (Vector<number2> &dst, const Vector<number2> &rhs) const;
396 };
397 
398 
414 template<typename MatrixType, typename inverse_type = typename MatrixType::value_type>
415 class RelaxationBlockSSOR : public virtual Subscriptor,
416  protected RelaxationBlock<MatrixType, inverse_type>
417 {
418 public:
422  typedef typename MatrixType::value_type number;
423 
428 
433 
438 
443 
464  template <typename number2>
465  void step (Vector<number2> &dst, const Vector<number2> &rhs) const;
466 
470  template <typename number2>
471  void Tstep (Vector<number2> &dst, const Vector<number2> &rhs) const;
472 };
473 
474 
475 DEAL_II_NAMESPACE_CLOSE
476 
477 #endif
PreconditionBlockBase< inverse_type >::Inversion inversion
inverse_type value_type
MatrixType::value_type number
std::vector< std::vector< unsigned int > > order
MatrixType::value_type number
SmartPointer< const AdditionalData, RelaxationBlock< MatrixType, inverse_type > > additional_data
void do_step(Vector< number2 > &dst, const Vector< number2 > &prev, const Vector< number2 > &src, const bool backward) const
value_type el(size_type i, size_type j) 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)
void invert_diagblocks()
void initialize(const MatrixType &A, const AdditionalData &parameters)
types::global_dof_index size_type
SmartPointer< const MatrixType, RelaxationBlock< MatrixType, inverse_type > > A
std::size_t memory_consumption() const
bool empty() const
MatrixType::value_type number
MatrixType::value_type number