DDC 0.0.0

a discrete domain computation library

ddc::UniformBSplines< Tag, D >::Impl< DDim, MemorySpace > Class Template Reference

Storage class of the static attributes of the discrete dimension. More...

Public Types

using discrete_dimension_type = UniformBSplines
 The type of the discrete dimension representing the B-splines.
 
using discrete_domain_type = DiscreteDomain<DDim>
 The type of a DiscreteDomain whose elements identify the B-splines.
 
using discrete_element_type = DiscreteElement<DDim>
 The type of a DiscreteElement identifying a B-spline.
 
using discrete_vector_type = DiscreteVector<DDim>
 The type of a DiscreteVector representing an "index displacement" between two B-splines.
 

Public Member Functions

 Impl ()=default
 
 Impl (ddc::Coordinate< Tag > rmin, ddc::Coordinate< Tag > rmax, std::size_t ncells)
 Constructs a spline basis (B-splines) with n equidistant knots over $[a, b]$.
 
template<class OriginMemorySpace >
 Impl (Impl< DDim, OriginMemorySpace > const &impl)
 Copy-constructs from another Impl with a different Kokkos memory space.
 
 Impl (Impl const &x)=default
 Copy-constructs.
 
 Impl (Impl &&x)=default
 Move-constructs.
 
 ~Impl ()=default
 Destructs.
 
Imploperator= (Impl const &x)=default
 Copy-assigns.
 
Imploperator= (Impl &&x)=default
 Move-assigns.
 
KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis (DSpan1D values, ddc::Coordinate< Tag > const &x) const
 Evaluates non-zero B-splines at a given coordinate.
 
KOKKOS_INLINE_FUNCTION discrete_element_type eval_deriv (DSpan1D derivs, ddc::Coordinate< Tag > const &x) const
 Evaluates non-zero B-spline derivatives at a given coordinate.
 
KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis_and_n_derivs (ddc::DSpan2D derivs, ddc::Coordinate< Tag > const &x, std::size_t n) const
 Evaluates non-zero B-spline values and $n$ derivatives at a given coordinate.
 
template<class Layout , class MemorySpace2 >
KOKKOS_INLINE_FUNCTION ddc::ChunkSpan< double, ddc::DiscreteDomain< DDim >, Layout, MemorySpace2integrals (ddc::ChunkSpan< double, discrete_domain_type, Layout, MemorySpace2 > int_vals) const
 Compute the integrals of the B-splines.
 
KOKKOS_INLINE_FUNCTION ddc::Coordinate< Tagget_knot (int knot_idx) const noexcept
 Returns the coordinate of the knot corresponding to the given index.
 
KOKKOS_INLINE_FUNCTION double get_first_support_knot (discrete_element_type const &ix) const
 Returns the coordinate of the first support knot associated to a DiscreteElement identifying a B-spline.
 
KOKKOS_INLINE_FUNCTION double get_last_support_knot (discrete_element_type const &ix) const
 Returns the coordinate of the last support knot associated to a DiscreteElement identifying a B-spline.
 
KOKKOS_INLINE_FUNCTION double get_support_knot_n (discrete_element_type const &ix, int n) const
 Returns the coordinate of the (n+1)-th knot in the support of the identified B-spline.
 
KOKKOS_INLINE_FUNCTION ddc::Coordinate< Tagrmin () const noexcept
 Returns the coordinate of the lower bound of the domain on which the B-splines are defined.
 
KOKKOS_INLINE_FUNCTION ddc::Coordinate< Tagrmax () const noexcept
 Returns the coordinate of the upper bound of the domain on which the B-splines are defined.
 
KOKKOS_INLINE_FUNCTION double length () const noexcept
 Returns the length of the domain.
 
KOKKOS_INLINE_FUNCTION std::size_t size () const noexcept
 Returns the number of elements necessary to construct a spline representation of a function.
 
KOKKOS_INLINE_FUNCTION discrete_domain_type full_domain () const
 Returns the discrete domain including eventual additional B-splines in the periodic case.
 
KOKKOS_INLINE_FUNCTION std::size_t nbasis () const noexcept
 Returns the number of basis functions.
 
KOKKOS_INLINE_FUNCTION std::size_t ncells () const noexcept
 Returns the number of cells over which the B-splines are defined.
 

Friends

template<class ODDim , class OMemorySpace >
class Impl
 

Detailed Description

template<class Tag, std::size_t D>
template<class DDim, class MemorySpace>
class ddc::UniformBSplines< Tag, D >::Impl< DDim, MemorySpace >

Storage class of the static attributes of the discrete dimension.

Template Parameters
DDimThe name of the discrete dimension.
MemorySpaceThe Kokkos memory space where the attributes are being stored.

