ExaDG
Loading...
Searching...
No Matches
elementwise_operator.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_ELEMENTWISE_OPERATOR_H_
23#define EXADG_OPERATORS_ELEMENTWISE_OPERATOR_H_
24
25// ExaDG
26#include <exadg/solvers_and_preconditioners/solvers/elementwise_krylov_solvers.h>
27
28namespace ExaDG
29{
30namespace Elementwise
31{
32template<int dim, typename Number, typename Operator>
33class OperatorBase
34{
35public:
36 OperatorBase(Operator const & operator_in) : op(operator_in), current_cell(1), problem_size(1)
37 {
38 }
39
40 dealii::MatrixFree<dim, Number> const &
41 get_matrix_free() const
42 {
43 return op.get_matrix_free();
44 }
45
46 unsigned int
47 get_dof_index() const
48 {
49 return op.get_dof_index();
50 }
51
52 unsigned int
53 get_quad_index() const
54 {
55 return op.get_quad_index();
56 }
57
58 void
59 setup(unsigned int const cell, unsigned int const size)
60 {
61 current_cell = cell;
62
63 problem_size = size;
64 }
65
66 unsigned int
67 get_problem_size() const
68 {
69 return problem_size;
70 }
71
72 void
73 vmult(dealii::VectorizedArray<Number> * dst, dealii::VectorizedArray<Number> * src) const
74 {
75 // set dst vector to zero
76 Elementwise::vector_init(dst, problem_size);
77
78 // evaluate block diagonal
79 op.apply_add_block_diagonal_elementwise(current_cell, dst, src, problem_size);
80 }
81
82private:
83 Operator const & op;
84
85 unsigned int current_cell;
86
87 unsigned int problem_size;
88};
89
90} // namespace Elementwise
91} // namespace ExaDG
92
93#endif /* EXADG_OPERATORS_ELEMENTWISE_OPERATOR_H_ */
Definition driver.cpp:33