| 1 |
// ------------------------------------------------------------------------ |
| 2 |
// |
| 3 |
// SPDX-License-Identifier: LGPL-2.1-or-later |
| 4 |
// Copyright (C) 2020 - 2024 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_h |
| 17 |
#define dealii_matrix_free_evaluation_template_factory_h |
| 18 |
|
| 19 |
|
| 20 |
#include <deal.II/base/config.h> |
| 21 |
|
| 22 |
#include <deal.II/matrix_free/dof_info.h> |
| 23 |
#include <deal.II/matrix_free/evaluation_flags.h> |
| 24 |
#include <deal.II/matrix_free/shape_info.h> |
| 25 |
|
| 26 |
|
| 27 |
DEAL_II_NAMESPACE_OPEN |
| 28 |
|
| 29 |
|
| 30 |
template <int, typename, bool> |
| 31 |
class FEEvaluationData; |
| 32 |
|
| 33 |
|
| 34 |
namespace internal |
| 35 |
{ |
| 36 |
template <int dim, typename Number> |
| 37 |
struct FEEvaluationFactory |
| 38 |
{ |
| 39 |
static void |
| 40 |
evaluate(const unsigned int n_components, |
| 41 |
const EvaluationFlags::EvaluationFlags evaluation_flag, |
| 42 |
const Number *values_dofs, |
| 43 |
FEEvaluationData<dim, Number, false> &fe_eval); |
| 44 |
|
| 45 |
static void |
| 46 |
integrate(const unsigned int n_components, |
| 47 |
const EvaluationFlags::EvaluationFlags integration_flag, |
| 48 |
Number *values_dofs, |
| 49 |
FEEvaluationData<dim, Number, false> &fe_eval, |
| 50 |
const bool sum_into_values_array); |
| 51 |
|
| 52 |
static bool |
| 53 |
fast_evaluation_supported(const unsigned int given_degree, |
| 54 |
const unsigned int n_q_points_1d); |
| 55 |
}; |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
template <int dim, typename Number> |
| 60 |
struct FEFaceEvaluationFactory |
| 61 |
{ |
| 62 |
static void |
| 63 |
evaluate(const unsigned int n_components, |
| 64 |
const EvaluationFlags::EvaluationFlags evaluation_flag, |
| 65 |
const Number *values_dofs, |
| 66 |
FEEvaluationData<dim, Number, true> &fe_eval); |
| 67 |
|
| 68 |
static void |
| 69 |
project_to_face(const unsigned int n_components, |
| 70 |
const EvaluationFlags::EvaluationFlags evaluation_flag, |
| 71 |
const Number *values_dofs, |
| 72 |
FEEvaluationData<dim, Number, true> &fe_eval); |
| 73 |
|
| 74 |
static void |
| 75 |
evaluate_in_face(const unsigned int n_components, |
| 76 |
const EvaluationFlags::EvaluationFlags evaluation_flag, |
| 77 |
FEEvaluationData<dim, Number, true> &fe_eval); |
| 78 |
|
| 79 |
static void |
| 80 |
integrate(const unsigned int n_components, |
| 81 |
const EvaluationFlags::EvaluationFlags integration_flag, |
| 82 |
Number *values_dofs, |
| 83 |
FEEvaluationData<dim, Number, true> &fe_eval, |
| 84 |
const bool sum_into_values); |
| 85 |
|
| 86 |
static void |
| 87 |
collect_from_face(const unsigned int n_components, |
| 88 |
const EvaluationFlags::EvaluationFlags integration_flag, |
| 89 |
Number *values_dofs, |
| 90 |
FEEvaluationData<dim, Number, true> &fe_eval, |
| 91 |
const bool sum_into_values); |
| 92 |
|
| 93 |
static void |
| 94 |
integrate_in_face(const unsigned int n_components, |
| 95 |
const EvaluationFlags::EvaluationFlags integration_flag, |
| 96 |
FEEvaluationData<dim, Number, true> &fe_eval); |
| 97 |
|
| 98 |
static bool |
| 99 |
fast_evaluation_supported(const unsigned int given_degree, |
| 100 |
const unsigned int n_q_points_1d); |
| 101 |
}; |
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
template <int dim, typename Number, typename VectorizedArrayType> |
| 106 |
struct FEFaceEvaluationGatherFactory |
| 107 |
{ |
| 108 |
static void |
| 109 |
evaluate(const unsigned int n_components, |
| 110 |
const EvaluationFlags::EvaluationFlags evaluation_flag, |
| 111 |
const Number *src_ptr, |
| 112 |
const std::vector<ArrayView<const Number>> *sm_ptr, |
| 113 |
FEEvaluationData<dim, VectorizedArrayType, true> &fe_eval); |
| 114 |
|
| 115 |
static void |
| 116 |
integrate(const unsigned int n_components, |
| 117 |
const EvaluationFlags::EvaluationFlags integration_flag, |
| 118 |
Number *dst_ptr, |
| 119 |
const std::vector<ArrayView<const Number>> *sm_ptr, |
| 120 |
FEEvaluationData<dim, VectorizedArrayType, true> &fe_eval); |
| 121 |
}; |
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
template <int dim, typename Number> |
| 126 |
struct CellwiseInverseMassFactory |
| 127 |
{ |
| 128 |
static void |
| 129 |
apply(const unsigned int n_components, |
| 130 |
const FEEvaluationData<dim, Number, false> &fe_eval, |
| 131 |
const Number *in_array, |
| 132 |
Number *out_array); |
| 133 |
|
| 134 |
static void |
| 135 |
apply(const unsigned int n_components, |
| 136 |
const FEEvaluationData<dim, Number, false> &fe_eval, |
| 137 |
const ArrayView<const Number> &inverse_coefficients, |
| 138 |
const bool dyadic_coefficients, |
| 139 |
const Number *in_array, |
| 140 |
Number *out_array); |
| 141 |
|
| 142 |
static void |
| 143 |
transform_from_q_points_to_basis( |
| 144 |
const unsigned int n_components, |
| 145 |
const FEEvaluationData<dim, Number, false> &fe_eval, |
| 146 |
const Number *in_array, |
| 147 |
Number *out_array); |
| 148 |
}; |
| 149 |
|
| 150 |
template <int dim, |
| 151 |
typename Number, |
| 152 |
typename VectorizedArrayType = VectorizedArray<Number>> |
| 153 |
struct FEEvaluationHangingNodesFactory |
| 154 |
{ |
| 155 |
static void |
| 156 |
apply(const unsigned int n_components, |
| 157 |
const unsigned int fe_degree, |
| 158 |
const MatrixFreeFunctions::ShapeInfo<Number> &shape_info, |
| 159 |
const bool transpose, |
| 160 |
const std::array<MatrixFreeFunctions::compressed_constraint_kind, |
| 161 |
VectorizedArrayType::size()> &c_mask, |
| 162 |
VectorizedArrayType *values); |
| 163 |
}; |
| 164 |
|
| 165 |
} // end of namespace internal |
| 166 |
|
| 167 |
DEAL_II_NAMESPACE_CLOSE |
| 168 |
|
| 169 |
#endif |