Reference documentation for deal.II version 9.3.3
PolynomialsBernstein< number > Class Template Reference

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

Inheritance diagram for PolynomialsBernstein< number >:
[legend]

## Public Member Functions

PolynomialsBernstein (const unsigned int index, const unsigned int degree)

number value (const number x) const

void value (const number x, std::vector< number > &values) const

template<typename Number2 >
void value (const Number2 x, const unsigned int n_derivatives, Number2 *values) const

unsigned int degree () const

void scale (const number factor)

template<typename number2 >
void shift (const number2 offset)

Polynomial< number > derivative () const

Polynomial< number > primitive () const

Polynomial< number > & operator*= (const double s)

Polynomial< number > & operator*= (const Polynomial< number > &p)

Polynomial< number > & operator+= (const Polynomial< number > &p)

Polynomial< number > & operator-= (const Polynomial< number > &p)

bool operator== (const Polynomial< number > &p) const

void print (std::ostream &out) const

template<class Archive >
void serialize (Archive &ar, const unsigned int version)

virtual std::size_t memory_consumption () const

## Protected Member Functions

void transform_into_standard_form ()

## Static Protected Member Functions

static void scale (std::vector< number > &coefficients, const number factor)

template<typename number2 >
static void shift (std::vector< number > &coefficients, const number2 shift)

static void multiply (std::vector< number > &coefficients, const number factor)

## Protected Attributes

std::vector< number > coefficients

bool in_lagrange_product_form

std::vector< number > lagrange_support_points

number lagrange_weight

## Subscriptor functionality

Classes derived from Subscriptor provide a facility to subscribe to this object. This is mostly used by the SmartPointer class.

void subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const

void unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const

unsigned int n_subscriptions () const

template<typename StreamType >
void list_subscribers (StreamType &stream) const

void list_subscribers () const

using map_value_type = decltype(counter_map)::value_type

using map_iterator = decltype(counter_map)::iterator

std::atomic< unsigned intcounter

std::map< std::string, unsigned intcounter_map

std::vector< std::atomic< bool > * > validity_pointers

const std::type_info * object_info

static std::mutex mutex

static ::ExceptionBaseExcInUse (int arg1, std::string arg2, std::string arg3)

static ::ExceptionBaseExcNoSubscriber (std::string arg1, std::string arg2)

void check_no_subscribers () const noexcept

## Detailed Description

template<typename number>
class PolynomialsBernstein< number >

This class implements Bernstein basis polynomials of desire degree as described in http://www.idav.ucdavis.edu/education/CAGDNotes/Bernstein-Polynomials.pdf in the paragraph "Converting from the Bernstein Basis to the Power Basis".

They are used to create the Bernstein finite element FE_Bernstein.

Definition at line 41 of file polynomials_bernstein.h.

## ◆ PolynomialsBernstein()

template<typename number >
 PolynomialsBernstein< number >::PolynomialsBernstein ( const unsigned int index, const unsigned int degree )

Construct the index -th Bernstein Polynomial of degree degree.

\begin{align*} B_{\text{index}, \text{degree}} (t) &= \text{binom}(\text{degree}, \text{index}) \cdot t^{\text{index}} \cdot (1 - t)^{\text{degree} - \text{index}} \\ &= \sum_{i = \text{index}}^\text{degree} \cdot (-1)^{i - \text{index}} \cdot \text{binom}(\text{degree}, i) \cdot \text{binom}(i, \text{index}) \cdot t^i \end{align*}

Parameters
 index degree

Definition at line 45 of file polynomials_bernstein.cc.

## ◆ value() [1/3]

template<typename number >
 number Polynomials::Polynomial< number >::value ( const number x ) const
inlineinherited

Return the value of this polynomial at the given point.

This function uses the most numerically stable evaluation algorithm for the provided form of the polynomial. If the polynomial is in the product form of roots, the evaluation is based on products of the form (x - x_i), whereas the Horner scheme is used for polynomials in the coefficient form.

