Reference documentation for deal.II version Git 292c2606a1 2021-03-03 00:48:14 +0100
\(\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 
54 template <typename MatrixType,
55  typename InverseNumberType = typename MatrixType::value_type,
56  typename VectorType = Vector<double>>
57 class RelaxationBlock : protected PreconditionBlockBase<InverseNumberType>
58 {
59 private:
63  using number = typename MatrixType::value_type;
64 
69 
70 public:
75 
82  class AdditionalData : public Subscriptor
83  {
84  public:
89  const double relaxation = 1.,
90  const bool invert_diagonal = true,
91  const bool same_diagonal = false,
94  const double threshold = 0.,
95  VectorType * temp_ghost_vector = nullptr);
96 
102 
106  double relaxation;
107 
115 
125 
130 
140  double threshold = 0.;
141 
151  unsigned int kernel_size = 0;
152 
173  std::vector<std::vector<unsigned int>> order;
174 
184 
188  std::size_t
189  memory_consumption() const;
190  };
191 
201  void
202  initialize(const MatrixType &A, const AdditionalData &parameters);
203 
209  void
210  clear();
211 
227  void
229 
230 protected:
239  void
240  do_step(VectorType & dst,
241  const VectorType &prev,
242  const VectorType &src,
243  const bool backward) const;
244 
251  SmartPointer<const MatrixType,
253  A;
254 
261 
262 private:
266  void
267  block_kernel(const size_type block_begin, const size_type block_end);
268 };
269 
270 
284 template <typename MatrixType,
285  typename InverseNumberType = typename MatrixType::value_type,
286  typename VectorType = Vector<double>>
288  : public virtual Subscriptor,
289  protected RelaxationBlock<MatrixType, InverseNumberType, VectorType>
290 {
291 public:
295  // RelaxationBlockJacobi();
296 
300  using number = typename MatrixType::value_type;
301 
307 
312 
317 
342  void
343  step(VectorType &dst, const VectorType &rhs) const;
344 
348  void
349  Tstep(VectorType &dst, const VectorType &rhs) const;
350 
355  void
356  vmult(VectorType &dst, const VectorType &rhs) const;
357 
362  void
363  Tvmult(VectorType &dst, const VectorType &rhs) const;
364 };
365 
366 
380 template <typename MatrixType,
381  typename InverseNumberType = typename MatrixType::value_type,
382  typename VectorType = Vector<double>>
384  : public virtual Subscriptor,
385  protected RelaxationBlock<MatrixType, InverseNumberType, VectorType>
386 {
387 public:
391  // RelaxationBlockSOR();
392 
396  using number = typename MatrixType::value_type;
397 
403 
408 
413 
438  void
439  step(VectorType &dst, const VectorType &rhs) const;
440 
444  void
445  Tstep(VectorType &dst, const VectorType &rhs) const;
446 
451  void
452  vmult(VectorType &dst, const VectorType &rhs) const;
453 
458  void
459  Tvmult(VectorType &dst, const VectorType &rhs) const;
460 };
461 
462 
476 template <typename MatrixType,
477  typename InverseNumberType = typename MatrixType::value_type,
478  typename VectorType = Vector<double>>
480  : public virtual Subscriptor,
481  protected RelaxationBlock<MatrixType, InverseNumberType, VectorType>
482 {
483 public:
487  using number = typename MatrixType::value_type;
488 
494 
499 
504 
529  void
530  step(VectorType &dst, const VectorType &rhs) const;
531 
535  void
536  Tstep(VectorType &dst, const VectorType &rhs) const;
537 
542  void
543  vmult(VectorType &dst, const VectorType &rhs) const;
544 
549  void
550  Tvmult(VectorType &dst, const VectorType &rhs) const;
551 };
552 
553 
555 
556 #endif
std::size_t memory_consumption() const
SmartPointer< const MatrixType, RelaxationBlock< MatrixType, InverseNumberType, VectorType > > A
SmartPointer< const AdditionalData, RelaxationBlock< MatrixType, InverseNumberType, VectorType > > additional_data
PreconditionBlockBase< InverseNumberType >::Inversion inversion
typename MatrixType::value_type number
void block_kernel(const size_type block_begin, const size_type block_end)
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)
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:394
unsigned int global_dof_index
Definition: types.h:76
std::vector< std::vector< unsigned int > > order
void invert_diagblocks()
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:393
Householder< InverseNumberType > & inverse_householder(size_type i)
void initialize(const MatrixType &A, const AdditionalData &parameters)
void do_step(VectorType &dst, const VectorType &prev, const VectorType &src, const bool backward) const