Member Typedef Documentation

◆ discrete_dimension_type

template<class Tag , std::size_t D>
template<class DDim , class MemorySpace >
using ddc::UniformBSplines< Tag, D >::Impl< DDim, MemorySpace >::discrete_dimension_type = UniformBSplines

The type of the discrete dimension representing the B-splines.

◆ discrete_domain_type

template<class Tag , std::size_t D>
template<class DDim , class MemorySpace >
using ddc::UniformBSplines< Tag, D >::Impl< DDim, MemorySpace >::discrete_domain_type = DiscreteDomain<DDim>

The type of a DiscreteDomain whose elements identify the B-splines.

◆ discrete_element_type

template<class Tag , std::size_t D>
template<class DDim , class MemorySpace >
using ddc::UniformBSplines< Tag, D >::Impl< DDim, MemorySpace >::discrete_element_type = DiscreteElement<DDim>

The type of a DiscreteElement identifying a B-spline.

◆ discrete_vector_type

template<class Tag , std::size_t D>
template<class DDim , class MemorySpace >
using ddc::UniformBSplines< Tag, D >::Impl< DDim, MemorySpace >::discrete_vector_type = DiscreteVector<DDim>

The type of a DiscreteVector representing an "index displacement" between two B-splines.

Constructor & Destructor Documentation

◆ Impl() [1/5]

template<class Tag , std::size_t D>
template<class DDim , class MemorySpace >
ddc::UniformBSplines< Tag, D >::Impl< DDim, MemorySpace >::Impl ( )
default

◆ Impl() [2/5]

template<class Tag , std::size_t D>
template<class DDim , class MemorySpace >
ddc::UniformBSplines< Tag, D >::Impl< DDim, MemorySpace >::Impl ( ddc::Coordinate< Tag > rmin,
ddc::Coordinate< Tag > rmax,
std::size_t ncells )
inlineexplicit

Constructs a spline basis (B-splines) with n equidistant knots over $[a, b]$.

Parameters
rminthe real ddc::coordinate of the first knot
rmaxthe real ddc::coordinate of the last knot
ncellsthe number of cells in the range [rmin, rmax]

◆ Impl() [3/5]

template<class Tag , std::size_t D>
template<class DDim , class MemorySpace >
ddc::UniformBSplines< Tag, D >::Impl< DDim, MemorySpace >::Impl ( Impl< DDim, OriginMemorySpace > const & impl)
inlineexplicit

Copy-constructs from another Impl with a different Kokkos memory space.

Parameters
implA reference to the other Impl

◆ Impl() [4/5]

template<class Tag , std::size_t D>
template<class DDim , class MemorySpace >
ddc::UniformBSplines< Tag, D >::Impl< DDim, MemorySpace >::Impl ( Impl< DDim, MemorySpace > const & x)
default

Copy-constructs.

Parameters
xA reference to another Impl

◆ Impl() [5/5]

template<class Tag , std::size_t D>
template<class DDim , class MemorySpace >
ddc::UniformBSplines< Tag, D >::Impl< DDim, MemorySpace >::Impl ( Impl< DDim, MemorySpace > && x)
default

Move-constructs.

Parameters
xAn rvalue to another Impl

◆ ~Impl()

template<class Tag , std::size_t D>
template<class DDim , class MemorySpace >
ddc::UniformBSplines< Tag, D >::Impl< DDim, MemorySpace >::~Impl ( )
default

Destructs.

Member Function Documentation

◆ operator=() [1/2]

template<class Tag , std::size_t D>
template<class DDim , class MemorySpace >
Impl & ddc::UniformBSplines< Tag, D >::Impl< DDim, MemorySpace >::operator= ( Impl< DDim, MemorySpace > const & x)
default

Copy-assigns.

Parameters
xA reference to another Impl
Returns
A reference to the copied Impl

◆ operator=() [2/2]

template<class Tag , std::size_t D>
template<class DDim , class MemorySpace >
Impl & ddc::UniformBSplines< Tag, D >::Impl< DDim, MemorySpace >::operator= ( Impl< DDim, MemorySpace > && x)
default

Move-assigns.

Parameters
xAn rvalue to another Impl
Returns
A reference to the moved Impl

◆ eval_basis()

template<class Tag , std::size_t D>
template<class DDim , class MemorySpace >
KOKKOS_INLINE_FUNCTION discrete_element_type ddc::UniformBSplines< Tag, D >::Impl< DDim, MemorySpace >::eval_basis ( DSpan1D values,
ddc::Coordinate< Tag > const & x ) const
inline

Evaluates non-zero B-splines at a given coordinate.

