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

Inheritance diagram for PolynomialSpace< dim >:

Inheritance graph
[legend]

List of all members.

Public Member Functions

template<class Pol >
 PolynomialSpace (const std::vector< Pol > &pols)
template<class STREAM >
void output_indices (STREAM &out) const
void set_numbering (const std::vector< unsigned int > &renumber)
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
unsigned int degree () const
template<>
void compute_index (const unsigned int n, unsigned int(&index)[1]) const
template<>
void compute_index (const unsigned int n, unsigned int(&index)[2]) const
template<>
void compute_index (const unsigned int n, unsigned int(&index)[3]) const

Static Public Member Functions

static unsigned int compute_n_pols (const unsigned int n)

Protected Member Functions

void compute_index (const unsigned int n, unsigned int(&index)[dim]) const

Private Attributes

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


Detailed Description

template<int dim>
class PolynomialSpace< dim >

Representation of the space of polynomials of degree at most n in higher dimensions.

Given a vector of n one-dimensional polynomials P0 to Pn, where Pi has degree i, this class generates all dim-dimensional polynomials of the form Pijk(x,y,z) = Pi(x)Pj(y)Pk(z), where the sum of i, j and k is less than or equal n.

The output_indices() function prints the ordering of the polynomials, i.e. for each dim-dimensional 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.

The standard ordering of polynomials is that indices for the first space dimension vasry fastest and the last space dimension is slowest. In particular, if we take for simplicity the vector of monomials x0, x1, x2,..., xn, we get

1D
x0, x1,...,xn
2D:
x0y0, x1y0,..., xny0,
x0y1, x1y1,..., xn-1y1,
x0y2,... xn-2y2,
...
x0yn-1, x1yn-1,
x0yn
3D:
x0y0z0,..., xny0z0,
x0y1z0,..., xn-1y1z0,
...
x0ynz0,
x0y0z1,... xn-1y0z1,
...
x0yn-1z1,
x0y0z2,... xn-2y0z2,
...
x0y0zn

Author:
Guido Kanschat, Wolfgang Bangerth, Ralf Hartmann 2002, 2003, 2004, 2005

Constructor & Destructor Documentation

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

Constructor. pols is a vector of pointers to one-dimensional polynomials and will be copied into a private member variable. The static type of the template argument pols needs to be convertible to Polynomials::Polynomial<double>, i.e. should usually be a derived class of Polynomials::Polynomial<double>.


Member Function Documentation

template<int dim>
template<class STREAM >
void PolynomialSpace< dim >::output_indices ( STREAM &  out  )  const [inline]

Prints the list of the indices to out.

template<int dim>
void PolynomialSpace< 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>
void PolynomialSpace< 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 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, i.e. you indicate what you want to have computed by resizing those vectors which you want filled.

If you need values or derivatives of all 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 polynomials.

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

Computes the value of the ith polynomial at unit_point.

Consider using compute() instead.

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

Computes the gradient of the ith polynomial at unit_point.

Consider using compute() instead.

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

Computes the second derivative (grad_grad) of the ith polynomial at unit_point.

Consider using compute() instead.

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

Return the number of polynomials spanning the space represented by this class. Here, if N is the number of one-dimensional polynomials given, then the result of this function is N in 1d, N(N+1)/2 in 2d, and N(N+1)(N+2)/6 in 3d.

template<int dim>
unsigned int PolynomialSpace< dim >::degree (  )  const

Degree of the space. This is by definition the number of polynomials given to the constructor, NOT the maximal degree of a polynomial in this vector. The latter value is never checked and therefore left to the application.

Reimplemented in PolynomialsP< dim >.

Referenced by PolynomialsBDM< dim >::degree().

template<int dim>
static unsigned int PolynomialSpace< dim >::compute_n_pols ( const unsigned int  n  )  [static]

Static function used in the constructor to compute the number of polynomials.

template<int dim>
void PolynomialSpace< dim >::compute_index ( const unsigned int  n,
unsigned int(&)  index[dim] 
) const [protected]

Compute numbers in x, y and z direction. Given an index n in the d-dimensional polynomial space, compute the indices i,j,k such that pn(x,y,z) = pi(x)pj(y)pk(z).

Referenced by PolynomialSpace< dim >::output_indices().

template<>
void PolynomialSpace< 1 >::compute_index ( const unsigned int  n,
unsigned int(&)  index[1] 
) const [inline]

template<>
void PolynomialSpace< 2 >::compute_index ( const unsigned int  n,
unsigned int(&)  index[2] 
) const [inline]

template<>
void PolynomialSpace< 3 >::compute_index ( const unsigned int  n,
unsigned int(&)  index[3] 
) const [inline]


Member Data Documentation

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

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

Referenced by PolynomialSpace< dim >::degree().

template<int dim>
const unsigned int PolynomialSpace< dim >::n_pols [private]

Store the precomputed value which the n() function returns.

Referenced by PolynomialSpace< dim >::n(), PolynomialSpace< dim >::output_indices(), and PolynomialSpace< dim >::PolynomialSpace().

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

Index map for reordering the polynomials.

Referenced by PolynomialSpace< dim >::PolynomialSpace().

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

Index map for reordering the polynomials.

Referenced by PolynomialSpace< dim >::PolynomialSpace().


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

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