Reference documentation for deal.II version Git cf38156a17 2020-04-01 20:09:03 -0400
\(\newcommand{\vcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\vcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
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.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 
21 #include <deal.II/base/smartpointer.h>
22 #include <deal.II/base/subscriptor.h>
23 
24 #include <deal.II/lac/precondition_block_base.h>
25 #include <deal.II/lac/sparsity_pattern.h>
26 #include <deal.II/lac/vector.h>
27 
28 #include <set>
29 #include <vector>
30 
31 DEAL_II_NAMESPACE_OPEN
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 
185  mutable VectorType *temp_ghost_vector;
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 
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 
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 
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 
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 
562 DEAL_II_NAMESPACE_CLOSE
563 
564 #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)
InverseNumberType value_type
unsigned int global_dof_index
Definition: types.h:77
std::vector< std::vector< unsigned int > > order
void invert_diagblocks()
types::global_dof_index size_type
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