Debian Codegraph @

include/deal.II/matrix_free/evaluation_template_factory.templates.h

raw
1 // ------------------------------------------------------------------------
2 //
3 // SPDX-License-Identifier: LGPL-2.1-or-later
4 // Copyright (C) 2020 - 2023 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_template_factory_templates_h
17 #define dealii_matrix_free_evaluation_template_factory_templates_h
18
19
20 #include <deal.II/base/config.h>
21
22 #include <deal.II/matrix_free/evaluation_kernels.h>
23 #include <deal.II/matrix_free/evaluation_selector.h>
24 #include <deal.II/matrix_free/evaluation_template_factory.h>
25 #include <deal.II/matrix_free/evaluation_template_factory_internal.h>
26
27 DEAL_II_NAMESPACE_OPEN
28
29 namespace internal
30 {
31 template <int dim, typename Number>
32 void
33 FEEvaluationFactory<dim, Number>::evaluate(
34 const unsigned int n_components,
35 const EvaluationFlags::EvaluationFlags evaluation_flag,
36 const Number *values_dofs,
37 FEEvaluationData<dim, Number, false> &fe_eval)
38 {
39 instantiation_helper_run<1, FEEvaluationImplSelector<dim, Number, false>>(
40 fe_eval.get_shape_info().data[0].fe_degree,
41 fe_eval.get_shape_info().data[0].n_q_points_1d,
42 n_components,
43 evaluation_flag,
44 values_dofs,
45 fe_eval);
46 }
47
48
49
50 template <int dim, typename Number>
51 void
52 FEEvaluationFactory<dim, Number>::integrate(
53 const unsigned int n_components,
54 const EvaluationFlags::EvaluationFlags integration_flag,
55 Number *values_dofs,
56 FEEvaluationData<dim, Number, false> &fe_eval,
57 const bool sum_into_values_array)
58 {
59 instantiation_helper_run<1, FEEvaluationImplSelector<dim, Number, true>>(
60 fe_eval.get_shape_info().data[0].fe_degree,
61 fe_eval.get_shape_info().data[0].n_q_points_1d,
62 n_components,
63 integration_flag,
64 values_dofs,
65 fe_eval,
66 sum_into_values_array);
67 }
68
69
70
71 // It is important that this file sits in the same compilation unit as the
72 // evaluate() and integrate() calls of this class, to ensure that all
73 // options choose the same code path when compiling FEFaceEvaluationFactory
74 // outside of deal.II.
75 template <int dim, typename Number>
76 bool
77 FEEvaluationFactory<dim, Number>::fast_evaluation_supported(
78 const unsigned int given_degree,
79 const unsigned int n_q_points_1d)
80 {
81 return instantiation_helper_run<1, FastEvaluationSupported>(given_degree,
82 n_q_points_1d);
83 }
84
85
86
87 template <int dim, typename Number>
88 void
89 CellwiseInverseMassFactory<dim, Number>::apply(
90 const unsigned int n_components,
91 const FEEvaluationData<dim, Number, false> &fe_eval,
92 const Number *in_array,
93 Number *out_array)
94 {
95 const unsigned int fe_degree = fe_eval.get_shape_info().data[0].fe_degree;
96 instantiation_helper_run<1,
97 CellwiseInverseMassMatrixImplBasic<dim, Number>>(
98 fe_degree, fe_degree + 1, n_components, fe_eval, in_array, out_array);
99 }
100
101
102
103 template <int dim, typename Number>
104 void
105 CellwiseInverseMassFactory<dim, Number>::apply(
106 const unsigned int n_components,
107 const FEEvaluationData<dim, Number, false> &fe_eval,
108 const ArrayView<const Number> &inverse_coefficients,
109 const bool dyadic_coefficients,
110 const Number *in_array,
111 Number *out_array)
112 {
113 const unsigned int fe_degree = fe_eval.get_shape_info().data[0].fe_degree;
114 instantiation_helper_run<
115 1,
116 CellwiseInverseMassMatrixImplFlexible<dim, Number>>(fe_degree,
117 fe_degree + 1,
118 n_components,
119 fe_eval,
120 inverse_coefficients,
121 dyadic_coefficients,
122 in_array,
123 out_array);
124 }
125
126
127
128 template <int dim, typename Number>
129 void
130 CellwiseInverseMassFactory<dim, Number>::transform_from_q_points_to_basis(
131 const unsigned int n_components,
132 const FEEvaluationData<dim, Number, false> &fe_eval,
133 const Number *in_array,
134 Number *out_array)
135 {
136 const unsigned int fe_degree = fe_eval.get_shape_info().data[0].fe_degree;
137 const unsigned int n_q_points_1d =
138 fe_eval.get_shape_info().data[0].n_q_points_1d;
139 instantiation_helper_run<
140 1,
141 CellwiseInverseMassMatrixImplTransformFromQPoints<dim, Number>>(
142 fe_degree, n_q_points_1d, n_components, fe_eval, in_array, out_array);
143 }
144
145 } // end of namespace internal
146
147 DEAL_II_NAMESPACE_CLOSE
148
149 #endif