Reference documentation for deal.II version 9.3.3
\(\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\}}\)
polynomials_wedge.cc
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (C) 2020 - 2021 by the deal.II authors
4//
5// This file is part of the deal.II library.
6//
7// The deal.II library is free software; you can use it, redistribute
8// it, and/or modify it under the terms of the GNU Lesser General
9// Public License as published by the Free Software Foundation; either
10// version 2.1 of the License, or (at your option) any later version.
11// The full text of the license can be found in the file LICENSE.md at
12// the top level directory of deal.II.
13//
14// ---------------------------------------------------------------------
15
16
20
22
23namespace
24{
25 unsigned int
26 compute_n_polynomials_wedge(const unsigned int dim, const unsigned int degree)
27 {
28 if (dim == 3)
29 {
30 if (degree == 1)
31 return 6;
32 if (degree == 2)
33 return 18;
34 }
35
36 Assert(false, ExcNotImplemented());
37
38 return 0;
39 }
40} // namespace
41
42
43
44template <int dim>
46 const unsigned int degree)
47 : ScalarPolynomialsBase<dim>(degree, compute_n_polynomials_wedge(dim, degree))
48 , poly_tri(BarycentricPolynomials<2>::get_fe_p_basis(degree))
49 , poly_line(BarycentricPolynomials<1>::get_fe_p_basis(degree))
50{}
51
52
53namespace
54{
60 static const constexpr ndarray<unsigned int, 6, 2> wedge_table_1{
61 {{{0, 0}}, {{1, 0}}, {{2, 0}}, {{0, 1}}, {{1, 1}}, {{2, 1}}}};
62
68 static const constexpr ndarray<unsigned int, 18, 2> wedge_table_2{{{{0, 0}},
69 {{1, 0}},
70 {{2, 0}},
71 {{0, 1}},
72 {{1, 1}},
73 {{2, 1}},
74 {{3, 0}},
75 {{4, 0}},
76 {{5, 0}},
77 {{3, 1}},
78 {{4, 1}},
79 {{5, 1}},
80 {{0, 2}},
81 {{1, 2}},
82 {{2, 2}},
83 {{3, 2}},
84 {{4, 2}},
85 {{5, 2}}}};
86} // namespace
87
88
89
90template <int dim>
91double
93 const Point<dim> & p) const
94{
95 const auto pair = this->degree() == 1 ? wedge_table_1[i] : wedge_table_2[i];
96
97 const Point<2> p_tri(p[0], p[1]);
98 const auto v_tri = poly_tri.compute_value(pair[0], p_tri);
99
100 const Point<1> p_line(p[2]);
101 const auto v_line = poly_line.compute_value(pair[1], p_line);
102
103 return v_tri * v_line;
104}
105
106
107
108template <int dim>
111 const Point<dim> & p) const
112{
113 const auto pair = this->degree() == 1 ? wedge_table_1[i] : wedge_table_2[i];
114
115 const Point<2> p_tri(p[0], p[1]);
116 const auto v_tri = poly_tri.compute_value(pair[0], p_tri);
117 const auto g_tri = poly_tri.compute_grad(pair[0], p_tri);
118
119 const Point<1> p_line(p[2]);
120 const auto v_line = poly_line.compute_value(pair[1], p_line);
121 const auto g_line = poly_line.compute_grad(pair[1], p_line);
122
123 Tensor<1, dim> grad;
124 grad[0] = g_tri[0] * v_line;
125 grad[1] = g_tri[1] * v_line;
126 grad[2] = v_tri * g_line[0];
127
128 return grad;
129}
130
131
132
133template <int dim>
136 const Point<dim> &p) const
137{
138 (void)i;
139 (void)p;
140
141 Assert(false, ExcNotImplemented());
142 return Tensor<2, dim>();
143}
144
145
146
147template <int dim>
148void
150 const Point<dim> & unit_point,
151 std::vector<double> & values,
152 std::vector<Tensor<1, dim>> &grads,
153 std::vector<Tensor<2, dim>> &grad_grads,
154 std::vector<Tensor<3, dim>> &third_derivatives,
155 std::vector<Tensor<4, dim>> &fourth_derivatives) const
156{
157 (void)grads;
158 (void)grad_grads;
159 (void)third_derivatives;
160 (void)fourth_derivatives;
161
162 if (values.size() == this->n())
163 for (unsigned int i = 0; i < this->n(); i++)
164 values[i] = compute_value(i, unit_point);
165
166 if (grads.size() == this->n())
167 for (unsigned int i = 0; i < this->n(); i++)
168 grads[i] = compute_grad(i, unit_point);
169}
170
171
172
173template <int dim>
176 const unsigned int i,
177 const Point<dim> & p) const
178{
179 return compute_grad(i, p);
180}
181
182
183
184template <int dim>
187 const unsigned int i,
188 const Point<dim> & p) const
189{
190 (void)i;
191 (void)p;
192
193 Assert(false, ExcNotImplemented());
194
195 return {};
196}
197
198
199
200template <int dim>
203 const unsigned int i,
204 const Point<dim> & p) const
205{
206 (void)i;
207 (void)p;
208
209 Assert(false, ExcNotImplemented());
210
211 return {};
212}
213
214
215
216template <int dim>
219 const unsigned int i,
220 const Point<dim> & p) const
221{
222 (void)i;
223 (void)p;
224
225 Assert(false, ExcNotImplemented());
226
227 return {};
228}
229
230
231
232template <int dim>
233std::string
235{
236 return "ScalarLagrangePolynomialWedge";
237}
238
239
240
241template <int dim>
242std::unique_ptr<ScalarPolynomialsBase<dim>>
244{
245 return std::make_unique<ScalarLagrangePolynomialWedge<dim>>(*this);
246}
247
248
249
253
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:402
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:403
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
Definition: exceptions.h:1465
typename internal::ndarray::HelperArray< T, Ns... >::type ndarray
Definition: ndarray.h:108