Reference documentation for deal.II version 9.5.0
\(\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// Copyright (C) 2020 - 2022 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
19
21
22namespace
23{
24 unsigned int
25 compute_n_polynomials_wedge(const unsigned int dim, const unsigned int degree)
26 {
27 if (dim == 3)
28 {
29 if (degree == 1)
30 return 6;
31 if (degree == 2)
32 return 18;
33 }
34
35 Assert(false, ExcNotImplemented());
36
37 return 0;
38 }
39} // namespace
40
41
42
43template <int dim>
45 const unsigned int degree)
46 : ScalarPolynomialsBase<dim>(degree, compute_n_polynomials_wedge(dim, degree))
47 , poly_tri(BarycentricPolynomials<2>::get_fe_p_basis(degree))
48 , poly_line(BarycentricPolynomials<1>::get_fe_p_basis(degree))
49{}
50
51
52
53template <int dim>
54double
56 const Point<dim> & p) const
57{
58 const auto pair = this->degree() == 1 ? internal::wedge_table_1[i] :
60
61 const Point<2> p_tri(p[0], p[1]);
62 const auto v_tri = poly_tri.compute_value(pair[0], p_tri);
63
64 const Point<1> p_line(p[2]);
65 const auto v_line = poly_line.compute_value(pair[1], p_line);
66
67 return v_tri * v_line;
68}
69
70
71
72template <int dim>
75 const Point<dim> & p) const
76{
77 const auto pair = this->degree() == 1 ? internal::wedge_table_1[i] :
79
80 const Point<2> p_tri(p[0], p[1]);
81 const auto v_tri = poly_tri.compute_value(pair[0], p_tri);
82 const auto g_tri = poly_tri.compute_grad(pair[0], p_tri);
83
84 const Point<1> p_line(p[2]);
85 const auto v_line = poly_line.compute_value(pair[1], p_line);
86 const auto g_line = poly_line.compute_grad(pair[1], p_line);
87
88 Tensor<1, dim> grad;
89 grad[0] = g_tri[0] * v_line;
90 grad[1] = g_tri[1] * v_line;
91 grad[2] = v_tri * g_line[0];
92
93 return grad;
94}
95
96
97
98template <int dim>
101 const Point<dim> &p) const
102{
103 (void)i;
104 (void)p;
105
106 Assert(false, ExcNotImplemented());
107 return Tensor<2, dim>();
108}
109
110
111
112template <int dim>
113void
115 const Point<dim> & unit_point,
116 std::vector<double> & values,
117 std::vector<Tensor<1, dim>> &grads,
118 std::vector<Tensor<2, dim>> &grad_grads,
119 std::vector<Tensor<3, dim>> &third_derivatives,
120 std::vector<Tensor<4, dim>> &fourth_derivatives) const
121{
122 (void)grads;
123 (void)grad_grads;
124 (void)third_derivatives;
125 (void)fourth_derivatives;
126
127 if (values.size() == this->n())
128 for (unsigned int i = 0; i < this->n(); ++i)
129 values[i] = compute_value(i, unit_point);
130
131 if (grads.size() == this->n())
132 for (unsigned int i = 0; i < this->n(); ++i)
133 grads[i] = compute_grad(i, unit_point);
134}
135
136
137
138template <int dim>
141 const unsigned int i,
142 const Point<dim> & p) const
143{
144 return compute_grad(i, p);
145}
146
147
148
149template <int dim>
152 const unsigned int i,
153 const Point<dim> & p) const
154{
155 (void)i;
156 (void)p;
157
158 Assert(false, ExcNotImplemented());
159
160 return {};
161}
162
163
164
165template <int dim>
168 const unsigned int i,
169 const Point<dim> & p) const
170{
171 (void)i;
172 (void)p;
173
174 Assert(false, ExcNotImplemented());
175
176 return {};
177}
178
179
180
181template <int dim>
184 const unsigned int i,
185 const Point<dim> & p) const
186{
187 (void)i;
188 (void)p;
189
190 Assert(false, ExcNotImplemented());
191
192 return {};
193}
194
195
196
197template <int dim>
198std::string
200{
201 return "ScalarLagrangePolynomialWedge";
202}
203
204
205
206template <int dim>
207std::unique_ptr<ScalarPolynomialsBase<dim>>
209{
210 return std::make_unique<ScalarLagrangePolynomialWedge<dim>>(*this);
211}
212
213
214
218
Definition point.h:112
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:472
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:473
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
static const constexpr ::ndarray< unsigned int, 18, 2 > wedge_table_2
static const constexpr ::ndarray< unsigned int, 6, 2 > wedge_table_1