Reference documentation for deal.II version 9.2.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
relaxation_block.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2010 - 2019 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.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_relaxation_block_h
17 #define dealii_relaxation_block_h
18 
19 #include <deal.II/base/config.h>
20 
23 
26 #include <deal.II/lac/vector.h>
27 
28 #include <set>
29 #include <vector>
30 
32 
56 template <typename MatrixType,
57  typename InverseNumberType = typename MatrixType::value_type,
58  typename VectorType = Vector<double>>
59 class RelaxationBlock : protected PreconditionBlockBase<InverseNumberType>
60 {
61 private:
65  using number = typename MatrixType::value_type;
66 
70  using value_type = InverseNumberType;
71 
72 public:
77 
84  class AdditionalData : public Subscriptor
85  {
86  public:
91  const double relaxation = 1.,
92  const bool invert_diagonal = true,
93  const bool same_diagonal = false,
96  const double threshold = 0.,
97  VectorType * temp_ghost_vector = nullptr);
98 
104 
108  double relaxation;
109 
117 
127 
132 
142  double threshold = 0.;
143 
153  unsigned int kernel_size = 0;
154 
175  std::vector<std::vector<unsigned int>> order;
176 
186 
190  std::size_t
191  memory_consumption() const;
192  };
193 
203  void
204  initialize(const MatrixType &A, const AdditionalData &parameters);
205 
211  void
212  clear();
213 
229  void
231 
232 protected:
241  void
242  do_step(VectorType & dst,
243  const VectorType &prev,
244  const VectorType &src,
245  const bool backward) const;
246 
253  SmartPointer<const MatrixType,
255  A;
256 
260  SmartPointer<const AdditionalData,
263 
264 private:
268  void
269  block_kernel(const size_type block_begin, const size_type block_end);
270 };
271 
272 
288 template <typename MatrixType,
289  typename InverseNumberType = typename MatrixType::value_type,
290  typename VectorType = Vector<double>>
292  : public virtual Subscriptor,
293  protected RelaxationBlock<MatrixType, InverseNumberType, VectorType>
294 {
295 public:
299  // RelaxationBlockJacobi();
300 
304  using number = typename MatrixType::value_type;
305 
310  AdditionalData;
311 
316 
321 
346  void
347  step(VectorType &dst, const VectorType &rhs) const;
348 
352  void
353  Tstep(VectorType &dst, const VectorType &rhs) const;
354 
359  void
360  vmult(VectorType &dst, const VectorType &rhs) const;
361 
366  void
367  Tvmult(VectorType &dst, const VectorType &rhs) const;
368 };
369 
370 
386 template <typename MatrixType,
387  typename InverseNumberType = typename MatrixType::value_type,
388  typename VectorType = Vector<double>>
390  : public virtual Subscriptor,
391  protected RelaxationBlock<MatrixType, InverseNumberType, VectorType>
392 {
393 public:
397  // RelaxationBlockSOR();
398 
402  using number = typename MatrixType::value_type;
403 
408  AdditionalData;
409 
414 
419 
444  void
445  step(VectorType &dst, const VectorType &rhs) const;
446 
450  void
451  Tstep(VectorType &dst, const VectorType &rhs) const;
452 
457  void
458  vmult(VectorType &dst, const VectorType &rhs) const;
459 
464  void
465  Tvmult(VectorType &dst, const VectorType &rhs) const;
466 };
467 
468 
484 template <typename MatrixType,
485  typename InverseNumberType = typename MatrixType::value_type,
486  typename VectorType = Vector<double>>
488  : public virtual Subscriptor,
489  protected RelaxationBlock<MatrixType, InverseNumberType, VectorType>
490 {
491 public:
495  using number = typename MatrixType::value_type;
496 
501  AdditionalData;
502 
507 
512 
537  void
538  step(VectorType &dst, const VectorType &rhs) const;
539 
543  void
544  Tstep(VectorType &dst, const VectorType &rhs) const;
545 
550  void
551  vmult(VectorType &dst, const VectorType &rhs) const;
552 
557  void
558  Tvmult(VectorType &dst, const VectorType &rhs) const;
559 };
560 
561 
563 
564 #endif
RelaxationBlock::AdditionalData::threshold
double threshold
Definition: relaxation_block.h:142
RelaxationBlock::AdditionalData
Definition: relaxation_block.h:84
RelaxationBlock::block_kernel
void block_kernel(const size_type block_begin, const size_type block_end)
RelaxationBlock::AdditionalData::order
std::vector< std::vector< unsigned int > > order
Definition: relaxation_block.h:175
RelaxationBlock::AdditionalData::same_diagonal
bool same_diagonal
Definition: relaxation_block.h:126
RelaxationBlock::AdditionalData::relaxation
double relaxation
Definition: relaxation_block.h:108
RelaxationBlock< MatrixType, typename MatrixType::value_type, Vector< double > >::value_type
typename MatrixType::value_type value_type
Definition: relaxation_block.h:70
RelaxationBlockSOR::Tstep
void Tstep(VectorType &dst, const VectorType &rhs) const
PreconditionBlockBase< typename MatrixType::value_type >::inverse_householder
Householder< typename MatrixType::value_type > & inverse_householder(size_type i)
Definition: precondition_block_base.h:543
RelaxationBlock::AdditionalData::block_list
SparsityPattern block_list
Definition: relaxation_block.h:103
VectorType
RelaxationBlockSOR
Definition: relaxation_block.h:389
RelaxationBlockJacobi
Definition: relaxation_block.h:291
RelaxationBlock::additional_data
SmartPointer< const AdditionalData, RelaxationBlock< MatrixType, InverseNumberType, VectorType > > additional_data
Definition: relaxation_block.h:262
RelaxationBlock::AdditionalData::temp_ghost_vector
VectorType * temp_ghost_vector
Definition: relaxation_block.h:185
RelaxationBlock::A
SmartPointer< const MatrixType, RelaxationBlock< MatrixType, InverseNumberType, VectorType > > A
Definition: relaxation_block.h:255
RelaxationBlockSOR::number
typename MatrixType::value_type number
Definition: relaxation_block.h:402
RelaxationBlock::clear
void clear()
Subscriptor
Definition: subscriptor.h:62
RelaxationBlockSSOR::Tvmult
void Tvmult(VectorType &dst, const VectorType &rhs) const
RelaxationBlock::AdditionalData::kernel_size
unsigned int kernel_size
Definition: relaxation_block.h:153
types::global_dof_index
unsigned int global_dof_index
Definition: types.h:76
subscriptor.h
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
RelaxationBlockSOR::vmult
void vmult(VectorType &dst, const VectorType &rhs) const
RelaxationBlockSSOR::step
void step(VectorType &dst, const VectorType &rhs) const
RelaxationBlock< MatrixType, typename MatrixType::value_type, Vector< double > >::number
typename MatrixType::value_type number
Definition: relaxation_block.h:65
RelaxationBlockJacobi::number
typename MatrixType::value_type number
Definition: relaxation_block.h:304
SparsityPattern
Definition: sparsity_pattern.h:865
smartpointer.h
sparsity_pattern.h
RelaxationBlockJacobi::vmult
void vmult(VectorType &dst, const VectorType &rhs) const
RelaxationBlockJacobi::Tvmult
void Tvmult(VectorType &dst, const VectorType &rhs) const
precondition_block_base.h
SmartPointer
Definition: smartpointer.h:68
unsigned int
RelaxationBlockSSOR
Definition: relaxation_block.h:487
RelaxationBlockSOR::step
void step(VectorType &dst, const VectorType &rhs) const
RelaxationBlockSSOR::Tstep
void Tstep(VectorType &dst, const VectorType &rhs) const
RelaxationBlock::initialize
void initialize(const MatrixType &A, const AdditionalData &parameters)
vector.h
RelaxationBlock::AdditionalData::inversion
PreconditionBlockBase< InverseNumberType >::Inversion inversion
Definition: relaxation_block.h:131
RelaxationBlockJacobi::step
void step(VectorType &dst, const VectorType &rhs) const
config.h
RelaxationBlock::AdditionalData::memory_consumption
std::size_t memory_consumption() const
RelaxationBlockSOR::Tvmult
void Tvmult(VectorType &dst, const VectorType &rhs) const
RelaxationBlockSSOR::number
typename MatrixType::value_type number
Definition: relaxation_block.h:495
RelaxationBlock::AdditionalData::AdditionalData
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)
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
PreconditionBlockBase
Definition: precondition_block_base.h:61
RelaxationBlockJacobi::Tstep
void Tstep(VectorType &dst, const VectorType &rhs) const
RelaxationBlock::invert_diagblocks
void invert_diagblocks()
Vector< double >
RelaxationBlockSSOR::vmult
void vmult(VectorType &dst, const VectorType &rhs) const
RelaxationBlock
Definition: relaxation_block.h:59
RelaxationBlock::AdditionalData::invert_diagonal
bool invert_diagonal
Definition: relaxation_block.h:116
RelaxationBlock::do_step
void do_step(VectorType &dst, const VectorType &prev, const VectorType &src, const bool backward) const