QUGaR 0.0.4
Loading...
Searching...
No Matches
qugar::impl::PolynomialTP< dim, range > Class Template Reference

Base class for tensor-product polynomial functions. More...

#include <polynomial_tp.hpp>

Inheritance diagram for qugar::impl::PolynomialTP< dim, range >:
[legend]
Collaboration diagram for qugar::impl::PolynomialTP< dim, range >:
[legend]

Public Types

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

 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 CoefsTypeget_coef (int index) const
 Retrieves the coefficients at the specified index.
 
CoefsTypeget_coef (int index)
 Retrieves the coefficients at the specified index.
 
const CoefsTypeget_coef (const TensorIndexTP< dim > &index) const
 Retrieves the coefficient associated with the given tensor index.
 
CoefsTypeget_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.
 
DomainFuncoperator= (const DomainFunc &)=default
 Default copy assignment operator.
 
DomainFuncoperator= (DomainFunc &&)=default
 Default move assignment operator.
 
virtual ~DomainFunc ()=default
 Default virtual destructor.
 
virtual Value< realoperator() (const Point< dim > &point) const =0
 Evaluator operator.
 
virtual Value< Interval< dim > > operator() (const Point< dim, Interval< dim > > &point) const =0
 Evaluator operator.
 
virtual Gradient< realgrad (const Point< dim > &point) const =0
 Gradient evaluator operator.
 
virtual Gradient< Interval< dim > > grad (const Point< dim, Interval< dim > > &point) const =0
 Gradient evaluator operator.
 
virtual Hessian< realhessian (const Point< dim > &point) const =0
 Hessian evaluator operator.
 

Protected Attributes

TensorSizeTP< dim > order_
 Order of the polynomial along each parametric direction.
 
std::vector< CoefsTypecoefs_
 

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.
 

Detailed Description

template<int dim, int range>
class qugar::impl::PolynomialTP< dim, range >

Base class for tensor-product polynomial functions.

Template Parameters
dimDimension of the parametric domain.
rangeDimension of the image.

Member Typedef Documentation

◆ CoefsType

template<int dim, int range>
using qugar::impl::PolynomialTP< dim, range >::CoefsType = std::conditional_t<range == 1, real, Point<range>>

Coefs type.

Constructor & Destructor Documentation

◆ PolynomialTP() [1/3]

template<int dim, int range>
qugar::impl::PolynomialTP< dim, range >::PolynomialTP ( const TensorSizeTP< dim > & order)
explicit

Constructor.

The coefficients vector is allocated by the constructor.

Parameters
orderOrder of the polynomial along each parametric direction.

◆ PolynomialTP() [2/3]

template<int dim, int range>
qugar::impl::PolynomialTP< dim, range >::PolynomialTP ( const TensorSizeTP< dim > & order,
const CoefsType & value )

Constructs a constant value PolynomialTP object with the specified order.

Parameters
orderThe order of the polynomial tensor.
valueConstant value for all the coefficients.

◆ PolynomialTP() [3/3]

template<int dim, int range>
qugar::impl::PolynomialTP< dim, range >::PolynomialTP ( const TensorSizeTP< dim > & order,
const std::vector< CoefsType > & coefs )

Constructor.

Parameters
coefsCoefficients 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.
orderOrder of the polynomial along each parametric direction.

Member Function Documentation

◆ coefs_linear_transform()

template<int dim, int range>
void qugar::impl::PolynomialTP< dim, range >::coefs_linear_transform ( const real scale,
const CoefsType & shift )

Applies a linear transformation to every coefficient.

It modifies every coefficient as coef = scale * coef + shift.

Parameters
scaleScale of every coefficient.
shiftShift of every coefficient.

◆ get_coef() [1/4]

template<int dim, int range>
CoefsType & qugar::impl::PolynomialTP< dim, range >::get_coef ( const TensorIndexTP< dim > & index)
nodiscard

Retrieves the coefficient associated with the given tensor index.

