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\}}\)
tensor_product_polynomials_const.h
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (C) 2012 - 2020 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#ifndef dealii_tensor_product_polynomials_const_h
17#define dealii_tensor_product_polynomials_const_h
18
19
20#include <deal.II/base/config.h>
21
23#include <deal.II/base/point.h>
25#include <deal.II/base/tensor.h>
28
29#include <vector>
30
32
33
45template <int dim>
47{
48public:
53 static const unsigned int dimension = dim;
54
60 template <class Pol>
61 TensorProductPolynomialsConst(const std::vector<Pol> &pols);
62
66 void
67 output_indices(std::ostream &out) const;
68
74 void
75 set_numbering(const std::vector<unsigned int> &renumber);
76
80 const std::vector<unsigned int> &
82
86 const std::vector<unsigned int> &
88
101 void
102 evaluate(const Point<dim> & unit_point,
103 std::vector<double> & values,
104 std::vector<Tensor<1, dim>> &grads,
105 std::vector<Tensor<2, dim>> &grad_grads,
106 std::vector<Tensor<3, dim>> &third_derivatives,
107 std::vector<Tensor<4, dim>> &fourth_derivatives) const override;
108
121 double
122 compute_value(const unsigned int i, const Point<dim> &p) const override;
123
138 template <int order>
140 compute_derivative(const unsigned int i, const Point<dim> &p) const;
141
145 virtual Tensor<1, dim>
146 compute_1st_derivative(const unsigned int i,
147 const Point<dim> & p) const override;
148
152 virtual Tensor<2, dim>
153 compute_2nd_derivative(const unsigned int i,
154 const Point<dim> & p) const override;
155
159 virtual Tensor<3, dim>
160 compute_3rd_derivative(const unsigned int i,
161 const Point<dim> & p) const override;
162
166 virtual Tensor<4, dim>
167 compute_4th_derivative(const unsigned int i,
168 const Point<dim> & p) const override;
169
183 compute_grad(const unsigned int i, const Point<dim> &p) const override;
184
198 compute_grad_grad(const unsigned int i, const Point<dim> &p) const override;
199
204 unsigned int
205 n() const;
206
211 std::string
212 name() const override;
213
217 virtual std::unique_ptr<ScalarPolynomialsBase<dim>>
218 clone() const override;
219
220private:
225
229 std::vector<unsigned int> index_map;
230
234 std::vector<unsigned int> index_map_inverse;
235};
236
240/* ---------------- template and inline functions ---------- */
241
242#ifndef DOXYGEN
243
244template <int dim>
245template <class Pol>
247 const std::vector<Pol> &pols)
248 : ScalarPolynomialsBase<dim>(1, Utilities::fixed_power<dim>(pols.size()) + 1)
249 , tensor_polys(pols)
250 , index_map(tensor_polys.n() + 1)
251 , index_map_inverse(tensor_polys.n() + 1)
252{}
253
254
255
256template <int dim>
257inline unsigned int
259{
260 return tensor_polys.n() + 1;
261}
262
263
264
265template <int dim>
266inline const std::vector<unsigned int> &
268{
269 return index_map;
270}
271
272
273template <int dim>
274inline const std::vector<unsigned int> &
276{
277 return index_map_inverse;
278}
279
280
281template <int dim>
282inline std::string
284{
285 return "TensorProductPolynomialsConst";
286}
287
288
289template <>
290inline unsigned int
292{
294}
295
296
297template <int dim>
298template <int order>
301 const unsigned int i,
302 const Point<dim> & p) const
303{
304 const unsigned int max_indices = tensor_polys.n();
305 Assert(i <= max_indices, ExcInternalError());
306
307 // treat the regular basis functions
308 if (i < max_indices)
309 return tensor_polys.template compute_derivative<order>(i, p);
310 else
311 // this is for the constant function
312 return Tensor<order, dim>();
313}
314
315
316
317template <int dim>
318inline Tensor<1, dim>
320 const unsigned int i,
321 const Point<dim> & p) const
322{
323 return compute_derivative<1>(i, p);
324}
325
326
327
328template <int dim>
329inline Tensor<2, dim>
331 const unsigned int i,
332 const Point<dim> & p) const
333{
334 return compute_derivative<2>(i, p);
335}
336
337
338
339template <int dim>
340inline Tensor<3, dim>
342 const unsigned int i,
343 const Point<dim> & p) const
344{
345 return compute_derivative<3>(i, p);
346}
347
348
349
350template <int dim>
351inline Tensor<4, dim>
353 const unsigned int i,
354 const Point<dim> & p) const
355{
356 return compute_derivative<4>(i, p);
357}
358
359#endif // DOXYGEN
361
362#endif
Definition: point.h:111
void output_indices(std::ostream &out) const
virtual Tensor< 4, dim > compute_4th_derivative(const unsigned int i, const Point< dim > &p) const override
double compute_value(const unsigned int i, const Point< dim > &p) const override
Tensor< 1, dim > compute_grad(const unsigned int i, const Point< dim > &p) const override
std::string name() const override
const std::vector< unsigned int > & get_numbering() const
virtual std::unique_ptr< ScalarPolynomialsBase< dim > > clone() const override
Tensor< order, dim > compute_derivative(const unsigned int i, const Point< dim > &p) const
void set_numbering(const std::vector< unsigned int > &renumber)
virtual Tensor< 1, dim > compute_1st_derivative(const unsigned int i, const Point< dim > &p) const override
const std::vector< unsigned int > & get_numbering_inverse() const
Tensor< 2, dim > compute_grad_grad(const unsigned int i, const Point< dim > &p) const override
TensorProductPolynomials< dim > tensor_polys
TensorProductPolynomialsConst(const std::vector< Pol > &pols)
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
unsigned int n() const
virtual Tensor< 3, dim > compute_3rd_derivative(const unsigned int i, const Point< dim > &p) const override
virtual Tensor< 2, dim > compute_2nd_derivative(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
#define Assert(cond, exc)
Definition: exceptions.h:1465
static ::ExceptionBase & ExcInternalError()
T fixed_power(const T t)
Definition: utilities.h:1081
static const unsigned int invalid_unsigned_int
Definition: types.h:196