ExaDG
Toggle main menu visibility
Loading...
Searching...
No Matches
include
exadg
solvers_and_preconditioners
preconditioners
block_jacobi_preconditioner.h
1
/* ______________________________________________________________________
2
*
3
* ExaDG - High-Order Discontinuous Galerkin for the Exa-Scale
4
*
5
* Copyright (C) 2021 by the ExaDG authors
6
*
7
* This program is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <https://www.gnu.org/licenses/>.
19
* ______________________________________________________________________
20
*/
21
22
#ifndef EXADG_SOLVERS_AND_PRECONDITIONERS_PRECONDITIONERS_BLOCK_JACOBI_PRECONDITIONER_H_
23
#define EXADG_SOLVERS_AND_PRECONDITIONERS_PRECONDITIONERS_BLOCK_JACOBI_PRECONDITIONER_H_
24
25
// ExaDG
26
#include <exadg/solvers_and_preconditioners/preconditioners/preconditioner_base.h>
27
28
namespace
ExaDG
29
{
30
template
<
typename
Operator>
31
class
BlockJacobiPreconditioner :
public
PreconditionerBase<typename Operator::value_type>
32
{
33
public
:
34
typedef
typename
PreconditionerBase<typename Operator::value_type>::VectorType VectorType;
35
36
BlockJacobiPreconditioner(Operator
const
& underlying_operator_in,
bool
const
initialize)
37
: underlying_operator(underlying_operator_in)
38
{
39
// initialize block Jacobi
40
underlying_operator.initialize_block_diagonal_preconditioner(initialize);
41
42
if
(initialize)
43
this->update_needed =
false
;
44
}
45
46
/*
47
* This function updates the block Jacobi preconditioner.
48
* Make sure that the underlying operator has been updated
49
* when calling this function.
50
*/
51
void
52
update()
final
53
{
54
underlying_operator.update_block_diagonal_preconditioner();
55
56
this->update_needed =
false
;
57
}
58
59
/*
60
* This function applies the block Jacobi preconditioner.
61
* Make sure that the block Jacobi preconditioner has been
62
* updated when calling this function.
63
*/
64
void
65
vmult(VectorType & dst, VectorType
const
& src)
const
final
66
{
67
AssertThrow(
68
not this->update_needed,
69
dealii::ExcMessage(
70
"Block Jacobi preconditioner can not be applied because it needs to be updated."
));
71
72
underlying_operator.apply_inverse_block_diagonal(dst, src);
73
}
74
75
private
:
76
Operator
const
& underlying_operator;
77
};
78
79
}
// namespace ExaDG
80
81
#endif
/* EXADG_SOLVERS_AND_PRECONDITIONERS_PRECONDITIONERS_BLOCK_JACOBI_PRECONDITIONER_H_ */
ExaDG
Definition
driver.cpp:33
Generated by
1.17.0