![]() |
Reference documentation for deal.II version 9.6.0
|
#include <deal.II/base/polynomials_hermite.h>
Public Member Functions | |
PolynomialsHermite (const unsigned int regularity, const unsigned int index) | |
double | value (const double x) const |
void | value (const double x, std::vector< double > &values) const |
void | value (const Number2 x, const unsigned int n_derivatives, Number2 *values) const |
void | values_of_array (const std::array< Number2, n_entries > &points, const unsigned int n_derivatives, std::array< Number2, n_entries > *values) const |
unsigned int | degree () const |
void | scale (const double factor) |
void | shift (const number2 offset) |
Polynomial< double > | derivative () const |
Polynomial< double > | primitive () const |
Polynomial< double > & | operator*= (const double s) |
Polynomial< double > & | operator*= (const Polynomial< double > &p) |
Polynomial< double > & | operator+= (const Polynomial< double > &p) |
Polynomial< double > & | operator-= (const Polynomial< double > &p) |
bool | operator== (const Polynomial< double > &p) const |
void | print (std::ostream &out) const |
void | serialize (Archive &ar, const unsigned int version) |
virtual std::size_t | memory_consumption () const |
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 |
Static Public Member Functions | |
static std::vector< Polynomial< double > > | generate_complete_basis (const unsigned int regularity) |
static ::ExceptionBase & | ExcInUse (int arg1, std::string arg2, std::string arg3) |
static ::ExceptionBase & | ExcNoSubscriber (std::string arg1, std::string arg2) |
Protected Member Functions | |
void | transform_into_standard_form () |
Static Protected Member Functions | |
static void | scale (std::vector< double > &coefficients, const double factor) |
static void | shift (std::vector< double > &coefficients, const number2 shift) |
static void | multiply (std::vector< double > &coefficients, const double factor) |
Protected Attributes | |
unsigned int | degree |
unsigned int | regularity |
unsigned int | side_index |
unsigned int | side |
std::vector< double > | coefficients |
bool | in_lagrange_product_form |
std::vector< double > | lagrange_support_points |
double | lagrange_weight |
Private Types | |
using | map_value_type = decltype(counter_map)::value_type |
using | map_iterator = decltype(counter_map)::iterator |
Private Member Functions | |
void | check_no_subscribers () const noexcept |
Private Attributes | |
std::atomic< unsigned int > | counter |
std::map< std::string, unsigned int > | counter_map |
std::vector< std::atomic< bool > * > | validity_pointers |
const std::type_info * | object_info |
Static Private Attributes | |
static std::mutex | mutex |
This class implements Hermite interpolation polynomials (see [60]) enforcing the maximum possible level of regularity \(r\) in the FEM basis given a polynomial degree of \(2r+1\). The polynomials all represent either a non-zero shape value or derivative at \(x=0\) and \(x=1\) on the reference interval \(x \in [0,1]\).
Indices \(j = 0, 1, \dots, r\) refer to polynomials corresponding to a non-zero derivative (or shape value for \(j=0\)) of order \(j\) at \(x=0\), and indices \(j = r+1, r+2, \dots, 2r+1\) refer to polynomials with a non-zero derivative of order \(j-(r+1)\) (or value for \(j=r+1\)) at \(x=1\). In particular, the \(0^{th}\) function has a value of \(1\) at \(x=0\), and the \((r+1)^{th}\) function has a value of \(1\) at \(x=1\).The basis is rescaled such that a function corresponding to a non-zero \(j^{th}\) derivative has derivative value \(j! 4^{j}\) at the corresponding node. This is done to prevent the \(L^{2}\)-norm of the basis functions from reducing exponentially with the chosen regularity.
Definition at line 60 of file polynomials_hermite.h.
|
privateinherited |
The data type used in counter_map.
Definition at line 229 of file subscriptor.h.
|
privateinherited |
The iterator type used in counter_map.
Definition at line 234 of file subscriptor.h.
Polynomials::PolynomialsHermite::PolynomialsHermite | ( | const unsigned int | regularity, |
const unsigned int | index ) |
Constructor for an individual Hermite polynomial. We write \(f_{j}\) for a polynomial that has a non-zero \(j^{th}\) derivative at \(x=0\) and \(g_{j}\) for a polynomial with a non-zero \(j^{th}\) derivative at \(x=1\), meaning \(f_{j}\) will have index
\(=j\) and \(g_{j}\) will have index
\(= j + \mathtt{regularity} + 1\). The resulting polynomials will be degree \(2\times \mathtt{regularity} +1\) and obey the following conditions:
\begin{align*} &\begin{matrix} \left. \frac{d^{i}}{dx^{i}} f_{j}(x) \right\vert_{x=0} = i! 4^{i} \delta_{i, j}, \hfill &\qquad \hfill 0 \leq i \leq \mathtt{regularity}, \\ \left. \frac{d^{i}}{dx^{i}} f_{j}(x) \right\vert_{x=1} = 0, \hfill &\qquad \hfill 0 \leq i \leq \mathtt{regularity}, \end{matrix} \qquad 0 \leq j \leq \mathtt{regularity}, \\ &\begin{matrix} \left. \frac{d^{i}}{dx^{i}} g_{j}(x) \right\vert_{x=0} = 0, \hfill &\qquad \hfill 0 \leq i \leq \mathtt{regularity}, \\ \left. \frac{d^{i}}{dx^{i}} g_{j}(x) \right\vert_{x=1} = i! 4^{i} \delta_{i, j}, \hfill &\qquad \hfill 0 \leq i \leq \mathtt{regularity}, \end{matrix} \qquad 0 \leq j \leq \mathtt{regularity}, \end{align*}
where \(\delta_{i,j}\) is equal to \(1\) whenever \(i=j\), and equal to \(0\) otherwise. These polynomials have explicit formulas given by
\begin{align*} f_{j}(x) &= 4^{j} x^{j} (1-x)^{\mathtt{regularity}+1} \sum_{k=0}^{\mathtt{regularity} - j} \;^{\mathtt{regularity} + k} C_{k} x^{k}, \\ g_{j}(x) &= 4^{j} x^{\mathtt{regularity}+1} (x-1)^{j} \sum_{k=0}^{\mathtt{regularity} - j} \;^{\mathtt{regularity} + k} C_{k} (1-x)^{k}, \end{align*}
where \(^{n} C_{r} = \frac{n!}{r!(n-r)!}\) is the \(r^{th}\) binomial coefficient of degree \(n, \; 0 \leq r \leq n\).
regularity | The highest derivative for which the basis is used to enforce regularity. |
index | The local index of the generated polynomial in the Hermite basis. |
Definition at line 99 of file polynomials_hermite.cc.
|
static |
This function generates a vector of Polynomial objects representing a complete basis of degree \(2\times\mathtt{regularity} +1\) on the reference interval \([0,1]\).
regularity | The generated basis can be used to strongly enforce continuity in all derivatives up to and including this order. |
Definition at line 113 of file polynomials_hermite.cc.
|
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 108 of file polynomial.h.
|
inherited |
Return the values and the derivatives of the Polynomial at point x
. values[i], i=0,...,values.size()-1
includes the i
th 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 121 of file polynomial.cc.
|
inlineinherited |
Return the values and the derivatives of the Polynomial at point x
. values[i], i=0,...,n_derivatives
includes the i
th 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 143 of file polynomial.h.
|
inlineinherited |
Similar to the function above, but evaluate the polynomials on several positions at once, as described by the array argument points
. This function is can be faster than the other function when the same polynomial should be evaluated on several positions at once, e.g., the x,y,z coordinates of a point for tensor-product polynomials.
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 164 of file polynomial.h.
|
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 174 of file polynomial.h.
|
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 184 of file polynomial.cc.
|
staticprotectedinherited |
This function performs the actual scaling.
Definition at line 274 of file polynomial.cc.
|
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 203 of file polynomial.cc.
|
staticprotectedinherited |
This function performs the actual shift
Definition at line 281 of file polynomial.cc.
|
inherited |
Compute the derivative of a polynomial.
Definition at line 209 of file polynomial.cc.
|
inherited |
Compute the primitive of a polynomial. the coefficient of the zero order term of the polynomial is zero.
Definition at line 216 of file polynomial.cc.
|
inherited |
Multiply with a scalar.
Definition at line 222 of file polynomial.cc.
|
inherited |
Multiply with another polynomial.
Definition at line 228 of file polynomial.cc.
|
inherited |
Add a second polynomial.
Definition at line 234 of file polynomial.cc.
|
inherited |
Subtract a second polynomial.
Definition at line 240 of file polynomial.cc.
|
inherited |
Test for equality of two polynomials.
Definition at line 246 of file polynomial.cc.
|
inherited |
Print coefficients.
Definition at line 252 of file polynomial.cc.
|
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 261 of file polynomial.h.
|
virtualinherited |
Return an estimate (in bytes) for the memory consumption of this object.
Definition at line 267 of file polynomial.cc.
|
staticprotectedinherited |
Multiply polynomial by a factor.
Definition at line 287 of file polynomial.cc.
|
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 295 of file polynomial.cc.
|
inherited |
Subscribes a user of the object by storing the pointer validity
. The subscriber may be identified by text supplied as identifier
.
Definition at line 135 of file subscriptor.cc.
|
inherited |
Unsubscribes a user from the object.
identifier
and the validity
pointer must be the same as the one supplied to subscribe(). Definition at line 155 of file subscriptor.cc.
|
inlineinherited |
Return the present number of subscriptions to this object. This allows to use this class for reference counted lifetime determination where the last one to unsubscribe also deletes the object.
Definition at line 300 of file subscriptor.h.
|
inlineinherited |
List the subscribers to the input stream
.
Definition at line 317 of file subscriptor.h.
|
inherited |
List the subscribers to deallog
.
Definition at line 203 of file subscriptor.cc.
|
privatenoexceptinherited |
Check that there are no objects subscribing to this object. If this check passes then it is safe to destroy the current object. It this check fails then this function will either abort or print an error message to deallog (by using the AssertNothrow mechanism), but will not throw an exception.
Definition at line 52 of file subscriptor.cc.
|
protected |
Degree of the polynomial basis being used.
Definition at line 123 of file polynomials_hermite.h.
|
protected |
The order of the highest derivative in which the Hermite basis can be used to impose continuity across element boundaries. It's related to the degree \(p\) by \(p = 2 \times\mathtt{regularity} +1\).
Definition at line 131 of file polynomials_hermite.h.
|
protected |
This variable stores the derivative that the shape function corresponds to at the element boundary given by side
.
Definition at line 137 of file polynomials_hermite.h.
|
protected |
This stores whether the shape function corresponds to a non-zero value or derivative at \(x=0\) on the reference interval ( \(\mathtt{side} =0\)) or at \(x=1\) ( \(\mathtt{side} =1\)).
Definition at line 144 of file polynomials_hermite.h.
|
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 305 of file polynomial.h.
|
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 311 of file polynomial.h.
|
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 317 of file polynomial.h.
|
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 323 of file polynomial.h.
|
mutableprivateinherited |
Store the number of objects which subscribed to this object. Initially, this number is zero, and upon destruction it shall be zero again (i.e. all objects which subscribed should have unsubscribed again).
The creator (and owner) of an object is counted in the map below if HE manages to supply identification.
We use the mutable
keyword in order to allow subscription to constant objects also.
This counter may be read from and written to concurrently in multithreaded code: hence we use the std::atomic
class template.
Definition at line 218 of file subscriptor.h.
|
mutableprivateinherited |
In this map, we count subscriptions for each different identification string supplied to subscribe().
Definition at line 224 of file subscriptor.h.
|
mutableprivateinherited |
In this vector, we store pointers to the validity bool in the SmartPointer objects that subscribe to this class.
Definition at line 240 of file subscriptor.h.
|
mutableprivateinherited |
Pointer to the typeinfo object of this object, from which we can later deduce the class name. Since this information on the derived class is neither available in the destructor, nor in the constructor, we obtain it in between and store it here.
Definition at line 248 of file subscriptor.h.
|
staticprivateinherited |
A mutex used to ensure data consistency when accessing the mutable
members of this class. This lock is used in the subscribe() and unsubscribe() functions, as well as in list_subscribers()
.
Definition at line 271 of file subscriptor.h.