The values are computed for every B-spline with support at the given coordinate x. There are only (degree+1) B-splines which are non-zero at any given point. It is these B-splines which are evaluated. This can be useful to calculate a spline approximation of a function. A spline approximation at coordinate x is a linear combination of these B-spline evaluations weighted with the spline coefficients of the spline-transformed initial discrete function.

Parameters
[out]valuesThe values of the B-splines evaluated at coordinate x. It has to be a 1D mdspan with (degree+1) elements.
[in]xThe coordinate where B-splines are evaluated. It has to be in the range of break points coordinates.
Returns
The index of the first B-spline which is evaluated.

◆ eval_deriv()

template<class Tag , std::size_t D>
template<class DDim , class MemorySpace >
KOKKOS_INLINE_FUNCTION ddc::DiscreteElement< DDim > ddc::UniformBSplines< Tag, D >::Impl< DDim, MemorySpace >::eval_deriv ( DSpan1D derivs,
ddc::Coordinate< Tag > const & x ) const

Evaluates non-zero B-spline derivatives at a given coordinate.

The derivatives are computed for every B-spline with support at the given coordinate x. There are only (degree+1) B-splines which are non-zero at any given point. It is these B-splines which are derivated. A spline approximation of a derivative at coordinate x is a linear combination of those B-spline derivatives weighted with the spline coefficients of the spline-transformed initial discrete function.

Parameters
[out]derivsThe derivatives of the B-splines evaluated at coordinate x. It has to be a 1D mdspan with (degree+1) elements.
[in]xThe coordinate where B-spline derivatives are evaluated. It has to be in the range of break points coordinates.
Returns
The index of the first B-spline which is evaluated.

◆ eval_basis_and_n_derivs()

template<class Tag , std::size_t D>
template<class DDim , class MemorySpace >
KOKKOS_INLINE_FUNCTION ddc::DiscreteElement< DDim > ddc::UniformBSplines< Tag, D >::Impl< DDim, MemorySpace >::eval_basis_and_n_derivs ( ddc::DSpan2D derivs,
ddc::Coordinate< Tag > const & x,
std::size_t n ) const

Evaluates non-zero B-spline values and $n$ derivatives at a given coordinate.

The values and derivatives are computed for every B-spline with support at the given coordinate x. There are only (degree+1) B-splines which are non-zero at any given point. It is these B-splines which are evaluated and derivated. A spline approximation of a derivative at coordinate x is a linear combination of those B-spline derivatives weighted with spline coefficients of the spline-transformed initial discrete function.

Parameters
[out]derivsThe values and $n$ derivatives of the B-splines evaluated at coordinate x. It has to be a 2D mdspan of sizes (degree+1, n+1).
[in]xThe coordinate where B-spline derivatives are evaluated. It has to be in the range of break points coordinates.
[in]nThe number of derivatives to evaluate (in addition to the B-spline values themselves).
Returns
The index of the first B-spline which is evaluated.

◆ integrals()

Compute the integrals of the B-splines.

The integral of each of the B-splines over their support within the domain on which this basis was defined.

Parameters
[out]int_valsThe values of the integrals. It has to be a 1D Chunkspan of size (nbasis).
Returns
The values of the integrals.

◆ get_knot()

template<class Tag , std::size_t D>
template<class DDim , class MemorySpace >
KOKKOS_INLINE_FUNCTION ddc::Coordinate< Tag > ddc::UniformBSplines< Tag, D >::Impl< DDim, MemorySpace >::get_knot ( int knot_idx) const
inlinenoexcept

Returns the coordinate of the knot corresponding to the given index.

Returns the coordinate of the knot corresponding to the given index. The domain over which the B-splines are defined is comprised of ncells+1 break points however there are a total of ncells+1+2*degree knots. The additional knots which control the shape of the B-splines near the boundary are added equidistantly before and after the break points. The knot index is therefore in the interval [-degree, ncells+degree]

Parameters
[in]knot_idxInteger identifying index of the knot.
Returns
Coordinate of the knot.

◆ get_first_support_knot()

template<class Tag , std::size_t D>
template<class DDim , class MemorySpace >
KOKKOS_INLINE_FUNCTION double ddc::UniformBSplines< Tag, D >::Impl< DDim, MemorySpace >::get_first_support_knot ( discrete_element_type const & ix) const
inline

Returns the coordinate of the first support knot associated to a DiscreteElement identifying a B-spline.

Each B-spline has a support defined over (degree+2) knots. For a B-spline identified by the provided DiscreteElement, this function returns the first knot in the support of the B-spline. In other words it returns the lower bound of the support.

Parameters
[in]ixDiscreteElement identifying the B-spline.
Returns
Coordinate of the knot.

◆ get_last_support_knot()