Definition at line 797 of file polynomial.h.

## ◆ value() [2/3]

template<typename number >
 void Polynomials::Polynomial< number >::value ( const number x, std::vector< number > & values ) const
inherited

Return the values and the derivatives of the Polynomial at point x. values[i], i=0,...,values.size()-1 includes the ith derivative. The number of derivatives to be computed is thus determined by the size of the array passed.

This function uses the Horner scheme for numerical stability of the evaluation for polynomials in the coefficient form or the product of terms involving the roots if that representation is used.

Definition at line 100 of file polynomial.cc.

## ◆ value() [3/3]

template<typename number >
template<typename Number2 >
 void Polynomials::Polynomial< number >::value ( const Number2 x, const unsigned int n_derivatives, Number2 * values ) const
inlineinherited

Return the values and the derivatives of the Polynomial at point x. values[i], i=0,...,n_derivatives includes the ith derivative. The number of derivatives to be computed is determined by n_derivatives and values has to provide sufficient space for n_derivatives + 1 values.

This function uses the most numerically stable evaluation algorithm for the provided form of the polynomial. If the polynomial is in the product form of roots, the evaluation is based on products of the form (x - x_i), whereas the Horner scheme is used for polynomials in the coefficient form.

The template type Number2 must implement arithmetic operations such as additions or multiplication with the type number of the polynomial, and must be convertible from number by operator=.

Definition at line 827 of file polynomial.h.

## ◆ degree()

template<typename number >
 unsigned int Polynomials::Polynomial< number >::degree
inlineinherited

Degree of the polynomial. This is the degree reflected by the number of coefficients provided by the constructor. Leading non-zero coefficients are not treated separately.

Definition at line 780 of file polynomial.h.

## ◆ scale() [1/2]

template<typename number >
 void Polynomials::Polynomial< number >::scale ( const number factor )
inherited

Scale the abscissa of the polynomial. Given the polynomial p(t) and the scaling t = ax, then the result of this operation is the polynomial q, such that q(x) = p(t).

The operation is performed in place.

Definition at line 165 of file polynomial.cc.

## ◆ scale() [2/2]

template<typename number >
 void Polynomials::Polynomial< number >::scale ( std::vector< number > & coefficients, const number factor )
staticprotectedinherited

This function performs the actual scaling.

Definition at line 148 of file polynomial.cc.

## ◆ shift() [1/2]

template<typename number >
template<typename number2 >
 void Polynomials::Polynomial< number >::shift ( const number2 offset )
inherited

Shift the abscissa oft the polynomial. Given the polynomial p(t) and the shift t = x + a, then the result of this operation is the polynomial q, such that q(x) = p(t).

The template parameter allows to compute the new coefficients with higher accuracy, since all computations are performed with type number2. This may be necessary, since this operation involves a big number of additions. On a Sun Sparc Ultra with Solaris 2.8, the difference between double and long double was not significant, though.

The operation is performed in place, i.e. the coefficients of the present object are changed.

Definition at line 439 of file polynomial.cc.

## ◆ shift() [2/2]

template<typename number >
template<typename number2 >
 void Polynomials::Polynomial< number >::shift ( std::vector< number > & coefficients, const number2 shift )
staticprotectedinherited

This function performs the actual shift

Definition at line 377 of file polynomial.cc.

## ◆ derivative()

template<typename number >
 Polynomial< number > Polynomials::Polynomial< number >::derivative
inherited

Compute the derivative of a polynomial.

Definition at line 458 of file polynomial.cc.

## ◆ primitive()

template<typename number >
 Polynomial< number > Polynomials::Polynomial< number >::primitive
inherited

Compute the primitive of a polynomial. the coefficient of the zero order term of the polynomial is zero.

Definition at line 487 of file polynomial.cc.

