Debian Codegraph @

include/deal.II/base/polynomials_abf.h

raw
1 // ------------------------------------------------------------------------
2 //
3 // SPDX-License-Identifier: LGPL-2.1-or-later
4 // Copyright (C) 2004 - 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 #ifndef dealii_polynomials_abf_h
16 #define dealii_polynomials_abf_h
17
18
19 #include <deal.II/base/config.h>
20
21 #include <deal.II/base/exceptions.h>
22 #include <deal.II/base/mutex.h>
23 #include <deal.II/base/point.h>
24 #include <deal.II/base/polynomial.h>
25 #include <deal.II/base/polynomial_space.h>
26 #include <deal.II/base/tensor.h>
27 #include <deal.II/base/tensor_polynomials_base.h>
28 #include <deal.II/base/tensor_product_polynomials.h>
29
30 #include <memory>
31 #include <vector>
32
33 DEAL_II_NAMESPACE_OPEN
34
35 /**
36 * This class implements the <i>H<sup>div</sup></i>-conforming, vector-valued
37 * Arnold-Boffi-Falk polynomials as described in the article by Arnold, Boffi,
38 * and Falk: Quadrilateral H(div) finite elements, SIAM J. Numer. Anal., Vol.
39 * 42, No. 6, pp.2429-2451
40 *
41 *
42 * The ABF polynomials are constructed such that the divergence is in the
43 * tensor product polynomial space <i>Q<sub>k</sub></i>. Therefore, the
44 * polynomial order of each component must be two orders higher in the
45 * corresponding direction, yielding the polynomial spaces
46 * <i>(Q<sub>k+2,k</sub>, Q<sub>k,k+2</sub>)</i> and <i>(Q<sub>k+2,k,k</sub>,
47 * Q<sub>k,k+2,k</sub>, Q<sub>k,k,k+2</sub>)</i> in 2d and 3d, resp.
48 *
49 * @ingroup Polynomials
50 */
51 template <int dim>
52 class PolynomialsABF : public TensorPolynomialsBase<dim>
53 {
54 public:
55 /**
56 * Constructor. Creates all basis functions for Raviart-Thomas polynomials
57 * of given degree.
58 *
59 * @arg k: the degree of the Raviart-Thomas-space, which is the degree of
60 * the largest tensor product polynomial space <i>Q<sub>k</sub></i>
61 * contained.
62 */
63 PolynomialsABF(const unsigned int k);
64
65 /**
66 * Compute the value and the first and second derivatives of each
67 * Raviart-Thomas polynomial at @p unit_point.
68 *
69 * The size of the vectors must either be zero or equal <tt>n()</tt>. In
70 * the first case, the function will not compute these values.
71 */
72 void
73 evaluate(const Point<dim> &unit_point,
74 std::vector<Tensor<1, dim>> &values,
75 std::vector<Tensor<2, dim>> &grads,
76 std::vector<Tensor<3, dim>> &grad_grads,
77 std::vector<Tensor<4, dim>> &third_derivatives,
78 std::vector<Tensor<5, dim>> &fourth_derivatives) const override;
79
80 /**
81 * Return the name of the space, which is <tt>ABF</tt>.
82 */
83 std::string
84 name() const override;
85
86 /**
87 * Return the number of polynomials in the space <tt>RT(degree)</tt> without
88 * requiring to build an object of PolynomialsABF. This is required by the
89 * FiniteElement classes.
90 */
91 static unsigned int
92 n_polynomials(const unsigned int degree);
93
94 /**
95 * @copydoc TensorPolynomialsBase::clone()
96 */
97 virtual std::unique_ptr<TensorPolynomialsBase<dim>>
98 clone() const override;
99
100 private:
101 /**
102 * An object representing the polynomial space for a single component. We
103 * can re-use it for the other vector components by rotating the
104 * coordinates of the evaluation point.
105 */
106 const AnisotropicPolynomials<dim> polynomial_space;
107
108 /**
109 * A mutex that guards the following scratch arrays.
110 */
111 mutable Threads::Mutex mutex;
112
113 /**
114 * Auxiliary memory.
115 */
116 mutable std::vector<double> p_values;
117
118 /**
119 * Auxiliary memory.
120 */
121 mutable std::vector<Tensor<1, dim>> p_grads;
122
123 /**
124 * Auxiliary memory.
125 */
126 mutable std::vector<Tensor<2, dim>> p_grad_grads;
127
128 /**
129 * Auxiliary memory.
130 */
131 mutable std::vector<Tensor<3, dim>> p_third_derivatives;
132
133 /**
134 * Auxiliary memory.
135 */
136 mutable std::vector<Tensor<4, dim>> p_fourth_derivatives;
137 };
138
139
140 template <int dim>
141 inline std::string
142 PolynomialsABF<dim>::name() const
143 {
144 return "ABF";
145 }
146
147
148 DEAL_II_NAMESPACE_CLOSE
149
150 #endif