Reference documentation for deal.II version GIT db2fd67796 2022-12-07 23:35:02+00:00
\(\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 - 2021 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 <vector>
29 
31 
53 template <typename MatrixType,
54  typename InverseNumberType = typename MatrixType::value_type,
55  typename VectorType = Vector<double>>
56 class RelaxationBlock : protected PreconditionBlockBase<InverseNumberType>
57 {
58 private:
62  using number = typename MatrixType::value_type;
63 
67  using value_type = InverseNumberType;
68 
69 public:
74 
81  class AdditionalData : public Subscriptor
82  {
83  public:
88  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
189  };
190 
200  void
201  initialize(const MatrixType &A, const AdditionalData &parameters);
202 
208  void
209  clear();
210 
226  void
228 
229 protected:
238  void
239  do_step(VectorType & dst,
240  const VectorType &prev,
241  const VectorType &src,
242  const bool backward) const;
243 
250  SmartPointer<const MatrixType,
252  A;
253 
260 
261 private:
265  void
266  block_kernel(const size_type block_begin, const size_type block_end);
267 };
268 
269 
283 template <typename MatrixType,
284  typename InverseNumberType = typename MatrixType::value_type,
285  typename VectorType = Vector<double>>
287  : public virtual Subscriptor,
288  protected RelaxationBlock<MatrixType, InverseNumberType, VectorType>
289 {
290 public:
294  // RelaxationBlockJacobi();
295 
299  using number = typename MatrixType::value_type;
300 
305  AdditionalData;
306 
311 
316 
341  void
342  step(VectorType &dst, const VectorType &rhs) const;
343 
347  void
348  Tstep(VectorType &dst, const VectorType &rhs) const;
349 
354  void
355  vmult(VectorType &dst, const VectorType &rhs) const;
356 
361  void
362  Tvmult(VectorType &dst, const VectorType &rhs) const;
363 };
364 
365 
379 template <typename MatrixType,
380  typename InverseNumberType = typename MatrixType::value_type,
381  typename VectorType = Vector<double>>
383  : public virtual Subscriptor,
384  protected RelaxationBlock<MatrixType, InverseNumberType, VectorType>
385 {
386 public:
390  // RelaxationBlockSOR();
391 
395  using number = typename MatrixType::value_type;
396 
401  AdditionalData;
402 
407 
412 
437  void
438  step(VectorType &dst, const VectorType &rhs) const;
439 
443  void
444  Tstep(VectorType &dst, const VectorType &rhs) const;
445 
450  void
451  vmult(VectorType &dst, const VectorType &rhs) const;
452 
457  void
458  Tvmult(VectorType &dst, const VectorType &rhs) const;
459 };
460 
461 
475 template <typename MatrixType,
476  typename InverseNumberType = typename MatrixType::value_type,
477  typename VectorType = Vector<double>>
479  : public virtual Subscriptor,
480  protected RelaxationBlock<MatrixType, InverseNumberType, VectorType>
481 {
482 public:
486  using number = typename MatrixType::value_type;
487 
492  AdditionalData;
493 
498 
503 
528  void
529  step(VectorType &dst, const VectorType &rhs) const;
530 
534  void
535  Tstep(VectorType &dst, const VectorType &rhs) const;
536 
541  void
542  vmult(VectorType &dst, const VectorType &rhs) const;
543 
548  void
549  Tvmult(VectorType &dst, const VectorType &rhs) const;
550 };
551 
552 
554 
555 #endif
Householder< typename MatrixType::value_type > & inverse_householder(size_type i)
void Tstep(VectorType &dst, const VectorType &rhs) const
void Tvmult(VectorType &dst, const VectorType &rhs) const
void vmult(VectorType &dst, const VectorType &rhs) const
void step(VectorType &dst, const VectorType &rhs) const
typename MatrixType::value_type number
void Tvmult(VectorType &dst, const VectorType &rhs) const
void step(VectorType &dst, const VectorType &rhs) const
void vmult(VectorType &dst, const VectorType &rhs) const
typename MatrixType::value_type number
void Tstep(VectorType &dst, const VectorType &rhs) const
void Tstep(VectorType &dst, const VectorType &rhs) const
void Tvmult(VectorType &dst, const VectorType &rhs) const
typename MatrixType::value_type number
void step(VectorType &dst, const VectorType &rhs) const
void vmult(VectorType &dst, const VectorType &rhs) const
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)
PreconditionBlockBase< InverseNumberType >::Inversion inversion
std::size_t memory_consumption() const
std::vector< std::vector< unsigned int > > order
void initialize(const MatrixType &A, const AdditionalData &parameters)
void block_kernel(const size_type block_begin, const size_type block_end)
void do_step(VectorType &dst, const VectorType &prev, const VectorType &src, const bool backward) const
SmartPointer< const AdditionalData, RelaxationBlock< MatrixType, InverseNumberType, VectorType > > additional_data
SmartPointer< const MatrixType, RelaxationBlock< MatrixType, InverseNumberType, VectorType > > A
types::global_dof_index size_type
typename MatrixType::value_type number
void invert_diagblocks()
InverseNumberType value_type
Definition: vector.h:109
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:458
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:459
unsigned int global_dof_index
Definition: types.h:81