Reference documentation for deal.II version 8.5.1
tensor_product_polynomials_const.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2012 - 2016 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 at
12 // the top level of the deal.II distribution.
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 #include <deal.II/base/exceptions.h>
22 #include <deal.II/base/tensor.h>
23 #include <deal.II/base/point.h>
24 #include <deal.II/base/polynomial.h>
25 #include <deal.II/base/tensor_product_polynomials.h>
26 #include <deal.II/base/utilities.h>
27 
28 #include <vector>
29 
30 DEAL_II_NAMESPACE_OPEN
31 
32 
46 template <int dim>
48 {
49 public:
54  static const unsigned int dimension = dim;
55 
61  template <class Pol>
62  TensorProductPolynomialsConst (const std::vector<Pol> &pols);
63 
76  void compute (const Point<dim> &unit_point,
77  std::vector<double> &values,
78  std::vector<Tensor<1,dim> > &grads,
79  std::vector<Tensor<2,dim> > &grad_grads,
80  std::vector<Tensor<3,dim> > &third_derivatives,
81  std::vector<Tensor<4,dim> > &fourth_derivatives) const;
82 
95  double compute_value (const unsigned int i,
96  const Point<dim> &p) const;
97 
112  template <int order>
113  Tensor<order,dim> compute_derivative (const unsigned int i,
114  const Point<dim> &p) const;
115 
128  Tensor<1,dim> compute_grad (const unsigned int i,
129  const Point<dim> &p) const;
130 
143  Tensor<2,dim> compute_grad_grad (const unsigned int i,
144  const Point<dim> &p) const;
145 
150  unsigned int n () const;
151 };
152 
156 /* ---------------- template and inline functions ---------- */
157 
158 #ifndef DOXYGEN
159 
160 template <int dim>
161 template <class Pol>
162 inline
164 TensorProductPolynomialsConst(const std::vector<Pol> &pols)
165  :
166  TensorProductPolynomials<dim>(pols)
167 {
168  // append index for renumbering
169  this->index_map.push_back(this->n_tensor_pols);
170  this->index_map_inverse.push_back(this->n_tensor_pols);
171 }
172 
173 
174 
175 template <int dim>
176 inline
177 unsigned int
179 {
180  return this->n_tensor_pols+1;
181 }
182 
183 
184 
185 template <>
186 inline
187 unsigned int
189 {
191 }
192 
193 template <int dim>
194 template <int order>
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->TensorProductPolynomials<dim>::template compute_derivative<order>(i,p);
205  else
206  // this is for the constant function
207  return Tensor<order,dim>();
208 }
209 
210 
211 #endif // DOXYGEN
212 DEAL_II_NAMESPACE_CLOSE
213 
214 #endif
static const unsigned int invalid_unsigned_int
Definition: types.h:170
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
#define Assert(cond, exc)
Definition: exceptions.h:313
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
std::vector< unsigned int > index_map_inverse
Tensor< order, dim > compute_derivative(const unsigned int i, const Point< dim > &p) const
TensorProductPolynomialsConst(const std::vector< Pol > &pols)
static ::ExceptionBase & ExcInternalError()