Debian Codegraph @

include/deal.II/matrix_free/evaluation_selector.h

raw
1 // ------------------------------------------------------------------------
2 //
3 // SPDX-License-Identifier: LGPL-2.1-or-later
4 // Copyright (C) 2017 - 2025 by the deal.II authors
5 //
6 // This file is part of the deal.II library.
7 //
8 // Part of the source code is dual licensed under Apache-2.0 WITH
9 // LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10 // governing the source code and code contributions can be found in
11 // LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12 //
13 // ------------------------------------------------------------------------
14
15
16 #ifndef dealii_matrix_free_evaluation_selector_h
17 #define dealii_matrix_free_evaluation_selector_h
18
19 #include <deal.II/base/config.h>
20
21 #include <deal.II/matrix_free/evaluation_flags.h>
22 #include <deal.II/matrix_free/evaluation_kernels.h>
23 #include <deal.II/matrix_free/shape_info.h>
24
25 #include <type_traits>
26
27
28 DEAL_II_NAMESPACE_OPEN
29
30
31
32 /**
33 * This class chooses an appropriate evaluation strategy based on the template
34 * parameters and the shape_info variable, providing a short-cut to some
35 * internal functions.
36 */
37 template <int dim, int fe_degree, int n_q_points_1d, typename Number>
38 struct SelectEvaluator
39 {
40 /**
41 * Chooses an appropriate evaluation strategy for the evaluate function, i.e.
42 * this calls internal::FEEvaluationImpl::evaluate(),
43 * internal::FEEvaluationImplCollocation::evaluate() or
44 * internal::FEEvaluationImplTransformToCollocation::evaluate() with
45 * appropriate template parameters.
46 */
47 static void
48 evaluate(const unsigned int n_components,
49 const EvaluationFlags::EvaluationFlags evaluation_flag,
50 const Number *values_dofs,
51 FEEvaluationData<dim, Number, false> &eval);
52
53 /**
54 * Chooses an appropriate evaluation strategy for the integrate function, i.e.
55 * this calls internal::FEEvaluationImpl::integrate(),
56 * internal::FEEvaluationImplCollocation::integrate() or
57 * internal::FEEvaluationImplTransformToCollocation::integrate() with
58 * appropriate template parameters.
59 */
60 static void
61 integrate(const unsigned int n_components,
62 const EvaluationFlags::EvaluationFlags integration_flag,
63 Number *values_dofs,
64 FEEvaluationData<dim, Number, false> &eval,
65 const bool sum_into_values_array = false);
66 };
67
68 //----------------------Implementation for SelectEvaluator---------------------
69 #ifndef DOXYGEN
70
71 template <int dim, int fe_degree, int n_q_points_1d, typename Number>
72 inline void
73 SelectEvaluator<dim, fe_degree, n_q_points_1d, Number>::evaluate(
74 const unsigned int n_components,
75 const EvaluationFlags::EvaluationFlags evaluation_flag,
76 const Number *values_dofs,
77 FEEvaluationData<dim, Number, false> &eval)
78 {
79 Assert(fe_degree >= 0 && n_q_points_1d > 0, ExcInternalError());
80
81 internal::FEEvaluationImplSelector<dim, Number, false>::template run<
82 fe_degree,
83 n_q_points_1d>(n_components, evaluation_flag, values_dofs, eval);
84 }
85
86
87
88 template <int dim, int fe_degree, int n_q_points_1d, typename Number>
89 inline void
90 SelectEvaluator<dim, fe_degree, n_q_points_1d, Number>::integrate(
91 const unsigned int n_components,
92 const EvaluationFlags::EvaluationFlags integration_flag,
93 Number *values_dofs,
94 FEEvaluationData<dim, Number, false> &eval,
95 const bool sum_into_values_array)
96 {
97 Assert(fe_degree >= 0 && n_q_points_1d > 0, ExcInternalError());
98
99 internal::FEEvaluationImplSelector<dim, Number, true>::
100 template run<fe_degree, n_q_points_1d>(
101 n_components, integration_flag, values_dofs, eval, sum_into_values_array);
102 }
103 #endif // DOXYGEN
104
105 DEAL_II_NAMESPACE_CLOSE
106
107 #endif