QUGaR 0.0.4
|
dim-dimensional tensor-product monomials function. More...
#include <monomials_tp.hpp>
Public Types | |
using | Parent = PolynomialTP<dim, range> |
Parent type. | |
using | CoefsType = typename Parent::CoefsType |
Coefs type. | |
template<typename T > | |
using | Value = typename Parent::template Value<T> |
Value type. | |
template<typename T > | |
using | Gradient = typename Parent::template Gradient<T> |
Gradient type. | |
template<typename T > | |
using | Hessian = typename Parent::template Hessian<T> |
Hessian type. | |
template<int N> | |
using | Interval = ::algoim::Interval<N> |
Algoim's interval alias. | |
![]() | |
using | CoefsType |
Coefs type. | |
![]() | |
template<int N> | |
using | Interval = ::algoim::Interval<N> |
Algoim's interval alias. | |
template<typename T > | |
using | Value = std::conditional_t<range == 1, T, Vector<T, range>> |
Value type. | |
template<typename T > | |
using | Gradient = Vector<Value<T>, dim> |
Gradient type. | |
template<typename T > | |
using | Hessian = Vector<Value<T>, num_hessian> |
Hessian (symmetric type). | |
Public Member Functions | |
MonomialsTP (const TensorSizeTP< dim > &order) | |
Constructor. | |
MonomialsTP (const TensorSizeTP< dim > &order, const std::vector< CoefsType > &coefs) | |
Constructor. | |
MonomialsTP (const MonomialsTP< dim, range > &monomials) | |
Copy constructor. | |
std::shared_ptr< MonomialsTP< dim, range > > | create_derivative (const int dir) const |
Creates a derivative of the current MonomialsTP object in the specified direction. | |
virtual Value< real > | operator() (const Point< dim > &point) const final |
Evaluator operator. | |
virtual Value< Interval< dim > > | operator() (const Point< dim, Interval< dim > > &point) const final |
Evaluator operator. | |
virtual Gradient< real > | grad (const Point< dim > &point) const final |
Gradient evaluator operator. | |
virtual Gradient< Interval< dim > > | grad (const Point< dim, Interval< dim > > &point) const final |
Gradient evaluator operator. | |
virtual Hessian< real > | hessian (const Point< dim > &point) const final |
Hessian evaluator operator. | |
template<int dim_aux = dim> requires (dim == dim_aux && dim > 1) | |
std::shared_ptr< MonomialsTP< dim - 1, range > > | extract_facet (const int local_facet_id) const |
Extracts a facet from the monomials tensor product. | |
![]() | |
PolynomialTP (const TensorSizeTP< dim > &order) | |
Constructor. | |
PolynomialTP (const TensorSizeTP< dim > &order, const CoefsType &value) | |
Constructs a constant value PolynomialTP object with the specified order. | |
PolynomialTP (const TensorSizeTP< dim > &order, const std::vector< CoefsType > &coefs) | |
Constructor. | |
std::size_t | get_num_coefs () const |
Get the number of coeficients. | |
const std::vector< CoefsType > & | get_coefs () const |
Gets the polynomial coefficients. | |
const TensorSizeTP< dim > & | get_order () const |
Gets the polynomial order along the parametric directions. | |
int | get_order (int dir) const |
Gets the polynomial order (degree + 1) along the direction dir . | |
const CoefsType & | get_coef (int index) const |
Retrieves the coefficients at the specified index. | |
CoefsType & | get_coef (int index) |
Retrieves the coefficients at the specified index. | |
const CoefsType & | get_coef (const TensorIndexTP< dim > &index) const |
Retrieves the coefficient associated with the given tensor index. | |
CoefsType & | get_coef (const TensorIndexTP< dim > &index) |
Retrieves the coefficient associated with the given tensor index. | |
int | get_degree (int dir) const |
Gets the polynomial degree (order - 1) along the direction dir . | |
void | transform_image (const BoundBox< range > &old_domain, const BoundBox< range > &new_domain) |
Transforms (in place) the coefficients of the polynomial from old_domain to new_domain . | |
void | coefs_linear_transform (const real scale, const CoefsType &shift) |
Applies a linear transformation to every coefficient. | |
![]() | |
DomainFunc ()=default | |
Default constructor. | |
DomainFunc (const DomainFunc &)=default | |
Default copy constructor. | |
DomainFunc (DomainFunc &&)=default | |
Default move constructor. | |
DomainFunc & | operator= (const DomainFunc &)=default |
Default copy assignment operator. | |
DomainFunc & | operator= (DomainFunc &&)=default |
Default move assignment operator. | |
virtual | ~DomainFunc ()=default |
Default virtual destructor. | |
Static Public Member Functions | |
template<typename T > | |
static Value< T > | horner (const Point< dim, T > &point, typename std::vector< CoefsType >::const_iterator &coefs, const Vector< int, dim > &order) |
Evaluates a monomials using Horner's method. | |
template<typename T > | |
static Vector< Value< T >, dim+1 > | horner_der (const Point< dim, T > &point, typename std::vector< CoefsType >::const_iterator &coefs, const Vector< int, dim > &order) |
Evaluates the gradient of the monomials using the Horner's method. | |
static void | transform_coefs_to_Bezier (const MonomialsTP< dim, range > &monomials, std::vector< CoefsType > &bzr_coefs) |
Transforms the coefficients of monomials to Bezier form. | |
Private Member Functions | |
template<typename T > | |
Value< T > | eval_ (const Point< dim, T > &point) const |
Evaluator operator. | |
template<typename T > | |
Gradient< T > | grad_ (const Point< dim, T > &point) const |
Gradient evaluator operator. | |
template<typename T > | |
Hessian< T > | hessian_ (const Point< dim, T > &point) const |
Hessian evaluator operator. | |
Additional Inherited Members | |
![]() | |
static const int | num_hessian = dim * (dim + 1) / 2 |
Number of Hessian (symmetric) components. | |
![]() | |
TensorSizeTP< dim > | order_ |
Order of the polynomial along each parametric direction. | |
std::vector< CoefsType > | coefs_ |
dim-dimensional tensor-product monomials function.
dim | Dimension of the parametric domain. |
range | Dimension of the image. |
using qugar::impl::MonomialsTP< dim, range >::CoefsType = typename Parent::CoefsType |
Coefs type.
using qugar::impl::MonomialsTP< dim, range >::Gradient = typename Parent::template Gradient<T> |
Gradient type.
using qugar::impl::MonomialsTP< dim, range >::Hessian = typename Parent::template Hessian<T> |
Hessian type.
using qugar::impl::MonomialsTP< dim, range >::Interval = ::algoim::Interval<N> |
Algoim's interval alias.
using qugar::impl::MonomialsTP< dim, range >::Parent = PolynomialTP<dim, range> |
Parent type.
using qugar::impl::MonomialsTP< dim, range >::Value = typename Parent::template Value<T> |
Value type.
|
explicit |
Constructor.
The coefficients vector is allocated by the constructor.
order | Order of the polynomial along each parametric direction. |
qugar::impl::MonomialsTP< dim, range >::MonomialsTP | ( | const TensorSizeTP< dim > & | order, |
const std::vector< CoefsType > & | coefs ) |
Constructor.
coefs | Coefficients of the polynomial. The ordering is such that dimension 0 is inner-most, i.e., iterates the fastest, while dimension dim-1 is outer-most and iterates the slowest. |
order | Order of the polynomial along each parametric direction. |
qugar::impl::MonomialsTP< dim, range >::MonomialsTP | ( | const MonomialsTP< dim, range > & | monomials | ) |
Copy constructor.
monomials | Monomials to copy. |
|
nodiscard |
Creates a derivative of the current MonomialsTP object in the specified direction.
This function generates a new MonomialsTP object that represents the derivative of the current object in the direction specified by the parameter dir
.
dir | The direction in which to take the derivative. This should be an integer representing the axis or dimension along which the derivative is computed. |
|
nodiscardprivate |
Evaluator operator.
T | Input and output's type. |
point | Point at which the function is evaluated. |
point
.
|
nodiscard |
Extracts a facet from the monomials tensor product.
This function extracts a facet of the monomials tensor product specified by the local facet ID.
dim | The dimension of the monomials tensor product. |
range | The range type of the monomials tensor product. |
local_facet_id | The ID of the local facet to extract. |
|
nodiscardfinalvirtual |
Gradient evaluator operator.
point | Point at which the function's gradient is evaluated. |
point
. Implements qugar::impl::DomainFunc< dim, range >.
|
nodiscardfinalvirtual |
Gradient evaluator operator.
point | Point at which the function's gradient is evaluated. |
point
. Implements qugar::impl::DomainFunc< dim, range >.
|
nodiscardprivate |
Gradient evaluator operator.
T | Input and output's type. |
point | Point at which the function's gradient is evaluated. |
point
.
|
nodiscardfinalvirtual |
Hessian evaluator operator.
point | Point at which the function's hessian is evaluated. |
point
. Implements qugar::impl::DomainFunc< dim, range >.
|
nodiscardprivate |
Hessian evaluator operator.
T | Input and output's type. |
point | Point at which the function's hessian is evaluated. |
point
.
|
static |
Evaluates a monomials using Horner's method.
For the method details check: https://en.wikipedia.org/wiki/Horner%27s_method
The evaluation along the dimensions is performed by recursively calling this function.
T | Type of the input and output variables. |
point | Evaluation point. |
coefs | Iterator to the coefficients of the polynomial. Their ordering is the same as the coefficients members of the class. |
order | Order of the polynomial along the dim dimensions. |
point
.
|
static |
Evaluates the gradient of the monomials using the Horner's method.
For the method details check: https://en.wikipedia.org/wiki/Horner%27s_method
The evaluation along the dimensions is performed by recursively calling this function.
T | Type of the input and output variables. |
point | Evaluation point. |
coefs | Iterator to the coefficients of the polynomial. Their ordering is the same as the coefficients members of the class. |
order | Order of the polynomial along the dim dimensions. |
|
nodiscardfinalvirtual |
Evaluator operator.
point | Point at which the function is evaluated. |
point
. Implements qugar::impl::DomainFunc< dim, range >.
|
nodiscardfinalvirtual |
Evaluator operator.
point | Point at which the function is evaluated. |
point
. Implements qugar::impl::DomainFunc< dim, range >.
|
static |
Transforms the coefficients of monomials to Bezier form.
This function takes the coefficients of monomials and transforms them into the corresponding Bezier coefficients.
monomials | Monomials whose coefficients are transformed. |
bzr_coefs | A vector containing the Bezier coefficients to be computed. |