ExaDG
Loading...
Searching...
No Matches
boundary_face_integrator_base.h
1/* ______________________________________________________________________
2 *
3 * ExaDG - High-Order Discontinuous Galerkin for the Exa-Scale
4 *
5 * Copyright (C) 2023 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_FUNCTIONS_AND_BOUNDARY_CONDITIONS_BOUNDARY_FACE_INTEGRATOR_BASE_H_
23#define EXADG_FUNCTIONS_AND_BOUNDARY_CONDITIONS_BOUNDARY_FACE_INTEGRATOR_BASE_H_
24
25// deal.II
26#include <deal.II/matrix_free/matrix_free.h>
27
28// ExaDG
29#include <exadg/utilities/enum_utilities.h>
30
31namespace ExaDG
32{
38template<typename BoundaryDescriptorType, typename Number>
39class BoundaryFaceIntegratorBase
40{
41 using BoundaryType = typename BoundaryDescriptorType::boundary_type;
42 static constexpr int dim = BoundaryDescriptorType::dimension;
43
44public:
45 void
46 reinit(unsigned int const face, Number const time)
47 {
48 evaluation_time = time;
49
50 auto const boundary_id_new = matrix_free.get_boundary_id(face);
51
52 // only update boundary_type if needed to avoid an unnecessary search in boundary_descriptor
53 if(boundary_id_new != boundary_id)
54 {
55 boundary_id = boundary_id_new;
56 boundary_type = boundary_descriptor.get_boundary_type(boundary_id);
57 }
58 }
59
60 // A corresponding function has to be implemented in the deriving class.
61 // The return type varies dependent on the value type.
62 // auto
63 // get_value();
64
65protected:
66 BoundaryFaceIntegratorBase(dealii::MatrixFree<dim, Number> const & matrix_free_in,
67 BoundaryDescriptorType const & boundary_descriptor_in)
68 : matrix_free(matrix_free_in),
69 boundary_descriptor(boundary_descriptor_in),
70 evaluation_time(Number{0.0}),
71 boundary_id(dealii::numbers::invalid_boundary_id),
73 {
74 }
75
76 dealii::MatrixFree<dim, Number> const & matrix_free;
77 BoundaryDescriptorType const & boundary_descriptor;
78
79 Number evaluation_time;
80 dealii::types::boundary_id boundary_id;
81 BoundaryType boundary_type;
82};
83
84} // namespace ExaDG
85
86#endif /* EXADG_FUNCTIONS_AND_BOUNDARY_CONDITIONS_BOUNDARY_FACE_INTEGRATOR_BASE_H_ */
EnumType default_constructor()
Returns the first value of EnumType. This is well-defined as compared to EnumType().
Definition enum_utilities.h:52
Definition driver.cpp:33