deal.II version GIT relicensing-6834-g5b78e6bcdf 2026-10-01 11:20:01+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\}}\)
Loading...
Searching...
No Matches
relaxation_block.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
4// Copyright (C) 2010 - 2024 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Detailed license information governing the source code and contributions
9// can be found in LICENSE.md and CONTRIBUTING.md at the top level directory.
10//
11// -----------------------------------------------------------------------------
12
13#ifndef dealii_relaxation_block_h
14#define dealii_relaxation_block_h
15
16#include <deal.II/base/config.h>
17
20
23#include <deal.II/lac/vector.h>
24
25#include <vector>
26
28
50template <typename MatrixType,
51 typename InverseNumberType = typename MatrixType::value_type,
52 typename VectorType = Vector<double>>
53class RelaxationBlock : protected PreconditionBlockBase<InverseNumberType>
54{
55private:
59 using number = typename MatrixType::value_type;
60
64 using value_type = InverseNumberType;
65
66public:
71
79 {
80 public:
85 const double relaxation = 1.,
86 const bool invert_diagonal = true,
87 const bool same_diagonal = false,
90 const double threshold = 0.,
91 VectorType *temp_ghost_vector = nullptr);
92
98
103
111
121
126
136 double threshold = 0.;
137
147 unsigned int kernel_size = 0;
148
169 std::vector<std::vector<unsigned int>> order;
170
179 mutable VectorType *temp_ghost_vector;
180
184 std::size_t
186 };
187
197 void
198 initialize(const MatrixType &A, const AdditionalData &parameters);
199
205 void
207
223 void
225
226protected:
235 void
236 do_step(VectorType &dst,
237 const VectorType &prev,
238 const VectorType &src,
239 const bool backward) const;
240
247 ObserverPointer<const MatrixType,
250
257
258private:
262 void
263 block_kernel(const size_type block_begin, const size_type block_end);
264};
265
266
280template <typename MatrixType,
281 typename InverseNumberType = typename MatrixType::value_type,
282 typename VectorType = Vector<double>>
284 : public virtual EnableObserverPointer,
285 protected RelaxationBlock<MatrixType, InverseNumberType, VectorType>
286{
287public:
291 // RelaxationBlockJacobi();
292
296 using number = typename MatrixType::value_type;
297
302 AdditionalData;
303
307 using RelaxationBlock<MatrixType, InverseNumberType, VectorType>::initialize;
308
312 using RelaxationBlock<MatrixType, InverseNumberType, VectorType>::clear;
313
317 using RelaxationBlock<MatrixType, InverseNumberType, VectorType>::size;
321 using RelaxationBlock<MatrixType, InverseNumberType, VectorType>::inverse;
325 using RelaxationBlock<MatrixType, InverseNumberType, VectorType>::
330 using RelaxationBlock<MatrixType, InverseNumberType, VectorType>::inverse_svd;
334 using PreconditionBlockBase<InverseNumberType>::log_statistics;
338 void
339 step(VectorType &dst, const VectorType &rhs) const;
340
344 void
345 Tstep(VectorType &dst, const VectorType &rhs) const;
346
351 void
352 vmult(VectorType &dst, const VectorType &rhs) const;
353
358 void
359 Tvmult(VectorType &dst, const VectorType &rhs) const;
360};
361
362
376template <typename MatrixType,
377 typename InverseNumberType = typename MatrixType::value_type,
378 typename VectorType = Vector<double>>
380 : public virtual EnableObserverPointer,
381 protected RelaxationBlock<MatrixType, InverseNumberType, VectorType>
382{
383public:
387 // RelaxationBlockSOR();
388
392 using number = typename MatrixType::value_type;
393
398 AdditionalData;
399
403 using RelaxationBlock<MatrixType, InverseNumberType, VectorType>::initialize;
404
408 using RelaxationBlock<MatrixType, InverseNumberType, VectorType>::clear;
409
413 using RelaxationBlock<MatrixType, InverseNumberType, VectorType>::size;
417 using RelaxationBlock<MatrixType, InverseNumberType, VectorType>::inverse;
421 using RelaxationBlock<MatrixType, InverseNumberType, VectorType>::
426 using RelaxationBlock<MatrixType, InverseNumberType, VectorType>::inverse_svd;
430 using PreconditionBlockBase<InverseNumberType>::log_statistics;
434 void
435 step(VectorType &dst, const VectorType &rhs) const;
436
440 void
441 Tstep(VectorType &dst, const VectorType &rhs) const;
442
447 void
448 vmult(VectorType &dst, const VectorType &rhs) const;
449
454 void
455 Tvmult(VectorType &dst, const VectorType &rhs) const;
456};
457
458
472template <typename MatrixType,
473 typename InverseNumberType = typename MatrixType::value_type,
474 typename VectorType = Vector<double>>
476 : public virtual EnableObserverPointer,
477 protected RelaxationBlock<MatrixType, InverseNumberType, VectorType>
478{
479public:
483 using number = typename MatrixType::value_type;
484
489 AdditionalData;
490
494 using RelaxationBlock<MatrixType, InverseNumberType, VectorType>::initialize;
495
499 using RelaxationBlock<MatrixType, InverseNumberType, VectorType>::clear;
500
504 using RelaxationBlock<MatrixType, InverseNumberType, VectorType>::size;
508 using RelaxationBlock<MatrixType, InverseNumberType, VectorType>::inverse;
512 using RelaxationBlock<MatrixType, InverseNumberType, VectorType>::
517 using RelaxationBlock<MatrixType, InverseNumberType, VectorType>::inverse_svd;
521 using PreconditionBlockBase<InverseNumberType>::log_statistics;
525 void
526 step(VectorType &dst, const VectorType &rhs) const;
527
531 void
532 Tstep(VectorType &dst, const VectorType &rhs) const;
533
538 void
539 vmult(VectorType &dst, const VectorType &rhs) const;
540
545 void
546 Tvmult(VectorType &dst, const VectorType &rhs) const;
547};
548
549
551
552#endif
FullMatrix< number > & inverse(const size_type i)
LAPACKFullMatrix< number > & inverse_svd(const size_type i)
Householder< number > & inverse_householder(const 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
ObserverPointer< const AdditionalData, RelaxationBlock< MatrixType, InverseNumberType, VectorType > > additional_data
void initialize(const MatrixType &A, const AdditionalData &parameters)
void block_kernel(const size_type block_begin, const size_type block_end)
ObserverPointer< const MatrixType, RelaxationBlock< MatrixType, InverseNumberType, VectorType > > A
void do_step(VectorType &dst, const VectorType &prev, const VectorType &src, const bool backward) const
typename MatrixType::value_type number
void invert_diagblocks()
InverseNumberType value_type
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:38
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
Tpetra::Vector< Number, LO, GO, NodeType< MemorySpace > > VectorType
Tpetra::CrsMatrix< Number, LO, GO, NodeType< MemorySpace > > MatrixType
unsigned int global_dof_index
Definition types.h:92
void prev(std::tuple< I1, I2 > &t)