ExaDG
Loading...
Searching...
No Matches
multigrid_operator_base.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_OPERATORS_MULTIGRID_OPERATOR_BASE_H_
23#define EXADG_OPERATORS_MULTIGRID_OPERATOR_BASE_H_
24
25// deal.II
26#include <deal.II/lac/affine_constraints.h>
27#include <deal.II/lac/la_parallel_vector.h>
28#include <deal.II/lac/petsc_sparse_matrix.h>
29#include <deal.II/lac/trilinos_sparse_matrix.h>
30#include <deal.II/matrix_free/matrix_free.h>
31
32namespace ExaDG
33{
34template<int dim, typename Number>
35class MultigridOperatorBase : public dealii::EnableObserverPointer
36{
37public:
38 typedef Number value_type;
39 typedef dealii::LinearAlgebra::distributed::Vector<Number> VectorType;
40
41 static unsigned int const dimension = dim;
42
43 MultigridOperatorBase() : dealii::EnableObserverPointer()
44 {
45 }
46
47 virtual ~MultigridOperatorBase()
48 {
49 }
50
51 virtual dealii::AffineConstraints<Number> const &
52 get_affine_constraints() const = 0;
53
54 virtual dealii::MatrixFree<dim, Number> const &
55 get_matrix_free() const = 0;
56
57 virtual unsigned int
58 get_dof_index() const = 0;
59
60 virtual dealii::types::global_dof_index
61 m() const = 0;
62
63 virtual dealii::types::global_dof_index
64 n() const = 0;
65
66 virtual Number
67 el(unsigned int const, unsigned int const) const = 0;
68
69 virtual void
70 initialize_dof_vector(VectorType & vector) const = 0;
71
72 virtual void
73 vmult(VectorType & dst, VectorType const & src) const = 0;
74
75 virtual void
76 vmult_add(VectorType & dst, VectorType const & src) const = 0;
77
78 virtual void
79 vmult_interface_down(VectorType & dst, VectorType const & src) const = 0;
80
81 virtual void
82 vmult_add_interface_up(VectorType & dst, VectorType const & src) const = 0;
83
84 virtual void
85 calculate_inverse_diagonal(VectorType & inverse_diagonal_entries) const = 0;
86
87 virtual void
88 initialize_block_diagonal_preconditioner(bool const initialize) const = 0;
89
90 virtual void
91 update_block_diagonal_preconditioner() const = 0;
92
93 virtual void
94 apply_inverse_block_diagonal(VectorType & dst, VectorType const & src) const = 0;
95
96 virtual void
97 apply_inverse_additive_schwarz_matrices(VectorType & dst, VectorType const & src) const = 0;
98
99 virtual void
100 compute_factorized_additive_schwarz_matrices() const = 0;
101
102#ifdef DEAL_II_WITH_TRILINOS
103 virtual void
104 init_system_matrix(dealii::TrilinosWrappers::SparseMatrix & system_matrix,
105 MPI_Comm const & mpi_comm) const = 0;
106
107 virtual void
108 calculate_system_matrix(dealii::TrilinosWrappers::SparseMatrix & system_matrix) const = 0;
109#endif
110
111#ifdef DEAL_II_WITH_PETSC
112 virtual void
113 init_system_matrix(dealii::PETScWrappers::MPI::SparseMatrix & system_matrix,
114 MPI_Comm const & mpi_comm) const = 0;
115
116 virtual void
117 calculate_system_matrix(dealii::PETScWrappers::MPI::SparseMatrix & system_matrix) const = 0;
118#endif
119
120 virtual void
121 get_constant_modes(std::vector<std::vector<bool>> & constant_modes,
122 std::vector<std::vector<double>> & constant_modes_values) const = 0;
123};
124
125} // namespace ExaDG
126
127#endif /* EXADG_OPERATORS_MULTIGRID_OPERATOR_BASE_H_ */
Definition driver.cpp:33