|
QUGaR 0.1.3
|
dim-dimensional tensor-product Bezier polynomial function. More...
#include <bezier_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. | |
Public Types inherited from qugar::impl::PolynomialTP< dim, range > | |
| using | CoefsType = std::conditional_t<range == 1, real, Point<range>> |
| Coefs type. | |
Public Types inherited from qugar::impl::DomainFunc< dim, range > | |
| 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 | |
| BezierTP (const TensorSizeTP< dim > &order) | |
| Constructor. | |
| BezierTP (const TensorSizeTP< dim > &order, const CoefsType &value) | |
| Constructs a constant value Bezier tensor product. | |
| BezierTP (const TensorSizeTP< dim > &order, const std::vector< CoefsType > &coefs) | |
| Constructor. | |
| BezierTP (const BezierTP< dim, range > &bezier) | |
| Copy constructor. | |
| BezierTP (const MonomialsTP< dim, range > &monomials) | |
| Constructor. | |
| 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. | |
| const ::algoim::xarray< CoefsType, dim > & | get_xarray () const |
| Gets a constant reference to the stored xarray view of the polynomial coefficients. | |
| template<int dim_aux = dim> requires (dim == dim_aux && dim > 1) | |
| std::shared_ptr< BezierTP< dim - 1, range > > | extract_facet (const int local_facet_id) const |
| std::shared_ptr< BezierTP< dim, range > > | raise_order (const TensorSizeTP< dim > &new_order) const |
| Raises the order of the Bezier tensor product. | |
| std::shared_ptr< BezierTP< dim, range > > | negate () const |
| Creates a new Bezier tensor product (TP) object that is the negation of the current object. | |
| template<int range_aux = range> requires (range_aux == range && range == 1) | |
| void | rescale_domain (const BoundBox< dim > &new_domain) |
| Recomputes (in-place) the Bezier coefficients for a new domain (that may not be [0, 1]). | |
| template<int range_aux = range> requires (range_aux == range && range == 1) | |
| FuncSign | sign () const |
| Returns the sign of the function represented by the Bézier tensor-product using the properties of the control points convex hull. | |
| std::shared_ptr< BezierTP< dim, range > > | operator* (const BezierTP< dim, range > &rhs) const |
| Product of two Beziers. | |
| std::shared_ptr< BezierTP< dim, range > > | operator+ (const BezierTP< dim, range > &rhs) const |
| Addition of two Beziers. | |
| std::shared_ptr< BezierTP< dim, range > > | operator- (const BezierTP< dim, range > &rhs) const |
| Subtraction of two Beziers. | |
| template<int sub_dim> | |
| std::shared_ptr< BezierTP< sub_dim, range > > | compose (const BezierTP< sub_dim, dim > &rhs) const |
Composes the current Bezier with the given Bezier rhs. | |
Public Member Functions inherited from qugar::impl::PolynomialTP< dim, range > | |
| 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. | |
Public Member Functions inherited from qugar::impl::DomainFunc< dim, range > | |
| 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 > | casteljau (const Point< dim, T > &point, typename std::vector< CoefsType >::const_iterator &coefs, const Vector< int, dim > &order) |
| Evaluates a Bezier polynomial using the Casteljau's algorithm. | |
| template<typename T > | |
| static Vector< Value< T >, dim+1 > | casteljau_der (const Point< dim, T > &point, typename std::vector< CoefsType >::const_iterator &coefs, const Vector< int, dim > &order) |
| Evaluates the gradient Bezier polynomial using the Casteljau's algorithm. | |
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. | |
Private Attributes | |
| ::algoim::xarray< CoefsType, dim > | coefs_xarray_ |
| dim-dimensional array view of the coefficients. | |
Additional Inherited Members | |
Static Public Attributes inherited from qugar::impl::DomainFunc< dim, range > | |
| static const int | num_hessian = dim * (dim + 1) / 2 |
| Number of Hessian (symmetric) components. | |
Protected Attributes inherited from qugar::impl::PolynomialTP< dim, range > | |
| TensorSizeTP< dim > | order_ |
| Order of the polynomial along each parametric direction. | |
| std::vector< CoefsType > | coefs_ |
dim-dimensional tensor-product Bezier polynomial function.
| dim | Dimension of the parametric domain. |
| range | Dimension of the image. |
| using qugar::impl::BezierTP< dim, range >::CoefsType = typename Parent::CoefsType |
Coefs type.
| using qugar::impl::BezierTP< dim, range >::Gradient = typename Parent::template Gradient<T> |
Gradient type.
| using qugar::impl::BezierTP< dim, range >::Hessian = typename Parent::template Hessian<T> |
Hessian type.
| using qugar::impl::BezierTP< dim, range >::Interval = ::algoim::Interval<N> |
Algoim's interval alias.
| using qugar::impl::BezierTP< dim, range >::Parent = PolynomialTP<dim, range> |
Parent type.
| using qugar::impl::BezierTP< 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::BezierTP< dim, range >::BezierTP | ( | const TensorSizeTP< dim > & | order, |
| const CoefsType & | value ) |
Constructs a constant value Bezier tensor product.
| order | Order of the polynomial along each parametric direction. |
| value | The value to set for all the coefficients. |
| qugar::impl::BezierTP< dim, range >::BezierTP | ( | 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::BezierTP< dim, range >::BezierTP | ( | const BezierTP< dim, range > & | bezier | ) |
Copy constructor.
| bezier | Bezier to copy. |
|
explicit |
Constructor.
Constructs from monomials.
| monomials | Monomials from which the Bezier is created. |
|
static |
Evaluates a Bezier polynomial using the Casteljau's algorithm.
For the algorithm details check: https://en.wikipedia.org/wiki/De_Casteljau%27s_algorithm
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 Bezier polynomial using the Casteljau's algorithm.
For the algorithm details check: https://en.wikipedia.org/wiki/De_Casteljau%27s_algorithm
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. |
|
nodiscard |
Composes the current Bezier with the given Bezier rhs.
| sub_dim | Subdimension of the right-hand-size Bezier. |
| rhs | Right-hand-side Bezier for the composition. |
|
nodiscardprivate |
Evaluator operator.
| T | Input and output's type. |
| point | Point at which the function is evaluated. |
point.
|
nodiscard |
|
nodiscard |
Gets a constant reference to the stored xarray view of the polynomial coefficients.
|
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.
|
nodiscard |
|
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 >.
|
nodiscard |
Product of two Beziers.
| rhs | Second Bezier to multiply. |
|
nodiscard |
Addition of two Beziers.
| rhs | Second Bezier to sum. |
|
nodiscard |
Subtraction of two Beziers.
| rhs | Bezier to subtract. |
|
nodiscard |
Raises the order of the Bezier tensor product.
This function creates a new Bezier tensor product with an increased order as specified by the new_order parameter. The new Bezier will represent the same polynomial function as the original, but with a higher order.
| new_order | The new order for each dimension of the tensor product. Along each dimension, the new order must be greater or equal than the current order. |
| void qugar::impl::BezierTP< dim, range >::rescale_domain | ( | const BoundBox< dim > & | new_domain | ) |
Recomputes (in-place) the Bezier coefficients for a new domain (that may not be [0, 1]).
| new_domain | New domain for which the coefficientes are computed. |
|
nodiscard |
Returns the sign of the function represented by the Bézier tensor-product using the properties of the control points convex hull.
|
private |
dim-dimensional array view of the coefficients.