TensorProductPolynomials< dim > Class Template Reference
[Polynomials and polynomial spaces]

List of all members.

Public Member Functions

template<class Pol >
 TensorProductPolynomials (const std::vector< Pol > &pols)
void output_indices (std::ostream &out) const
void set_numbering (const std::vector< unsigned int > &renumber)
const std::vector< unsigned int > & get_numbering () const
const std::vector< unsigned int > & get_numbering_inverse () 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) const
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
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 x_to_the_dim (const unsigned int x)

Private Attributes

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


Detailed Description

template<int dim>
class TensorProductPolynomials< dim >

Tensor product of given polynomials.

Given a vector of n one-dimensional polynomials P1 to Pn, this class generates ndim polynomials of the form Qijk(x,y,z) = Pi(x)Pj(y)Pk(z). If the base polynomials are mutually orthogonal on the interval [-1,1] or [0,1], then the tensor product polynomials are orthogonal on [-1,1]dim or [0,1]dim, respectively.

Indexing is as follows: the order of dim-dimensional polynomials is x-coordinates running fastest, then y-coordinate, etc. The first few polynomials are thus P1(x)P1(y), P2(x)P1(y), P3(x)P1(y), ..., P1(x)P2(y), P2(x)P2(y), P3(x)P2(y), ... and likewise in 3d.

The output_indices() function prints the ordering of the dim-dimensional polynomials, i.e. for each polynomial in the polynomial space it gives the indices i,j,k of the one-dimensional polynomials in x,y and z direction. The ordering of the dim-dimensional polynomials can be changed by using the set_numbering() function.

Author:
Ralf Hartmann, 2000, 2004, Guido Kanschat, 2000, Wolfgang Bangerth 2003

Constructor & Destructor Documentation

template<int dim>
template<class Pol >
TensorProductPolynomials< dim >::TensorProductPolynomials ( const std::vector< Pol > &  pols  )  [inline]

Constructor. pols is a vector of objects that should be derived or otherwise convertible to one-dimensional polynomial objects. It will be copied element by element into a private variable.


Member Function Documentation

template<int dim>
void TensorProductPolynomials< dim >::output_indices ( std::ostream &  out  )  const

Prints the list of the indices to out.

template<int dim>
void TensorProductPolynomials< dim >::set_numbering ( const std::vector< unsigned int > &  renumber  ) 

Sets the ordering of the polynomials. Requires renumber.size()==n(). Stores a copy of renumber.

template<int dim>
const std::vector<unsigned int>& TensorProductPolynomials< dim >::get_numbering (  )  const

Gives read access to the renumber vector.

template<int dim>
const std::vector<unsigned int>& TensorProductPolynomials< dim >::get_numbering_inverse (  )  const

Gives read access to the inverse renumber vector.

template<int dim>
void TensorProductPolynomials< dim >::compute ( const Point< dim > &  unit_point,
std::vector< double > &  values,
std::vector< Tensor< 1, dim > > &  grads,
std::vector< Tensor< 2, dim > > &  grad_grads 
) const

Computes 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(). 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.

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

Computes 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 with values.size()==n() to get the point values of all tensor polynomials all at once and in a much more efficient way.

template<int dim>
Tensor<1,dim> TensorProductPolynomials< dim >::compute_grad ( const unsigned int  i,
const Point< dim > &  p 
) const

Computes 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() to get the point value of all tensor polynomials all at once and in a much more efficient way.

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

Computes 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() to get the point value of all tensor polynomials all at once and in a much more efficient way.

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

Returns the number of tensor product polynomials. For n 1d polynomials this is ndim.

template<int dim>
void TensorProductPolynomials< 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.

template<int dim>
static unsigned int TensorProductPolynomials< dim >::x_to_the_dim ( const unsigned int  x  )  [static, private]

Computes xdim for unsigned int x. Used in the constructor.


Member Data Documentation

template<int dim>
std::vector<Polynomials::Polynomial<double> > TensorProductPolynomials< dim >::polynomials [private]

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

template<int dim>
unsigned int TensorProductPolynomials< dim >::n_tensor_pols [private]

Number of tensor product polynomials. See n().

template<int dim>
std::vector<unsigned int> TensorProductPolynomials< dim >::index_map [private]

Index map for reordering the polynomials.

template<int dim>
std::vector<unsigned int> TensorProductPolynomials< dim >::index_map_inverse [private]

Index map for reordering the polynomials.


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

deal.II documentation generated on Sat Aug 15 16:52:27 2009 by doxygen 1.5.9