deal.II version GIT relicensing-2167-g9622207b8f 2024-11-21 12:40:00+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
PolynomialsP< dim > Class Template Reference

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

Inheritance diagram for PolynomialsP< dim >:
Inheritance graph
[legend]

Public Member Functions

 PolynomialsP (const unsigned int p)
 
virtual unsigned int degree () const override
 
std::array< unsigned int, dim > directional_degrees (unsigned int n) const
 
std::unique_ptr< ScalarPolynomialsBase< dim > > clone () const override
 
template<typename 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 override
 
template<int order>
Tensor< order, dim > compute_derivative (const unsigned int i, const Point< dim > &p) const
 
virtual Tensor< 1, dim > compute_1st_derivative (const unsigned int i, const Point< dim > &p) const override
 
virtual Tensor< 2, dim > compute_2nd_derivative (const unsigned int i, const Point< dim > &p) const override
 
virtual Tensor< 3, dim > compute_3rd_derivative (const unsigned int i, const Point< dim > &p) const override
 
virtual Tensor< 4, dim > compute_4th_derivative (const unsigned int i, const Point< dim > &p) const override
 
Tensor< 1, dim > compute_grad (const unsigned int i, const Point< dim > &p) const override
 
Tensor< 2, dim > compute_grad_grad (const unsigned int i, const Point< dim > &p) const override
 
unsigned int n_polynomials (const unsigned int)
 
std::string name () const override
 
unsigned int n () const
 
virtual std::size_t memory_consumption () const
 

Static Public Member Functions

static unsigned int n_polynomials (const unsigned int n)
 

Static Public Attributes

static constexpr unsigned int dimension = dim
 

Protected Member Functions

std::array< unsigned int, dim > compute_index (const unsigned int n) const
 
std::array< unsigned int, 1 > compute_index (const unsigned int n) const
 
std::array< unsigned int, 2 > compute_index (const unsigned int n) const
 
std::array< unsigned int, 3 > compute_index (const unsigned int n) const
 
std::array< unsigned int, 1 > compute_index (const unsigned int i) const
 
std::array< unsigned int, 2 > compute_index (const unsigned int i) const
 
std::array< unsigned int, 3 > compute_index (const unsigned int i) const
 

Private Member Functions

void create_polynomial_ordering (std::vector< unsigned int > &index_map) const
 
void create_polynomial_ordering (std::vector< unsigned int > &index_map) const
 
void create_polynomial_ordering (std::vector< unsigned int > &index_map) const
 
void create_polynomial_ordering (std::vector< unsigned int > &index_map) const
 

Private Attributes

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

Detailed Description

template<int dim>
class PolynomialsP< dim >

This class implements the polynomial space of degree p based on the monomials \({1,x,x^2,...}\). I.e. in d dimensions it constructs all polynomials of the form \(\prod_{i=1}^d x_i^{n_i}\), where \(\sum_i n_i\leq p\). The base polynomials are given a specific ordering, e.g. in 2 dimensions: \({1,x,y,xy,x^2,y^2,x^2y,xy^2,x^3,y^3,...}\). The ordering of the monomials in \(P_k1\) matches the ordering of the monomials in \(P_k2\) for \(k2>k1\).

Definition at line 46 of file polynomials_p.h.

Constructor & Destructor Documentation

◆ PolynomialsP()

template<int dim>
PolynomialsP< dim >::PolynomialsP ( const unsigned int  p)

Constructor. Creates all basis functions of \(P_p\).

  • p: the degree of the polynomial space

Definition at line 22 of file polynomials_p.cc.

Member Function Documentation

◆ degree()

template<int dim>
unsigned int PolynomialsP< dim >::degree ( ) const
inlineoverridevirtual

Return the degree p of the polynomial space P_p.

Note, that this number is PolynomialSpace::degree()-1, compare definition in PolynomialSpace.

Reimplemented from ScalarPolynomialsBase< dim >.

Definition at line 103 of file polynomials_p.h.

◆ directional_degrees()

template<int dim>
std::array< unsigned int, dim > PolynomialsP< dim >::directional_degrees ( unsigned int  n) const
inline

For the nth polynomial \(p_n(x,y,z)=x^i y^j z^k\) this function gives the degrees i,j,k in the x,y,z directions.

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

Definition at line 111 of file polynomials_p.h.

◆ clone()

template<int dim>
std::unique_ptr< ScalarPolynomialsBase< dim > > PolynomialsP< dim >::clone ( ) const
inlineoverridevirtual

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.

Reimplemented from PolynomialSpace< dim >.

Definition at line 80 of file polynomials_p.h.

◆ create_polynomial_ordering() [1/4]

template<int dim>
void PolynomialsP< dim >::create_polynomial_ordering ( std::vector< unsigned int > &  index_map) const
private

Fills the index_map.

◆ create_polynomial_ordering() [2/4]

void PolynomialsP< 1 >::create_polynomial_ordering ( std::vector< unsigned int > &  index_map) const
private

Definition at line 35 of file polynomials_p.cc.

◆ create_polynomial_ordering() [3/4]

void PolynomialsP< 2 >::create_polynomial_ordering ( std::vector< unsigned int > &  index_map) const
private

Definition at line 60 of file polynomials_p.cc.

◆ create_polynomial_ordering() [4/4]

void PolynomialsP< 3 >::create_polynomial_ordering ( std::vector< unsigned int > &  index_map) const
private

