Reference documentation for deal.II version Git bedfa10003 2019-09-17 13:28:06 -0600
\(\newcommand{\dealcoloneq}{\mathrel{\vcenter{:}}=}\)
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Attributes | List of all members
PolynomialSpace< dim > Class Template Reference

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

Inheritance diagram for PolynomialSpace< dim >:
[legend]

Public Member Functions

template<class Pol >
 PolynomialSpace (const std::vector< Pol > &pols)
 
template<class StreamType >
void output_indices (StreamType &out) const
 
void set_numbering (const std::vector< unsigned int > &renumber)
 
void evaluate (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 override
 
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
 
std::string name () const override
 
virtual std::unique_ptr< ScalarPolynomialsBase< dim > > clone () const override
 
- Public Member Functions inherited from ScalarPolynomialsBase< dim >
 ScalarPolynomialsBase (const unsigned int deg, const unsigned int n_polynomials)
 
 ScalarPolynomialsBase (ScalarPolynomialsBase< dim > &&)=default
 
 ScalarPolynomialsBase (const ScalarPolynomialsBase< dim > &)=default
 
virtual ~ScalarPolynomialsBase ()=default
 
unsigned int n () const
 
unsigned int degree () const
 

Static Public Member Functions

static unsigned int n_polynomials (const unsigned int n)
 

Static Public Attributes

static const unsigned int dimension = dim
 

Protected Member Functions

std::array< unsigned int, dim > compute_index (const unsigned int n) const
 

Private Attributes

const std::vector< Polynomials::Polynomial< double > > polynomials
 
std::vector< unsigned int > index_map
 
std::vector< unsigned int > index_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 vary 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

Definition at line 99 of file polynomial_space.h.

Constructor & Destructor Documentation

◆ PolynomialSpace()

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

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>.

Definition at line 261 of file polynomial_space.h.

Member Function Documentation

◆ output_indices()

template<int dim>
template<class StreamType >
void PolynomialSpace< dim >::output_indices ( StreamType &  out) const

Prints the list of the indices to out.

Definition at line 291 of file polynomial_space.h.

◆ set_numbering()

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

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

Definition at line 113 of file polynomial_space.cc.

◆ evaluate()

template<int dim>
void PolynomialSpace< dim >::evaluate ( 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
overridevirtual

Compute 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.

Implements ScalarPolynomialsBase< dim >.

Definition at line 204 of file polynomial_space.cc.

◆ compute_value()

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

Compute the value of the ith polynomial at unit point p.

Consider using compute() instead.

Definition at line 127 of file polynomial_space.cc.

◆ compute_derivative()

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

Compute the orderth derivative of the ith polynomial at unit point p.

Consider using compute() instead.

Template Parameters
orderThe order of the derivative.

Definition at line 306 of file polynomial_space.h.

◆ compute_grad()

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

Compute the gradient of the ith polynomial at unit point p.

Consider using compute() instead.

Definition at line 144 of file polynomial_space.cc.

◆ compute_grad_grad()

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

Compute the second derivative (grad_grad) of the ith polynomial at unit point p.

Consider using compute() instead.

Definition at line 169 of file polynomial_space.cc.

◆ n_polynomials()

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

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.

Definition at line 26 of file polynomial_space.cc.

◆ name()

template<int dim>
std::string PolynomialSpace< dim >::name ( ) const
inlineoverridevirtual

Return the name of the space, which is PolynomialSpace.

Implements ScalarPolynomialsBase< dim >.

Definition at line 282 of file polynomial_space.h.

◆ clone()

template<int dim>
std::unique_ptr< ScalarPolynomialsBase< dim > > PolynomialSpace< dim >::clone ( ) const
overridevirtual

A sort of virtual copy constructor, this function returns a copy of the polynomial space object. Derived classes need to override the function here in this base class and return an object of the same type as the derived class.

Some places in the library, for example the constructors of FE_Poly, need to make copies of polynomial spaces without knowing their exact type. They do so through this function.

Implements ScalarPolynomialsBase< dim >.

Definition at line 404 of file polynomial_space.cc.

◆ compute_index()

template<int dim>
std::array<unsigned int, dim> PolynomialSpace< dim >::compute_index ( const unsigned int  n) const
protected

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

In 1d and 2d, obviously only i and i,j are returned.

Member Data Documentation

◆ dimension

template<int dim>
const unsigned int PolynomialSpace< dim >::dimension = dim
static

Access to the dimension of this object, for checking and automatic setting of dimension in other classes.

Definition at line 106 of file polynomial_space.h.

◆ polynomials

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

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

Definition at line 229 of file polynomial_space.h.

◆ index_map

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

Index map for reordering the polynomials.

Definition at line 234 of file polynomial_space.h.

◆ index_map_inverse

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

Index map for reordering the polynomials.

Definition at line 239 of file polynomial_space.h.


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