Reference documentation for deal.II version 9.1.1
|
#include <deal.II/base/polynomial_space.h>
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 | 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 |
unsigned int | degree () const |
Static Public Member Functions | |
static unsigned int | compute_n_pols (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 |
const unsigned int | n_pols |
std::vector< unsigned int > | index_map |
std::vector< unsigned int > | index_map_inverse |
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
Definition at line 98 of file polynomial_space.h.
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 272 of file polynomial_space.h.
void PolynomialSpace< dim >::output_indices | ( | StreamType & | out | ) | const |
Prints the list of the indices to out
.
Definition at line 310 of file polynomial_space.h.
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 112 of file polynomial_space.cc.
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, | ||
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 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.
Definition at line 203 of file polynomial_space.cc.
double PolynomialSpace< dim >::compute_value | ( | const unsigned int | i, |
const Point< dim > & | p | ||
) | const |
Compute the value of the i
th polynomial at unit point p
.
Consider using compute() instead.
Definition at line 126 of file polynomial_space.cc.
Tensor< order, dim > PolynomialSpace< dim >::compute_derivative | ( | const unsigned int | i, |
const Point< dim > & | p | ||
) | const |
Compute the order
th derivative of the i
th polynomial at unit point p
.
Consider using compute() instead.
order | The order of the derivative. |
Definition at line 325 of file polynomial_space.h.
Tensor< 1, dim > PolynomialSpace< dim >::compute_grad | ( | const unsigned int | i, |
const Point< dim > & | p | ||
) | const |
Compute the gradient of the i
th polynomial at unit point p
.
Consider using compute() instead.
Definition at line 143 of file polynomial_space.cc.
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 i
th polynomial at unit point p
.
Consider using compute() instead.
Definition at line 168 of file polynomial_space.cc.
|
inline |
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 292 of file polynomial_space.h.
|
inline |
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.
Definition at line 301 of file polynomial_space.h.
|
static |
Static function used in the constructor to compute the number of polynomials.
n
is not the maximal degree, but the number of onedimensional polynomials, thus the degree plus one. Definition at line 25 of file polynomial_space.cc.
|
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.
|
static |
Access to the dimension of this object, for checking and automatic setting of dimension in other classes.
Definition at line 105 of file polynomial_space.h.
|
private |
Copy of the vector pols
of polynomials given to the constructor.
Definition at line 235 of file polynomial_space.h.
|
private |
Store the precomputed value which the n()
function returns.
Definition at line 240 of file polynomial_space.h.
|
private |
Index map for reordering the polynomials.
Definition at line 245 of file polynomial_space.h.
|
private |
Index map for reordering the polynomials.
Definition at line 250 of file polynomial_space.h.