Reference documentation for deal.II version 9.2.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\}}\)
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>
27 #include <deal.II/base/utilities.h>
28 
29 #include <vector>
30 
32 
33 
47 template <int dim>
49 {
50 public:
55  static const unsigned int dimension = dim;
56 
62  template <class Pol>
63  TensorProductPolynomialsConst(const std::vector<Pol> &pols);
64 
68  void
69  output_indices(std::ostream &out) const;
70 
76  void
77  set_numbering(const std::vector<unsigned int> &renumber);
78 
82  const std::vector<unsigned int> &
83  get_numbering() const;
84 
88  const std::vector<unsigned int> &
89  get_numbering_inverse() const;
90 
103  void
104  evaluate(const Point<dim> & unit_point,
105  std::vector<double> & values,
106  std::vector<Tensor<1, dim>> &grads,
107  std::vector<Tensor<2, dim>> &grad_grads,
108  std::vector<Tensor<3, dim>> &third_derivatives,
109  std::vector<Tensor<4, dim>> &fourth_derivatives) const override;
110 
123  double
124  compute_value(const unsigned int i, const Point<dim> &p) const;
125 
140  template <int order>
142  compute_derivative(const unsigned int i, const Point<dim> &p) const;
143 
157  compute_grad(const unsigned int i, const Point<dim> &p) const;
158 
172  compute_grad_grad(const unsigned int i, const Point<dim> &p) const;
173 
178  unsigned int
179  n() const;
180 
185  std::string
186  name() const override;
187 
191  virtual std::unique_ptr<ScalarPolynomialsBase<dim>>
192  clone() const override;
193 
194 private:
199 
203  std::vector<unsigned int> index_map;
204 
208  std::vector<unsigned int> index_map_inverse;
209 };
210 
214 /* ---------------- template and inline functions ---------- */
215 
216 #ifndef DOXYGEN
217 
218 template <int dim>
219 template <class Pol>
221  const std::vector<Pol> &pols)
222  : ScalarPolynomialsBase<dim>(1, Utilities::fixed_power<dim>(pols.size()) + 1)
223  , tensor_polys(pols)
224  , index_map(tensor_polys.n() + 1)
225  , index_map_inverse(tensor_polys.n() + 1)
226 {}
227 
228 
229 
230 template <int dim>
231 inline unsigned int
233 {
234  return tensor_polys.n() + 1;
235 }
236 
237 
238 
239 template <int dim>
240 inline const std::vector<unsigned int> &
242 {
243  return index_map;
244 }
245 
246 
247 template <int dim>
248 inline const std::vector<unsigned int> &
250 {
251  return index_map_inverse;
252 }
253 
254 
255 template <int dim>
256 inline std::string
258 {
259  return "TensorProductPolynomialsConst";
260 }
261 
262 
263 template <>
264 inline unsigned int
266 {
268 }
269 
270 
271 template <int dim>
272 template <int order>
275  const unsigned int i,
276  const Point<dim> & p) const
277 {
278  const unsigned int max_indices = tensor_polys.n();
279  Assert(i <= max_indices, ExcInternalError());
280 
281  // treat the regular basis functions
282  if (i < max_indices)
283  return tensor_polys.template compute_derivative<order>(i, p);
284  else
285  // this is for the constant function
286  return Tensor<order, dim>();
287 }
288 
289 
290 #endif // DOXYGEN
292 
293 #endif
TensorProductPolynomialsConst::output_indices
void output_indices(std::ostream &out) const
Definition: tensor_product_polynomials_const.cc:31
tensor_product_polynomials.h
TensorProductPolynomialsConst::dimension
static const unsigned int dimension
Definition: tensor_product_polynomials_const.h:55
TensorProductPolynomialsConst::compute_grad_grad
Tensor< 2, dim > compute_grad_grad(const unsigned int i, const Point< dim > &p) const
Definition: tensor_product_polynomials_const.cc:112
polynomial.h
TensorProductPolynomialsConst::clone
virtual std::unique_ptr< ScalarPolynomialsBase< dim > > clone() const override
Definition: tensor_product_polynomials_const.cc:204
TensorProductPolynomialsConst::name
std::string name() const override
utilities.h
TensorProductPolynomialsConst::compute_value
double compute_value(const unsigned int i, const Point< dim > &p) const
Definition: tensor_product_polynomials_const.cc:68
TensorProductPolynomialsConst::n
unsigned int n() const
ScalarPolynomialsBase::n
unsigned int n() const
Definition: scalar_polynomials_base.h:164
tensor.h
TensorProductPolynomialsConst::get_numbering_inverse
const std::vector< unsigned int > & get_numbering_inverse() const
TensorProductPolynomialsConst::set_numbering
void set_numbering(const std::vector< unsigned int > &renumber)
Definition: tensor_product_polynomials_const.cc:48
TensorProductPolynomialsConst::evaluate
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
Definition: tensor_product_polynomials_const.cc:128
Tensor< 1, dim >
Utilities::fixed_power
T fixed_power(const T t)
Definition: utilities.h:1072
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
TensorProductPolynomials< dim >
exceptions.h
TensorProductPolynomialsConst::compute_derivative
Tensor< order, dim > compute_derivative(const unsigned int i, const Point< dim > &p) const
StandardExceptions::ExcInternalError
static ::ExceptionBase & ExcInternalError()
Assert
#define Assert(cond, exc)
Definition: exceptions.h:1419
TensorProductPolynomialsConst::index_map_inverse
std::vector< unsigned int > index_map_inverse
Definition: tensor_product_polynomials_const.h:208
TensorProductPolynomialsConst::get_numbering
const std::vector< unsigned int > & get_numbering() const
numbers::invalid_unsigned_int
static const unsigned int invalid_unsigned_int
Definition: types.h:191
TensorProductPolynomialsConst::index_map
std::vector< unsigned int > index_map
Definition: tensor_product_polynomials_const.h:203
Point< dim >
config.h
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
TensorProductPolynomialsConst::TensorProductPolynomialsConst
TensorProductPolynomialsConst(const std::vector< Pol > &pols)
TensorProductPolynomialsConst
Definition: tensor_product_polynomials.h:39
TensorProductPolynomialsConst::compute_grad
Tensor< 1, dim > compute_grad(const unsigned int i, const Point< dim > &p) const
Definition: tensor_product_polynomials_const.cc:96
ScalarPolynomialsBase
Definition: scalar_polynomials_base.h:63
Utilities
Definition: cuda.h:31
TensorProductPolynomialsConst::tensor_polys
TensorProductPolynomials< dim > tensor_polys
Definition: tensor_product_polynomials_const.h:198
point.h