template<class Tag , std::size_t D>
template<class DDim , class MemorySpace >
KOKKOS_INLINE_FUNCTION double ddc::UniformBSplines< Tag, D >::Impl< DDim, MemorySpace >::get_last_support_knot ( discrete_element_type const & ix) const
inline

Returns the coordinate of the last support knot associated to a DiscreteElement identifying a B-spline.

Each B-spline has a support defined over (degree+2) knots. For a B-spline identified by the provided DiscreteElement, this function returns the last knot in the support of the B-spline. In other words it returns the upper bound of the support.

Parameters
[in]ixDiscreteElement identifying the B-spline.
Returns
Coordinate of the knot.

◆ get_support_knot_n()

template<class Tag , std::size_t D>
template<class DDim , class MemorySpace >
KOKKOS_INLINE_FUNCTION double ddc::UniformBSplines< Tag, D >::Impl< DDim, MemorySpace >::get_support_knot_n ( discrete_element_type const & ix,
int n ) const
inline

Returns the coordinate of the (n+1)-th knot in the support of the identified B-spline.

Each B-spline has a support defined over (degree+2) knots. For a B-spline identified by the provided DiscreteElement, this function returns the (n+1)-th knot in the support of the B-spline.

Parameters
[in]ixDiscreteElement identifying the B-spline.
[in]nInteger indexing a knot in the support of the B-spline.
Returns
Coordinate of the knot.

◆ rmin()

template<class Tag , std::size_t D>
template<class DDim , class MemorySpace >
KOKKOS_INLINE_FUNCTION ddc::Coordinate< Tag > ddc::UniformBSplines< Tag, D >::Impl< DDim, MemorySpace >::rmin ( ) const
inlinenoexcept

Returns the coordinate of the lower bound of the domain on which the B-splines are defined.

Returns
Coordinate of the lower bound of the domain.

◆ rmax()

template<class Tag , std::size_t D>
template<class DDim , class MemorySpace >
KOKKOS_INLINE_FUNCTION ddc::Coordinate< Tag > ddc::UniformBSplines< Tag, D >::Impl< DDim, MemorySpace >::rmax ( ) const
inlinenoexcept

Returns the coordinate of the upper bound of the domain on which the B-splines are defined.

Returns
Coordinate of the upper bound of the domain.

◆ length()

template<class Tag , std::size_t D>
template<class DDim , class MemorySpace >
KOKKOS_INLINE_FUNCTION double ddc::UniformBSplines< Tag, D >::Impl< DDim, MemorySpace >::length ( ) const
inlinenoexcept

Returns the length of the domain.

Returns
The length of the domain.

◆ size()

template<class Tag , std::size_t D>
template<class DDim , class MemorySpace >
KOKKOS_INLINE_FUNCTION std::size_t ddc::UniformBSplines< Tag, D >::Impl< DDim, MemorySpace >::size ( ) const
inlinenoexcept

Returns the number of elements necessary to construct a spline representation of a function.

For a non-periodic domain the number of elements necessary to construct a spline representation of a function is equal to the number of basis functions. However in the periodic case it additionally includes degree additional elements which allow the first B-splines to be evaluated close to rmax (where they also appear due to the periodicity).

Returns
The number of elements necessary to construct a spline representation of a function.

◆ full_domain()

template<class Tag , std::size_t D>
template<class DDim , class MemorySpace >
KOKKOS_INLINE_FUNCTION discrete_domain_type ddc::UniformBSplines< Tag, D >::Impl< DDim, MemorySpace >::full_domain ( ) const
inline

Returns the discrete domain including eventual additional B-splines in the periodic case.

See size().

Returns
The discrete domain including eventual additional B-splines.

◆ nbasis()

template<class Tag , std::size_t D>
template<class DDim , class MemorySpace >
KOKKOS_INLINE_FUNCTION std::size_t ddc::UniformBSplines< Tag, D >::Impl< DDim, MemorySpace >::nbasis ( ) const
inlinenoexcept

Returns the number of basis functions.

The number of functions in the spline basis.

Returns
The number of basis functions.

◆ ncells()

template<class Tag , std::size_t D>
template<class DDim , class MemorySpace >
KOKKOS_INLINE_FUNCTION std::size_t ddc::UniformBSplines< Tag, D >::Impl< DDim, MemorySpace >::ncells ( ) const
inlinenoexcept

Returns the number of cells over which the B-splines are defined.

The number of cells over which the B-splines and any spline representation are defined. In other words the number of polynomials that comprise a spline representation on the domain where the basis is defined.

Returns
The number of cells over which the B-splines are defined.

Friends And Related Symbol Documentation

◆ Impl

template<class Tag , std::size_t D>
template<class DDim , class MemorySpace >
template<class ODDim , class OMemorySpace >
friend class Impl
friend

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