Definition at line 89 of file polynomials_p.cc.

◆ output_indices()

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

Prints the list of the indices to out.

Definition at line 317 of file polynomial_space.h.

◆ set_numbering()

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

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
overridevirtualinherited

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
overridevirtualinherited

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

Consider using evaluate() instead.

Implements ScalarPolynomialsBase< dim >.

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
inherited

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

Consider using evaluate() instead.

Template Parameters
orderThe order of the derivative.

Definition at line 332 of file polynomial_space.h.

◆ compute_1st_derivative()

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

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

Consider using evaluate() instead.

Implements ScalarPolynomialsBase< dim >.

Definition at line 449 of file polynomial_space.h.

◆ compute_2nd_derivative()

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

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

Consider using evaluate() instead.

Implements ScalarPolynomialsBase< dim >.

Definition at line 459 of file polynomial_space.h.

◆ compute_3rd_derivative()

template<int dim>
Tensor< 3, dim > PolynomialSpace< dim >::compute_3rd_derivative ( const unsigned int  i,
const Point< dim > &  p 
) const
inlineoverridevirtualinherited

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

Consider using evaluate() instead.

Implements ScalarPolynomialsBase< dim >.

Definition at line 469 of file polynomial_space.h.

◆ compute_4th_derivative()

template<int dim>
Tensor< 4, dim > PolynomialSpace< dim >::compute_4th_derivative ( const unsigned int  i,
const Point< dim > &  p 
) const
inlineoverridevirtualinherited

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

Consider using evaluate() instead.

Implements ScalarPolynomialsBase< dim >.

Definition at line 479 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
overridevirtualinherited

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

Consider using evaluate() instead.

Implements ScalarPolynomialsBase< dim >.

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
overridevirtualinherited

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

Consider using evaluate() instead.

Implements ScalarPolynomialsBase< dim >.

Definition at line 169 of file polynomial_space.cc.

◆ n_polynomials() [1/2]

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

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.

◆ n_polynomials() [2/2]

unsigned int PolynomialSpace< 0 >::n_polynomials ( const unsigned int  )
inherited

Definition at line 40 of file polynomial_space.cc.

◆ name()

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

Return the name of the space, which is PolynomialSpace.

Implements ScalarPolynomialsBase< dim >.

Definition at line 308 of file polynomial_space.h.

◆ compute_index() [1/7]

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

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.

◆ compute_index() [2/7]

std::array< unsigned int, 1 > PolynomialSpace< 1 >::compute_index ( const unsigned int  n) const
protectedinherited

◆ compute_index() [3/7]

std::array< unsigned int, 2 > PolynomialSpace< 2 >::compute_index ( const unsigned int  n) const
protectedinherited

◆ compute_index() [4/7]

std::array< unsigned int, 3 > PolynomialSpace< 3 >::compute_index ( const unsigned int  n) const
protectedinherited

◆ compute_index() [5/7]

std::array< unsigned int, 1 > PolynomialSpace< 1 >::compute_index ( const unsigned int  i) const
protectedinherited

Definition at line 48 of file polynomial_space.cc.

◆ compute_index() [6/7]

std::array< unsigned int, 2 > PolynomialSpace< 2 >::compute_index ( const unsigned int  i) const
protectedinherited

Definition at line 58 of file polynomial_space.cc.

◆ compute_index() [7/7]

std::array< unsigned int, 3 > PolynomialSpace< 3 >::compute_index ( const unsigned int  i) const
protectedinherited

Definition at line 84 of file polynomial_space.cc.

◆ n()

template<int dim>
unsigned int ScalarPolynomialsBase< dim >::n ( ) const
inlineinherited

Return the number of polynomials.

Definition at line 239 of file scalar_polynomials_base.h.

◆ memory_consumption()

template<int dim>
std::size_t ScalarPolynomialsBase< dim >::memory_consumption ( ) const
virtualinherited

Return an estimate (in bytes) for the memory consumption of this object.

Reimplemented in BarycentricPolynomials< dim >, BarycentricPolynomials< 1 >, BarycentricPolynomials< 2 >, TensorProductPolynomials< dim, PolynomialType >, and TensorProductPolynomials< dim - 1 >.

Definition at line 38 of file scalar_polynomials_base.cc.

Member Data Documentation

◆ dimension

template<int dim>
constexpr unsigned int PolynomialsP< dim >::dimension = dim
staticconstexpr

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

Definition at line 53 of file polynomials_p.h.

◆ p

template<int dim>
const unsigned int PolynomialsP< dim >::p
private

Degree p of the polynomial space \(P_p\), i.e. the number p which was given to the constructor.

Definition at line 96 of file polynomials_p.h.

◆ polynomials

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

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

Definition at line 255 of file polynomial_space.h.

◆ index_map

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

Index map for reordering the polynomials.

Definition at line 260 of file polynomial_space.h.

◆ index_map_inverse

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

Index map for reordering the polynomials.

Definition at line 265 of file polynomial_space.h.

◆ polynomial_degree

template<int dim>
const unsigned int ScalarPolynomialsBase< dim >::polynomial_degree
privateinherited

The highest polynomial degree of this functions represented by this object.

Definition at line 227 of file scalar_polynomials_base.h.

◆ n_pols

template<int dim>
const unsigned int ScalarPolynomialsBase< dim >::n_pols
privateinherited

The number of polynomials represented by this object.

Definition at line 232 of file scalar_polynomials_base.h.


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