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