Reference documentation for deal.II version 9.1.1
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
tensor_product_polynomials_const.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2012 - 2018 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 
22 #include <deal.II/base/exceptions.h>
23 #include <deal.II/base/point.h>
24 #include <deal.II/base/polynomial.h>
25 #include <deal.II/base/tensor.h>
26 #include <deal.II/base/tensor_product_polynomials.h>
27 #include <deal.II/base/utilities.h>
28 
29 #include <vector>
30 
31 DEAL_II_NAMESPACE_OPEN
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 
77  void
78  compute(const Point<dim> & unit_point,
79  std::vector<double> & values,
80  std::vector<Tensor<1, dim>> &grads,
81  std::vector<Tensor<2, dim>> &grad_grads,
82  std::vector<Tensor<3, dim>> &third_derivatives,
83  std::vector<Tensor<4, dim>> &fourth_derivatives) const;
84 
97  double
98  compute_value(const unsigned int i, const Point<dim> &p) const;
99 
114  template <int order>
116  compute_derivative(const unsigned int i, const Point<dim> &p) const;
117 
131  compute_grad(const unsigned int i, const Point<dim> &p) const;
132 
146  compute_grad_grad(const unsigned int i, const Point<dim> &p) const;
147 
152  unsigned int
153  n() const;
154 };
155 
159 /* ---------------- template and inline functions ---------- */
160 
161 #ifndef DOXYGEN
162 
163 template <int dim>
164 template <class Pol>
166  const std::vector<Pol> &pols)
167  : TensorProductPolynomials<dim>(pols)
168 {
169  // append index for renumbering
170  this->index_map.push_back(this->n_tensor_pols);
171  this->index_map_inverse.push_back(this->n_tensor_pols);
172 }
173 
174 
175 
176 template <int dim>
177 inline unsigned int
179 {
180  return this->n_tensor_pols + 1;
181 }
182 
183 
184 
185 template <>
186 inline unsigned int
188 {
190 }
191 
192 template <int dim>
193 template <int order>
196  const unsigned int i,
197  const Point<dim> & p) const
198 {
199  const unsigned int max_indices = this->n_tensor_pols;
200  Assert(i <= max_indices, ExcInternalError());
201 
202  // treat the regular basis functions
203  if (i < max_indices)
204  return this
205  ->TensorProductPolynomials<dim>::template compute_derivative<order>(i, p);
206  else
207  // this is for the constant function
208  return Tensor<order, dim>();
209 }
210 
211 
212 #endif // DOXYGEN
213 DEAL_II_NAMESPACE_CLOSE
214 
215 #endif
static const unsigned int invalid_unsigned_int
Definition: types.h:173
double compute_value(const unsigned int i, const Point< dim > &p) const
Tensor< 1, dim > compute_grad(const unsigned int i, const Point< dim > &p) const
unsigned int n() const
Tensor< 2, dim > compute_grad_grad(const unsigned int i, const Point< dim > &p) const
void compute(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
#define Assert(cond, exc)
Definition: exceptions.h:1407
Tensor< order, dim > compute_derivative(const unsigned int i, const Point< dim > &p) const
std::vector< unsigned int > index_map_inverse
TensorProductPolynomialsConst(const std::vector< Pol > &pols)
static ::ExceptionBase & ExcInternalError()