## ◆ operator*=() [1/2]

template<typename number >
 Polynomial< number > & Polynomials::Polynomial< number >::operator*= ( const double s )
inherited

Multiply with a scalar.

Definition at line 203 of file polynomial.cc.

## ◆ operator*=() [2/2]

template<typename number >
 Polynomial< number > & Polynomials::Polynomial< number >::operator*= ( const Polynomial< number > & p )
inherited

Multiply with another polynomial.

Definition at line 221 of file polynomial.cc.

## ◆ operator+=()

template<typename number >
 Polynomial< number > & Polynomials::Polynomial< number >::operator+= ( const Polynomial< number > & p )
inherited

Definition at line 268 of file polynomial.cc.

## ◆ operator-=()

template<typename number >
 Polynomial< number > & Polynomials::Polynomial< number >::operator-= ( const Polynomial< number > & p )
inherited

Subtract a second polynomial.

Definition at line 310 of file polynomial.cc.

## ◆ operator==()

template<typename number >
 bool Polynomials::Polynomial< number >::operator== ( const Polynomial< number > & p ) const
inherited

Test for equality of two polynomials.

Definition at line 346 of file polynomial.cc.

## ◆ print()

template<typename number >
 void Polynomials::Polynomial< number >::print ( std::ostream & out ) const
inherited

Print coefficients.

Definition at line 514 of file polynomial.cc.

## ◆ serialize()

template<typename number >
template<class Archive >
 void Polynomials::Polynomial< number >::serialize ( Archive & ar, const unsigned int version )
inlineinherited

Write or read the data of this object to or from a stream for the purpose of serialization using the BOOST serialization library.

Definition at line 962 of file polynomial.h.

## ◆ memory_consumption()

template<typename number >
 std::size_t Polynomials::Polynomial< number >::memory_consumption
virtualinherited

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

Definition at line 533 of file polynomial.cc.

## ◆ multiply()

template<typename number >
 void Polynomials::Polynomial< number >::multiply ( std::vector< number > & coefficients, const number factor )
staticprotectedinherited

Multiply polynomial by a factor.

Definition at line 190 of file polynomial.cc.

## ◆ transform_into_standard_form()

template<typename number >
 void Polynomials::Polynomial< number >::transform_into_standard_form
protectedinherited

Transform polynomial form of product of linear factors into standard form, $$\sum_i a_i x^i$$. Deletes all data structures related to the product form.

Definition at line 111 of file polynomial.cc.

## ◆ coefficients

template<typename number >
 std::vector Polynomials::Polynomial< number >::coefficients
protectedinherited

Coefficients of the polynomial $$\sum_i a_i x^i$$. This vector is filled by the constructor of this class and may be passed down by derived classes.

This vector cannot be constant since we want to allow copying of polynomials.

Definition at line 282 of file polynomial.h.

## ◆ in_lagrange_product_form

template<typename number >
 bool Polynomials::Polynomial< number >::in_lagrange_product_form
protectedinherited

Stores whether the polynomial is in Lagrange product form, i.e., constructed as a product $$(x-x_0) (x-x_1) \ldots (x-x_n)/c$$, or not.

Definition at line 288 of file polynomial.h.

## ◆ lagrange_support_points

template<typename number >
 std::vector Polynomials::Polynomial< number >::lagrange_support_points
protectedinherited

If the polynomial is in Lagrange product form, i.e., constructed as a product $$(x-x_0) (x-x_1) \ldots (x-x_n)/c$$, store the shifts $$x_i$$.

Definition at line 294 of file polynomial.h.

## ◆ lagrange_weight

template<typename number >
 number Polynomials::Polynomial< number >::lagrange_weight
protectedinherited

If the polynomial is in Lagrange product form, i.e., constructed as a product $$(x-x_0) (x-x_1) \ldots (x-x_n)/c$$, store the weight c.

Definition at line 300 of file polynomial.h.

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