Reference documentation for deal.II version GIT 921d917bf4 2023-02-06 18:40:02+00:00
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
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
22 namespace
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
43 template <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
53 template <int dim>
54 double
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
72 template <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
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
94 }
95
96
97
98 template <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
112 template <int dim>
113 void
115  const Point<dim> & unit_point,
116  std::vector<double> & values,
119  std::vector<Tensor<3, dim>> &third_derivatives,
120  std::vector<Tensor<4, dim>> &fourth_derivatives) const
121 {
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
132  for (unsigned int i = 0; i < this->n(); ++i)
134 }
135
136
137
138 template <int dim>
141  const unsigned int i,
142  const Point<dim> & p) const
143 {
145 }
146
147
148
149 template <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
165 template <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
181 template <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
197 template <int dim>
198 std::string
200 {
201  return "ScalarLagrangePolynomialWedge";
202 }
203
204
205
206 template <int dim>
207 std::unique_ptr<ScalarPolynomialsBase<dim>>
209 {
210  return std::make_unique<ScalarLagrangePolynomialWedge<dim>>(*this);
211 }
212
213
214
215 template class ScalarLagrangePolynomialWedge<1>;
216 template class ScalarLagrangePolynomialWedge<2>;
217 template class ScalarLagrangePolynomialWedge<3>;
218
Definition: point.h:111
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
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
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:461
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:462
#define Assert(cond, exc)
Definition: exceptions.h:1583
static ::ExceptionBase & ExcNotImplemented()
static constexpr const ::ndarray< unsigned int, 18, 2 > wedge_table_2
static constexpr const ::ndarray< unsigned int, 6, 2 > wedge_table_1