This function returns a reference to the coefficient corresponding to the specified tensor index. The coefficient is part of the polynomial tensor product representation.

Template Parameters
dimThe dimension of the tensor index.
Parameters
indexThe tensor index for which the coefficient is to be retrieved.
Returns
A non-constant reference to the coefficient associated with the given tensor index.

◆ get_coef() [2/4]

template<int dim, int range>
const CoefsType & qugar::impl::PolynomialTP< dim, range >::get_coef ( const TensorIndexTP< dim > & index) const
nodiscard

Retrieves the coefficient associated with the given tensor index.

This function returns a reference to the coefficient corresponding to the specified tensor index. The coefficient is part of the polynomial tensor product representation.

Template Parameters
dimThe dimension of the tensor index.
Parameters
indexThe tensor index for which the coefficient is to be retrieved.
Returns
A constant reference to the coefficient associated with the given tensor index.

◆ get_coef() [3/4]

template<int dim, int range>
CoefsType & qugar::impl::PolynomialTP< dim, range >::get_coef ( int index)
nodiscard

Retrieves the coefficients at the specified index.

This function returns a constant reference to the coefficients of the polynomial at the given index. The coefficients are of type CoefsType.

Parameters
indexThe index of the coefficients to retrieve.
Returns
A non-constant reference to the coefficients at the specified index.

◆ get_coef() [4/4]

template<int dim, int range>
const CoefsType & qugar::impl::PolynomialTP< dim, range >::get_coef ( int index) const
nodiscard

Retrieves the coefficients at the specified index.

This function returns a constant reference to the coefficients of the polynomial at the given index. The coefficients are of type CoefsType.

Parameters
indexThe index of the coefficients to retrieve.
Returns
A constant reference to the coefficients at the specified index.

◆ get_coefs()

template<int dim, int range>
const std::vector< CoefsType > & qugar::impl::PolynomialTP< dim, range >::get_coefs ( ) const
nodiscard

Gets the polynomial coefficients.

Returns
Constant reference to the polynomial coefficients.

◆ get_degree()

template<int dim, int range>
int qugar::impl::PolynomialTP< dim, range >::get_degree ( int dir) const
nodiscard

Gets the polynomial degree (order - 1) along the direction dir.

Parameters
dirDirection along which the order is retrieved.
Returns
Polynomial degree (order - 1) along dir.

◆ get_num_coefs()

template<int dim, int range>
std::size_t qugar::impl::PolynomialTP< dim, range >::get_num_coefs ( ) const
nodiscard

Get the number of coeficients.

Returns
Number of polynomial coefficients.

◆ get_order() [1/2]

template<int dim, int range>
const TensorSizeTP< dim > & qugar::impl::PolynomialTP< dim, range >::get_order ( ) const
nodiscard

Gets the polynomial order along the parametric directions.

Returns
Constant reference to polynomial order.

◆ get_order() [2/2]

template<int dim, int range>
int qugar::impl::PolynomialTP< dim, range >::get_order ( int dir) const
nodiscard

Gets the polynomial order (degree + 1) along the direction dir.

Parameters
dirDirection along which the order (degree + 1) is retrieved.
Returns
Polynomial order (degree + 1) along dir.

◆ transform_image()

template<int dim, int range>
void qugar::impl::PolynomialTP< dim, range >::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.

Parameters
old_domainDomain from which polynomial coefficients are transformed from.
new_domainDomain to which polynomial coefficients are transformed to.

Member Data Documentation

◆ coefs_

template<int dim, int range>
std::vector<CoefsType> qugar::impl::PolynomialTP< dim, range >::coefs_
protected

Coefficients of the polynomial. The ordering is such that dimension param_di-1 is inner-most, i.e., iterates the fastest, while dimension 0 is outer-most and iterates the slowest.

◆ order_

template<int dim, int range>
TensorSizeTP<dim> qugar::impl::PolynomialTP< dim, range >::order_
protected

Order of the polynomial along each parametric direction.


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