deal.II version GIT relicensing-2167-g9622207b8f 2024-11-21 12:40:00+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
evaluation_template_factory_internal.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2021 - 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_internal_h
17#define dealii_matrix_free_evaluation_template_factory_internal_h
18
19
20#include <deal.II/base/config.h>
21
22#ifndef FE_EVAL_FACTORY_DEGREE_MAX
23# define FE_EVAL_FACTORY_DEGREE_MAX 6
24#endif
25
27
28namespace internal
29{
36 {
37 template <int fe_degree, int n_q_points_1d>
38 static bool
40 {
41 return fe_degree != -1;
42 }
43 };
44
45 template <int degree, typename EvaluatorType, typename... Args>
46 bool
47 instantiation_helper_run(const unsigned int given_degree,
48 const unsigned int n_q_points_1d,
49 Args &...args)
50 {
51 if (given_degree == degree)
52 {
53 if (n_q_points_1d == degree + 1)
54 return EvaluatorType::template run<degree, degree + 1>(args...);
55 else if (n_q_points_1d == degree + 2)
56 return EvaluatorType::template run<degree, degree + 2>(args...);
57 else if (n_q_points_1d == degree)
58 return EvaluatorType::template run<degree, degree>(args...);
59 else if (n_q_points_1d == (3 * degree) / 2 + 1)
60 return EvaluatorType::template run<degree, (3 * degree) / 2 + 1>(
61 args...);
62 else if ((n_q_points_1d == (2 * degree)) && (degree <= 4))
63 return EvaluatorType::template run<degree, (2 * degree)>(args...);
64 else
65 // slow path
66 return EvaluatorType::template run<-1, 0>(args...);
67 }
68 else if (degree < FE_EVAL_FACTORY_DEGREE_MAX)
70 (degree < FE_EVAL_FACTORY_DEGREE_MAX ? degree + 1 : degree),
71 EvaluatorType>(given_degree, n_q_points_1d, args...);
72 else
73 // slow path
74 return EvaluatorType::template run<-1, 0>(args...);
75 }
76
77 template <int degree, typename EvaluatorType, typename... Args>
78 bool
79 instantiation_helper_degree_run(const unsigned int given_degree,
80 Args &...args)
81 {
82 if (given_degree == degree)
83 {
84 return EvaluatorType::template run<degree>(args...);
85 }
86 else if (degree < FE_EVAL_FACTORY_DEGREE_MAX)
88 (degree < FE_EVAL_FACTORY_DEGREE_MAX ? degree + 1 : degree),
89 EvaluatorType>(given_degree, args...);
90 else
91 // slow path
92 return EvaluatorType::template run<-1>(args...);
93 }
94
95} // end of namespace internal
96
98
99#endif
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:498
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:499
#define FE_EVAL_FACTORY_DEGREE_MAX
bool instantiation_helper_degree_run(const unsigned int given_degree, Args &...args)
bool instantiation_helper_run(const unsigned int given_degree, const unsigned int n_q_points_1d, Args &...args)