Reference documentation for deal.II version 9.6.0
\(\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
BarycentricPolynomial< dim, Number > Class Template Reference

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

Public Member Functions

 BarycentricPolynomial ()
 
 BarycentricPolynomial (const TableIndices< dim+1 > &powers, const Number coefficient)
 
void print (std::ostream &out) const
 
TableIndices< dim+1 > degrees () const
 
BarycentricPolynomial< dim, Number > operator- () const
 
template<typename Number2 >
BarycentricPolynomial< dim, Number > operator+ (const Number2 &a) const
 
template<typename Number2 >
BarycentricPolynomial< dim, Number > operator- (const Number2 &a) const
 
template<typename Number2 >
BarycentricPolynomial< dim, Number > operator* (const Number2 &a) const
 
template<typename Number2 >
BarycentricPolynomial< dim, Number > operator/ (const Number2 &a) const
 
BarycentricPolynomial< dim, Number > operator+ (const BarycentricPolynomial< dim, Number > &augend) const
 
BarycentricPolynomial< dim, Number > operator- (const BarycentricPolynomial< dim, Number > &augend) const
 
BarycentricPolynomial< dim, Number > operator* (const BarycentricPolynomial< dim, Number > &multiplicand) const
 
BarycentricPolynomial< dim, Number > barycentric_derivative (const unsigned int coordinate) const
 
BarycentricPolynomial< dim, Number > derivative (const unsigned int coordinate) const
 
Number value (const Point< dim > &point) const
 
std::size_t memory_consumption () const
 

Static Public Member Functions

static BarycentricPolynomial< dim, Number > monomial (const unsigned int d)
 

Static Protected Member Functions

static TableIndices< dim+1 > index_to_indices (const std::size_t &index, const TableIndices< dim+1 > &extents)
 

Protected Attributes

Table< dim+1, Number > coefficients
 

Detailed Description

template<int dim, typename Number = double>
class BarycentricPolynomial< dim, Number >

Polynomial implemented in barycentric coordinates.

Barycentric coordinates are a coordinate system defined on simplices that are particularly easy to work with since they express coordinates in the simplex as convex combinations of the vertices. For example, any point in a triangle can be written as

\[ (x, y) = c_0 (x_0, y_0) + c_1 (x_1, y_1) + c_2 (x_2, y_2). \]

where each value \(c_i\) is the relative weight of each vertex (so the centroid is, in 2d, where each \(c_i = 1/3\)). Since we only consider convex combinations we can rewrite this equation as

\[ (x, y) = (1 - c_1 - c_2) (x_0, y_0) + c_1 (x_1, y_1) + c_2 (x_2, y_2). \]

This results in three polynomials that are equivalent to \(P^1\) in 2d. More exactly, this class implements a polynomial space defined with the basis, in 2d, of

\begin{align*} t_0(x, y) &= 1 - x - y \\ t_1(x, y) &= x \\ t_2(x, y) &= y \end{align*}

and, in 3d,

\begin{align*} t_0(x, y) &= 1 - x - y - z \\ t_1(x, y) &= x \\ t_2(x, y) &= y \\ t_2(x, y) &= z \end{align*}

which is, in practice, a very convenient basis for defining simplex polynomials: for example, the fourth basis function of a TRI6 element is

\[ 4 * t_1(x, y) * t_2(x, y). \]

Barycentric polynomials in dim-dimensional space have dim + 1 variables in since t_0 can be written in terms of the other monomials.

Monomials can be conveniently constructed with BarycentricPolynomial::monomial().

Definition at line 82 of file polynomials_barycentric.h.

Constructor & Destructor Documentation

◆ BarycentricPolynomial() [1/2]

template<int dim, typename Number >
BarycentricPolynomial< dim, Number >::BarycentricPolynomial ( )

Constructor for the zero polynomial.

Definition at line 397 of file polynomials_barycentric.h.

◆ BarycentricPolynomial() [2/2]

template<int dim, typename Number >
BarycentricPolynomial< dim, Number >::BarycentricPolynomial ( const TableIndices< dim+1 > & powers,
const Number coefficient )

Constructor for a monomial.

Definition at line 410 of file polynomials_barycentric.h.

Member Function Documentation

◆ monomial()

template<int dim, typename Number >
BarycentricPolynomial< dim, Number > BarycentricPolynomial< dim, Number >::monomial ( const unsigned int d)
static

Return the specified monomial.

Definition at line 426 of file polynomials_barycentric.h.

◆ print()

template<int dim, typename Number >
void BarycentricPolynomial< dim, Number >::print ( std::ostream & out) const

Print the polynomial to the output stream with lowest-order terms first. For example, the first P6 basis function is printed as -1 * t0^1 + 2 * t0^2, where t0 is the first barycentric variable, t1 is the second, etc.

Definition at line 438 of file polynomials_barycentric.h.

◆ degrees()

template<int dim, typename Number >
TableIndices< dim+1 > BarycentricPolynomial< dim, Number >::degrees ( ) const

Degree of each barycentric polynomial.

Definition at line 472 of file polynomials_barycentric.h.

◆ operator-() [1/3]

template<int dim, typename Number >
BarycentricPolynomial< dim, Number > BarycentricPolynomial< dim, Number >::operator- ( ) const

Unary minus.

Definition at line 484 of file polynomials_barycentric.h.

◆ operator+() [1/2]

template<int dim, typename Number >
template<typename Number2 >
BarycentricPolynomial< dim, Number > BarycentricPolynomial< dim, Number >::operator+ ( const Number2 & a) const

Add a scalar.

Definition at line 494 of file polynomials_barycentric.h.

◆ operator-() [2/3]

template<int dim, typename Number >
template<typename Number2 >
BarycentricPolynomial< dim, Number > BarycentricPolynomial< dim, Number >::operator- ( const Number2 & a) const

Subtract a scalar.

Definition at line 507 of file polynomials_barycentric.h.

◆ operator*() [1/2]

template<int dim, typename Number >
template<typename Number2 >
BarycentricPolynomial< dim, Number > BarycentricPolynomial< dim, Number >::operator* ( const Number2 & a) const

Multiply by a scalar.

Definition at line 517 of file polynomials_barycentric.h.

◆ operator/()

template<int dim, typename Number >
template<typename Number2 >
BarycentricPolynomial< dim, Number > BarycentricPolynomial< dim, Number >::operator/ ( const Number2 & a) const

Divide by a scalar.

Definition at line 539 of file polynomials_barycentric.h.

◆ operator+() [2/2]

template<int dim, typename Number >
BarycentricPolynomial< dim, Number > BarycentricPolynomial< dim, Number >::operator+ ( const BarycentricPolynomial< dim, Number > & augend) const

Add another barycentric polynomial.

Definition at line 549 of file polynomials_barycentric.h.

◆ operator-() [3/3]

template<int dim, typename Number >
BarycentricPolynomial< dim, Number > BarycentricPolynomial< dim, Number >::operator- ( const BarycentricPolynomial< dim, Number > & augend) const

Subtract another barycentric polynomial.

Definition at line 577 of file polynomials_barycentric.h.

◆ operator*() [2/2]

template<int dim, typename Number >
BarycentricPolynomial< dim, Number > BarycentricPolynomial< dim, Number >::operator* ( const BarycentricPolynomial< dim, Number > & multiplicand) const

Multiply by another barycentric polynomial.

Definition at line 587 of file polynomials_barycentric.h.

◆ barycentric_derivative()

template<int dim, typename Number >
BarycentricPolynomial< dim, Number > BarycentricPolynomial< dim, Number >::barycentric_derivative ( const unsigned int coordinate) const

Differentiate in barycentric coordinates.

Definition at line 623 of file polynomials_barycentric.h.

◆ derivative()

template<int dim, typename Number >
BarycentricPolynomial< dim, Number > BarycentricPolynomial< dim, Number >::derivative ( const unsigned int coordinate) const

Differentiate in Cartesian coordinates.

Definition at line 653 of file polynomials_barycentric.h.

◆ value()

template<int dim, typename Number >
Number BarycentricPolynomial< dim, Number >::value ( const Point< dim > & point) const

Evaluate the polynomial.

Definition at line 664 of file polynomials_barycentric.h.

◆ memory_consumption()

template<int dim, typename Number >
std::size_t BarycentricPolynomial< dim, Number >::memory_consumption ( ) const

Return an estimate, in bytes, of the memory usage of the object.

Definition at line 701 of file polynomials_barycentric.h.

◆ index_to_indices()

template<int dim, typename Number >
TableIndices< dim+1 > BarycentricPolynomial< dim, Number >::index_to_indices ( const std::size_t & index,
const TableIndices< dim+1 > & extents )
staticprotected

Utility function for barycentric polynomials: it is convenient to loop over all the indices at once in a dimension-independent way, but we also need to access the actual indices of the underlying Table object. This utility function converts an integral index into the equivalent TableIndices array (which are also the implicitly stored polynomial exponents).

Definition at line 710 of file polynomials_barycentric.h.

Member Data Documentation

◆ coefficients

template<int dim, typename Number = double>
Table<dim + 1, Number> BarycentricPolynomial< dim, Number >::coefficients
protected

Coefficients of the polynomial. The exponents are the integer indexes.

Definition at line 197 of file polynomials_barycentric.h.


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