| 1 |
// ------------------------------------------------------------------------ |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: LGPL-2.1-or-later |
| 4 |
// Copyright (C) 2022 - 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_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_face.h> |
| 23 |
#include <deal.II/matrix_free/evaluation_template_factory.h> |
| 24 |
#include <deal.II/matrix_free/evaluation_template_factory_internal.h> |
| 25 |
|
| 26 |
#include <vector> |
| 27 |
|
| 28 |
|
| 29 |
DEAL_II_NAMESPACE_OPEN |
| 30 |
|
| 31 |
namespace internal |
| 32 |
{ |
| 33 |
template <int dim, typename Number> |
| 34 |
void |
| 35 |
FEFaceEvaluationFactory<dim, Number>::evaluate( |
| 36 |
const unsigned int n_components, |
| 37 |
const EvaluationFlags::EvaluationFlags evaluation_flag, |
| 38 |
const Number *values_dofs, |
| 39 |
FEEvaluationData<dim, Number, true> &fe_eval) |
| 40 |
{ |
| 41 |
instantiation_helper_run<1, |
| 42 |
FEFaceEvaluationImplEvaluateSelector<dim, Number>>( |
| 43 |
fe_eval.get_shape_info().data[0].fe_degree, |
| 44 |
fe_eval.get_shape_info().data[0].n_q_points_1d, |
| 45 |
n_components, |
| 46 |
evaluation_flag, |
| 47 |
values_dofs, |
| 48 |
fe_eval); |
| 49 |
} |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
template <int dim, typename Number> |
| 54 |
void |
| 55 |
FEFaceEvaluationFactory<dim, Number>::project_to_face( |
| 56 |
const unsigned int n_components, |
| 57 |
const EvaluationFlags::EvaluationFlags evaluation_flag, |
| 58 |
const Number *values_dofs, |
| 59 |
FEEvaluationData<dim, Number, true> &fe_eval) |
| 60 |
{ |
| 61 |
instantiation_helper_degree_run< |
| 62 |
1, |
| 63 |
FEFaceEvaluationImplProjectToFaceSelector<dim, Number>>( |
| 64 |
fe_eval.get_shape_info().data[0].fe_degree, |
| 65 |
n_components, |
| 66 |
evaluation_flag, |
| 67 |
values_dofs, |
| 68 |
fe_eval); |
| 69 |
} |
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
template <int dim, typename Number> |
| 74 |
void |
| 75 |
FEFaceEvaluationFactory<dim, Number>::evaluate_in_face( |
| 76 |
const unsigned int n_components, |
| 77 |
const EvaluationFlags::EvaluationFlags evaluation_flag, |
| 78 |
FEEvaluationData<dim, Number, true> &fe_eval) |
| 79 |
{ |
| 80 |
instantiation_helper_run< |
| 81 |
1, |
| 82 |
FEFaceEvaluationImplEvaluateInFaceSelector<dim, Number>>( |
| 83 |
fe_eval.get_shape_info().data[0].fe_degree, |
| 84 |
fe_eval.get_shape_info().data[0].n_q_points_1d, |
| 85 |
n_components, |
| 86 |
evaluation_flag, |
| 87 |
fe_eval); |
| 88 |
} |
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
template <int dim, typename Number> |
| 93 |
void |
| 94 |
FEFaceEvaluationFactory<dim, Number>::integrate( |
| 95 |
const unsigned int n_components, |
| 96 |
const EvaluationFlags::EvaluationFlags integration_flag, |
| 97 |
Number *values_dofs, |
| 98 |
FEEvaluationData<dim, Number, true> &fe_eval, |
| 99 |
const bool sum_into_values) |
| 100 |
{ |
| 101 |
instantiation_helper_run< |
| 102 |
1, |
| 103 |
FEFaceEvaluationImplIntegrateSelector<dim, Number>>( |
| 104 |
fe_eval.get_shape_info().data[0].fe_degree, |
| 105 |
fe_eval.get_shape_info().data[0].n_q_points_1d, |
| 106 |
n_components, |
| 107 |
integration_flag, |
| 108 |
values_dofs, |
| 109 |
fe_eval, |
| 110 |
sum_into_values); |
| 111 |
} |
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
template <int dim, typename Number> |
| 116 |
void |
| 117 |
FEFaceEvaluationFactory<dim, Number>::collect_from_face( |
| 118 |
const unsigned int n_components, |
| 119 |
const EvaluationFlags::EvaluationFlags integration_flag, |
| 120 |
Number *values_dofs, |
| 121 |
FEEvaluationData<dim, Number, true> &fe_eval, |
| 122 |
const bool sum_into_values) |
| 123 |
{ |
| 124 |
instantiation_helper_degree_run< |
| 125 |
1, |
| 126 |
FEFaceEvaluationImplCollectFromFaceSelector<dim, Number>>( |
| 127 |
fe_eval.get_shape_info().data[0].fe_degree, |
| 128 |
n_components, |
| 129 |
integration_flag, |
| 130 |
values_dofs, |
| 131 |
fe_eval, |
| 132 |
sum_into_values); |
| 133 |
} |
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
template <int dim, typename Number> |
| 138 |
void |
| 139 |
FEFaceEvaluationFactory<dim, Number>::integrate_in_face( |
| 140 |
const unsigned int n_components, |
| 141 |
const EvaluationFlags::EvaluationFlags integration_flag, |
| 142 |
FEEvaluationData<dim, Number, true> &fe_eval) |
| 143 |
{ |
| 144 |
instantiation_helper_run< |
| 145 |
1, |
| 146 |
FEFaceEvaluationImplIntegrateInFaceSelector<dim, Number>>( |
| 147 |
fe_eval.get_shape_info().data[0].fe_degree, |
| 148 |
fe_eval.get_shape_info().data[0].n_q_points_1d, |
| 149 |
n_components, |
| 150 |
integration_flag, |
| 151 |
fe_eval); |
| 152 |
} |
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
template <int dim, typename Number, typename VectorizedArrayType> |
| 157 |
void |
| 158 |
FEFaceEvaluationGatherFactory<dim, Number, VectorizedArrayType>::evaluate( |
| 159 |
const unsigned int n_components, |
| 160 |
const EvaluationFlags::EvaluationFlags evaluation_flag, |
| 161 |
const Number *src_ptr, |
| 162 |
const std::vector<ArrayView<const Number>> *sm_ptr, |
| 163 |
FEEvaluationData<dim, VectorizedArrayType, true> &fe_eval) |
| 164 |
{ |
| 165 |
instantiation_helper_run< |
| 166 |
1, |
| 167 |
FEFaceEvaluationImplGatherEvaluateSelector<dim, |
| 168 |
Number, |
| 169 |
VectorizedArrayType>>( |
| 170 |
fe_eval.get_shape_info().data[0].fe_degree, |
| 171 |
fe_eval.get_shape_info().data[0].n_q_points_1d, |
| 172 |
n_components, |
| 173 |
evaluation_flag, |
| 174 |
src_ptr, |
| 175 |
sm_ptr, |
| 176 |
fe_eval); |
| 177 |
} |
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
template <int dim, typename Number, typename VectorizedArrayType> |
| 182 |
void |
| 183 |
FEFaceEvaluationGatherFactory<dim, Number, VectorizedArrayType>::integrate( |
| 184 |
const unsigned int n_components, |
| 185 |
const EvaluationFlags::EvaluationFlags integration_flag, |
| 186 |
Number *dst_ptr, |
| 187 |
const std::vector<ArrayView<const Number>> *sm_ptr, |
| 188 |
FEEvaluationData<dim, VectorizedArrayType, true> &fe_eval) |
| 189 |
{ |
| 190 |
instantiation_helper_run< |
| 191 |
1, |
| 192 |
FEFaceEvaluationImplIntegrateScatterSelector<dim, |
| 193 |
Number, |
| 194 |
VectorizedArrayType>>( |
| 195 |
fe_eval.get_shape_info().data[0].fe_degree, |
| 196 |
fe_eval.get_shape_info().data[0].n_q_points_1d, |
| 197 |
n_components, |
| 198 |
integration_flag, |
| 199 |
dst_ptr, |
| 200 |
sm_ptr, |
| 201 |
fe_eval); |
| 202 |
} |
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
// It is important that this file sits in the same compilation unit as the |
| 207 |
// evaluate() and integrate() calls of this class, to ensure that all |
| 208 |
// options choose the same code path when compiling FEFaceEvaluationFactory |
| 209 |
// outside of deal.II. |
| 210 |
template <int dim, typename Number> |
| 211 |
bool |
| 212 |
FEFaceEvaluationFactory<dim, Number>::fast_evaluation_supported( |
| 213 |
const unsigned int given_degree, |
| 214 |
const unsigned int n_q_points_1d) |
| 215 |
{ |
| 216 |
return instantiation_helper_run<1, FastEvaluationSupported>(given_degree, |
| 217 |
n_q_points_1d); |
| 218 |
} |
| 219 |
} // end of namespace internal |
| 220 |
|
| 221 |
DEAL_II_NAMESPACE_CLOSE |
| 222 |
|
| 223 |
#endif |