ExaDG
Toggle main menu visibility
Loading...
Searching...
No Matches
include
exadg
solvers_and_preconditioners
preconditioners
additive_schwarz_preconditioner.h
1
/* ______________________________________________________________________
2
*
3
* ExaDG - High-Order Discontinuous Galerkin for the Exa-Scale
4
*
5
* Copyright (C) 2023 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_ADDITIVE_SCHWARZ_PRECONDITIONER_H_
23
#define EXADG_SOLVERS_AND_PRECONDITIONERS_PRECONDITIONERS_ADDITIVE_SCHWARZ_PRECONDITIONER_H_
24
25
// deal.II
26
#include <deal.II/lac/sparse_matrix.h>
27
28
// ExaDG
29
#include <exadg/solvers_and_preconditioners/preconditioners/preconditioner_base.h>
30
31
namespace
ExaDG
32
{
33
template
<
typename
Operator>
34
class
AdditiveSchwarzPreconditioner :
public
PreconditionerBase<typename Operator::value_type>
35
{
36
public
:
37
typedef
typename
PreconditionerBase<typename Operator::value_type>::VectorType VectorType;
38
39
AdditiveSchwarzPreconditioner(Operator
const
& underlying_operator_in,
bool
const
initialize)
40
: underlying_operator(underlying_operator_in)
41
{
42
if
(initialize)
43
{
44
this->update();
45
}
46
}
47
48
/*
49
* This function applies the additive Schwarz preconditioner.
50
* Make sure that the additive Schwarz preconditioner has been
51
* updated when calling this function.
52
*/
53
void
54
vmult(VectorType & dst, VectorType
const
& src)
const
final
55
{
56
AssertThrow(
57
not this->update_needed,
58
dealii::ExcMessage(
59
"Additive Schwarz preconditioner can not be applied because it needs to be updated."
));
60
61
underlying_operator.apply_inverse_additive_schwarz_matrices(dst, src);
62
}
63
64
/*
65
* This function updates the additive Schwarz preconditioner.
66
* Make sure that the underlying operator has been updated
67
* when calling this function.
68
*/
69
void
70
update()
final
71
{
72
underlying_operator.compute_factorized_additive_schwarz_matrices();
73
this->update_needed =
false
;
74
}
75
76
private
:
77
Operator
const
& underlying_operator;
78
};
79
80
}
// namespace ExaDG
81
82
#endif
/* EXADG_SOLVERS_AND_PRECONDITIONERS_PRECONDITIONERS_ADDITIVE_SCHWARZ_PRECONDITIONER_H_ */
ExaDG
Definition
driver.cpp:33
Generated by
1.17.0