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