ExaDG
Loading...
Searching...
No Matches
mass_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_MASS_OPERATOR_H_
23#define EXADG_OPERATORS_MASS_OPERATOR_H_
24
25// ExaDG
26#include <exadg/matrix_free/integrators.h>
27#include <exadg/operators/mass_kernel.h>
28#include <exadg/operators/operator_base.h>
29#include <exadg/operators/variable_coefficients.h>
30
31namespace ExaDG
32{
33template<int dim, typename Number>
34struct MassOperatorData : public OperatorBaseData
35{
36 MassOperatorData()
37 : OperatorBaseData(),
38 coefficient_is_variable(false),
39 variable_coefficients(nullptr),
40 consider_inverse_coefficient(false)
41 {
42 }
43
44 // variable coefficients
45 bool coefficient_is_variable;
46 VariableCoefficients<dealii::VectorizedArray<Number>> const * variable_coefficients;
47 // use the inverse of the coefficients stored in `variable_coefficients`
48 bool consider_inverse_coefficient;
49};
50
51template<int dim, int n_components, typename Number>
52class MassOperator : public OperatorBase<dim, Number, n_components>
53{
54public:
55 typedef Number value_type;
56
57 typedef OperatorBase<dim, Number, n_components> Base;
58
59 typedef typename Base::VectorType VectorType;
60 typedef typename Base::IntegratorCell IntegratorCell;
61
62 MassOperator();
63
64 void
65 initialize(dealii::MatrixFree<dim, Number> const & matrix_free,
66 dealii::AffineConstraints<Number> const & affine_constraints,
68
69 void
70 set_scaling_factor(Number const & number);
71
72 void
73 apply_scale(VectorType & dst, Number const & factor, VectorType const & src) const;
74
75 void
76 apply_scale_add(VectorType & dst, Number const & factor, VectorType const & src) const;
77
78private:
79 void
80 do_cell_integral(IntegratorCell & integrator) const final;
81
83
84 mutable double scaling_factor;
85
86 // Variable coefficients not managed by this class.
88};
89
90} // namespace ExaDG
91
92#endif /* EXADG_OPERATORS_MASS_OPERATOR_H_ */
Definition mass_kernel.h:35
Definition variable_coefficients.h:40
Definition driver.cpp:33
Definition mass_operator.h:35