Reference documentation for deal.II version GIT relicensing-1054-gedd46abbd6 2024-07-12 01:20:01+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
polynomials_wedge.cc
Go to the documentation of this file.
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
18
20
21namespace
22{
23 unsigned int
24 compute_n_polynomials_wedge(const unsigned int dim, const unsigned int degree)
25 {
26 if (dim == 3)
27 {
28 if (degree == 1)
29 return 6;
30 if (degree == 2)
31 return 18;
32 }
33
35
36 return 0;
37 }
38} // namespace
39
40
41
42template <int dim>
44 const unsigned int degree)
45 : ScalarPolynomialsBase<dim>(degree, compute_n_polynomials_wedge(dim, degree))
46 , poly_tri(BarycentricPolynomials<2>::get_fe_p_basis(degree))
47 , poly_line(BarycentricPolynomials<1>::get_fe_p_basis(degree))
48{}
49
50
51
52template <int dim>
53double
55 const Point<dim> &p) const
56{
57 const auto pair = this->degree() == 1 ? internal::wedge_table_1[i] :
59
60 const Point<2> p_tri(p[0], p[1]);
61 const auto v_tri = poly_tri.compute_value(pair[0], p_tri);
62
63 const Point<1> p_line(p[2]);
64 const auto v_line = poly_line.compute_value(pair[1], p_line);
65
66 return v_tri * v_line;
67}
68
69
70
71template <int dim>
74 const Point<dim> &p) const
75{
76 const auto pair = this->degree() == 1 ? internal::wedge_table_1[i] :
78
79 const Point<2> p_tri(p[0], p[1]);
80 const auto v_tri = poly_tri.compute_value(pair[0], p_tri);
81 const auto g_tri = poly_tri.compute_grad(pair[0], p_tri);
82
83 const Point<1> p_line(p[2]);
84 const auto v_line = poly_line.compute_value(pair[1], p_line);
85 const auto g_line = poly_line.compute_grad(pair[1], p_line);
86
87 Tensor<1, dim> grad;
88 grad[0] = g_tri[0] * v_line;
89 grad[1] = g_tri[1] * v_line;
90 grad[2] = v_tri * g_line[0];
91
92 return grad;
93}
94
95
96
97template <int dim>
100 const Point<dim> &p) const
101{
102 (void)i;
103 (void)p;
104
106 return Tensor<2, dim>();
107}
108
109
110
111template <int dim>
112void
114 const Point<dim> &unit_point,
115 std::vector<double> &values,
116 std::vector<Tensor<1, dim>> &grads,
117 std::vector<Tensor<2, dim>> &grad_grads,
118 std::vector<Tensor<3, dim>> &third_derivatives,
119 std::vector<Tensor<4, dim>> &fourth_derivatives) const
120{
121 (void)grads;
122 (void)grad_grads;
123 (void)third_derivatives;
124 (void)fourth_derivatives;
125
126 if (values.size() == this->n())
127 for (unsigned int i = 0; i < this->n(); ++i)
128 values[i] = compute_value(i, unit_point);
129
130 if (grads.size() == this->n())
131 for (unsigned int i = 0; i < this->n(); ++i)
132 grads[i] = compute_grad(i, unit_point);
133}
134
135
136
137template <int dim>
140 const unsigned int i,
141 const Point<dim> &p) const
142{
143 return compute_grad(i, p);
144}
145
146
147
148template <int dim>
151 const unsigned int i,
152 const Point<dim> &p) const
153{
154 (void)i;
155 (void)p;
156
158
159 return {};
160}
161
162
163
164template <int dim>
167 const unsigned int i,
168 const Point<dim> &p) const
169{
170 (void)i;
171 (void)p;
172
174
175 return {};
176}
177
178
179
180template <int dim>
183 const unsigned int i,
184 const Point<dim> &p) const
185{
186 (void)i;
187 (void)p;
188
190
191 return {};
192}
193
194
195
196template <int dim>
197std::string
199{
200 return "ScalarLagrangePolynomialWedge";
201}
202
203
204
205template <int dim>
206std::unique_ptr<ScalarPolynomialsBase<dim>>
208{
209 return std::make_unique<ScalarLagrangePolynomialWedge<dim>>(*this);
210}
211
212
213
217
Definition point.h:111
void evaluate(const Point< dim > &unit_point, std::vector< double > &values, std::vector< Tensor< 1, dim > > &grads, std::vector< Tensor< 2, dim > > &grad_grads, std::vector< Tensor< 3, dim > > &third_derivatives, std::vector< Tensor< 4, dim > > &fourth_derivatives) const override
Tensor< 1, dim > compute_grad(const unsigned int i, const Point< dim > &p) const override
Tensor< 1, dim > compute_1st_derivative(const unsigned int i, const Point< dim > &p) const override
Tensor< 4, dim > compute_4th_derivative(const unsigned int i, const Point< dim > &p) const override
std::string name() const override
Tensor< 3, dim > compute_3rd_derivative(const unsigned int i, const Point< dim > &p) const override
Tensor< 2, dim > compute_2nd_derivative(const unsigned int i, const Point< dim > &p) const override
ScalarLagrangePolynomialWedge(const unsigned int degree)
virtual std::unique_ptr< ScalarPolynomialsBase< dim > > clone() const override
double compute_value(const unsigned int i, const Point< dim > &p) const override
Tensor< 2, dim > compute_grad_grad(const unsigned int i, const Point< dim > &p) const override
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:502
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:503
#define DEAL_II_NOT_IMPLEMENTED()
static const constexpr ::ndarray< unsigned int, 18, 2 > wedge_table_2
static const constexpr ::ndarray< unsigned int, 6, 2 > wedge_table_1