Reference documentation for deal.II version 9.1.0-pre
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
AnisotropicPolynomials< dim > Class Template Reference

#include <deal.II/base/tensor_product_polynomials.h>

Public Member Functions

 AnisotropicPolynomials (const std::vector< std::vector< Polynomials::Polynomial< double >>> &base_polynomials)
 
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
 
double compute_value (const unsigned int i, const Point< dim > &p) const
 
template<int order>
Tensor< order, dim > compute_derivative (const unsigned int i, const Point< dim > &p) const
 
Tensor< 1, dim > compute_grad (const unsigned int i, const Point< dim > &p) const
 
Tensor< 2, dim > compute_grad_grad (const unsigned int i, const Point< dim > &p) const
 
unsigned int n () const
 

Private Member Functions

void compute_index (const unsigned int i, unsigned int(&indices)[dim]) const
 

Static Private Member Functions

static unsigned int get_n_tensor_pols (const std::vector< std::vector< Polynomials::Polynomial< double >>> &pols)
 

Private Attributes

const std::vector< std::vector< Polynomials::Polynomial< double > > > polynomials
 
const unsigned int n_tensor_pols
 

Detailed Description

template<int dim>
class AnisotropicPolynomials< dim >

Anisotropic tensor product of given polynomials.

Given one-dimensional polynomials \(P^x_1(x), P^x_2(x), \ldots\) in \(x\)-direction, \(P^y_1(y), P^y_2(y), \ldots\) in \(y\)-direction, and so on, this class generates polynomials of the form \(Q_{ijk}(x,y,z) = P^x_i(x)P^y_j(y)P^z_k(z)\). (With obvious generalization if dim is in fact only 2. If dim is in fact only 1, then the result is simply the same set of one-dimensional polynomials passed to the constructor.)

If the elements of each set of base polynomials are mutually orthogonal on the interval \([-1,1]\) or \([0,1]\), then the tensor product polynomials are orthogonal on \([-1,1]^d\) or \([0,1]^d\), respectively.

The resulting dim-dimensional tensor product polynomials are ordered as follows: We iterate over the \(x\) coordinates running fastest, then the \(y\) coordinate, etc. For example, for dim==2, the first few polynomials are thus \(P^x_1(x)P^y_1(y)\), \(P^x_2(x)P^y_1(y)\), \(P^x_3(x)P^y_1(y)\), ..., \(P^x_1(x)P^y_2(y)\), \(P^x_2(x)P^y_2(y)\), \(P^x_3(x)P^y_2(y)\), etc.

Author
Wolfgang Bangerth 2003

Definition at line 262 of file tensor_product_polynomials.h.

Constructor & Destructor Documentation

template<int dim>
AnisotropicPolynomials< dim >::AnisotropicPolynomials ( const std::vector< std::vector< Polynomials::Polynomial< double >>> &  base_polynomials)

Constructor. base_polynomials is a table of one-dimensional polynomials. The number of rows in this table (the first index when indexing into base_polynomials) needs to be equal to the space dimension, with the elements of each row (i.e., the second index) giving the polynomials that shall be used in this particular coordinate direction.

Since we want to build anisotropic polynomials, the dim sets of polynomials passed in as arguments may of course be different, and may also vary in number.

Definition at line 413 of file tensor_product_polynomials.cc.

Member Function Documentation

template<int dim>
void AnisotropicPolynomials< dim >::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

Compute the value and the first and second derivatives of each tensor product polynomial at unit_point.

The size of the vectors must either be equal 0 or equal n_tensor_pols. In the first case, the function will not compute these values.

If you need values or derivatives of all tensor product polynomials then use this function, rather than using any of the compute_value, compute_grad or compute_grad_grad functions, see below, in a loop over all tensor product polynomials.

Definition at line 535 of file tensor_product_polynomials.cc.

template<int dim>
double AnisotropicPolynomials< dim >::compute_value ( const unsigned int  i,
const Point< dim > &  p 
) const

Compute the value of the ith tensor product polynomial at unit_point. Here i is given in tensor product numbering.

Note, that using this function within a loop over all tensor product polynomials is not efficient, because then each point value of the underlying (one-dimensional) polynomials is (unnecessarily) computed several times. Instead use the compute function, see above, with values.size()==n_tensor_pols to get the point values of all tensor polynomials all at once and in a much more efficient way.

Definition at line 455 of file tensor_product_polynomials.cc.

template<int dim>
template<int order>
Tensor<order, dim> AnisotropicPolynomials< dim >::compute_derivative ( const unsigned int  i,
const Point< dim > &  p 
) const

Compute the orderth derivative of the ith tensor product polynomial at unit_point. Here i is given in tensor product numbering.

Note, that using this function within a loop over all tensor product polynomials is not efficient, because then each derivative value of the underlying (one-dimensional) polynomials is (unnecessarily) computed several times. Instead use the compute() function, see above, with the size of the appropriate parameter set to n() to get the point value of all tensor polynomials all at once and in a much more efficient way.

Template Parameters
orderThe derivative order.
template<int dim>
Tensor< 1, dim > AnisotropicPolynomials< dim >::compute_grad ( const unsigned int  i,
const Point< dim > &  p 
) const

Compute the grad of the ith tensor product polynomial at unit_point. Here i is given in tensor product numbering.

Note, that using this function within a loop over all tensor product polynomials is not efficient, because then each derivative value of the underlying (one-dimensional) polynomials is (unnecessarily) computed several times. Instead use the compute function, see above, with grads.size()==n_tensor_pols to get the point value of all tensor polynomials all at once and in a much more efficient way.

Definition at line 471 of file tensor_product_polynomials.cc.

template<int dim>
Tensor< 2, dim > AnisotropicPolynomials< dim >::compute_grad_grad ( const unsigned int  i,
const Point< dim > &  p 
) const

Compute the second derivative (grad_grad) of the ith tensor product polynomial at unit_point. Here i is given in tensor product numbering.

Note, that using this function within a loop over all tensor product polynomials is not efficient, because then each derivative value of the underlying (one-dimensional) polynomials is (unnecessarily) computed several times. Instead use the compute function, see above, with grad_grads.size()==n_tensor_pols to get the point value of all tensor polynomials all at once and in a much more efficient way.

Definition at line 499 of file tensor_product_polynomials.cc.

template<int dim>
unsigned int AnisotropicPolynomials< dim >::n ( ) const

Return the number of tensor product polynomials. It is the product of the number of polynomials in each coordinate direction.

Definition at line 686 of file tensor_product_polynomials.cc.

template<int dim>
void AnisotropicPolynomials< dim >::compute_index ( const unsigned int  i,
unsigned int(&)  indices[dim] 
) const
private

Each tensor product polynomial @รพ{i} is a product of one-dimensional polynomials in each space direction. Compute the indices of these one- dimensional polynomials for each space direction, given the index i.

Definition at line 429 of file tensor_product_polynomials.cc.

template<int dim>
unsigned int AnisotropicPolynomials< dim >::get_n_tensor_pols ( const std::vector< std::vector< Polynomials::Polynomial< double >>> &  pols)
staticprivate

Given the input to the constructor, compute n_tensor_pols.

Definition at line 694 of file tensor_product_polynomials.cc.

Member Data Documentation

template<int dim>
const std::vector<std::vector<Polynomials::Polynomial<double> > > AnisotropicPolynomials< dim >::polynomials
private

Copy of the vector pols of polynomials given to the constructor.

Definition at line 376 of file tensor_product_polynomials.h.

template<int dim>
const unsigned int AnisotropicPolynomials< dim >::n_tensor_pols
private

Number of tensor product polynomials. This is Nx*Ny*Nz, or with terms dropped if the number of space dimensions is less than 3.

Definition at line 382 of file tensor_product_polynomials.h.


The documentation for this class was generated from the following files: