DDC 0.1.0
Loading...
Searching...
No Matches
ddc::NonUniformBSplines< CDim, D >::Impl< DDim, MemorySpace > Class Template Reference

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

#include <bsplines_non_uniform.hpp>

Collaboration diagram for ddc::NonUniformBSplines< CDim, D >::Impl< DDim, MemorySpace >:
Collaboration graph

Public Types

using knot_discrete_dimension_type = NonUniformBsplinesKnots< DDim >
 The type of the knots defining the B-splines.
 
using discrete_dimension_type = NonUniformBSplines
 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 (std::initializer_list< ddc::Coordinate< CDim > > breaks)
 Constructs an Impl using a brace-list, i.e.
 
 Impl (std::vector< ddc::Coordinate< CDim > > const &breaks)
 Constructs an Impl using a std::vector.
 
template<class RandomIt >
 Impl (RandomIt breaks_begin, RandomIt breaks_end)
 Constructs an Impl by iterating over a range of break points from begin to end.
 
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< CDim > const &x) const
 Evaluates non-zero B-splines at a given coordinate.
 
KOKKOS_INLINE_FUNCTION discrete_element_type eval_deriv (DSpan1D derivs, ddc::Coordinate< CDim > 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< CDim > 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::DiscreteElement< knot_discrete_dimension_typeget_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 ddc::DiscreteElement< knot_discrete_dimension_typeget_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 ddc::Coordinate< CDimrmin () const noexcept
 Returns the coordinate of the first break point of the domain on which the B-splines are defined.
 
KOKKOS_INLINE_FUNCTION ddc::Coordinate< CDimrmax () const noexcept
 Returns the coordinate of the last break point 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 ddc::DiscreteDomain< knot_discrete_dimension_typebreak_point_domain () const
 Returns the discrete domain which describes the break points.
 
KOKKOS_INLINE_FUNCTION std::size_t npoints () const noexcept
 The number of break points.
 
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 CDim, std::size_t D>
template<class DDim, class MemorySpace>
class ddc::NonUniformBSplines< CDim, 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.

Definition at line 85 of file bsplines_non_uniform.hpp.

Member Typedef Documentation

◆ knot_discrete_dimension_type

template<class CDim , std::size_t D>
template<class DDim , class MemorySpace >
using ddc::NonUniformBSplines< CDim, D >::Impl< DDim, MemorySpace >::knot_discrete_dimension_type = NonUniformBsplinesKnots<DDim>

The type of the knots defining the B-splines.

Definition at line 92 of file bsplines_non_uniform.hpp.

◆ discrete_dimension_type

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

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

Definition at line 95 of file bsplines_non_uniform.hpp.

◆ discrete_domain_type

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

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

Definition at line 98 of file bsplines_non_uniform.hpp.

◆ discrete_element_type

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

The type of a DiscreteElement identifying a B-spline.

Definition at line 101 of file bsplines_non_uniform.hpp.

◆ discrete_vector_type

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

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

Definition at line 104 of file bsplines_non_uniform.hpp.

Constructor & Destructor Documentation

◆ Impl() [1/7]

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

◆ Impl() [2/7]

template<class CDim , std::size_t D>
template<class DDim , class MemorySpace >
ddc::NonUniformBSplines< CDim, D >::Impl< DDim, MemorySpace >::Impl ( std::initializer_list< ddc::Coordinate< CDim > >  breaks)
inline

Constructs an Impl using a brace-list, i.e.

Impl bsplines({0., 1.})

Constructs an Impl by iterating over a list of break points. Internally this constructor calls the constructor Impl(RandomIt breaks_begin, RandomIt breaks_end).

Parameters
breaksThe std::initializer_list of the coordinates of break points.

Definition at line 120 of file bsplines_non_uniform.hpp.

◆ Impl() [3/7]

template<class CDim , std::size_t D>
template<class DDim , class MemorySpace >
ddc::NonUniformBSplines< CDim, D >::Impl< DDim, MemorySpace >::Impl ( std::vector< ddc::Coordinate< CDim > > const breaks)
inlineexplicit

Constructs an Impl using a std::vector.

Constructs an Impl by iterating over a list of break points. Internally this constructor calls the constructor Impl(RandomIt breaks_begin, RandomIt breaks_end).

Parameters
breaksThe std::vector of the coordinates of break points.

Definition at line 132 of file bsplines_non_uniform.hpp.

◆ Impl() [4/7]

template<class CDim , std::size_t D>
template<class DDim , class MemorySpace >
template<class RandomIt >
ddc::NonUniformBSplines< CDim, D >::Impl< DDim, MemorySpace >::Impl ( RandomIt  breaks_begin,
RandomIt  breaks_end 
)

Constructs an Impl by iterating over a range of break points from begin to end.

The provided break points describe the separation between the cells on which the polynomials comprising a spline are defined. They are used to build a set of knots. There are 2*degree more knots than break points. In the non-periodic case the knots are defined as follows: \( k_i = b_0 \forall 0 \leq i < d \) \( k_{i+d} = b_i \forall 0 \leq i < n_b \) \( k_{i+d+n_b} = b_{n_b-1} \forall 0 \leq i < d \) where \(d\) is the degree of the polynomials, and \(n_b\) is the number of break points in the input pair of iterators. And in the periodic case: \( k_i = b_{n_b-1-d+i} \forall 0 \leq i < d \) \( k_{i+d} = b_i \forall 0 \leq i \leq n_b \) \( k_{i+d+n_b} = b_{i+1} \forall 0 \leq i < d \)

This constructor makes the knots accessible via a DiscreteSpace.

Parameters
breaks_beginThe iterator which points at the beginning of the break points.
breaks_endThe iterator which points at the end of the break points.

Definition at line 419 of file bsplines_non_uniform.hpp.

◆ Impl() [5/7]

template<class CDim , std::size_t D>
template<class DDim , class MemorySpace >
ddc::NonUniformBSplines< CDim, 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.

Definition at line 163 of file bsplines_non_uniform.hpp.

◆ Impl() [6/7]

template<class CDim , std::size_t D>
template<class DDim , class MemorySpace >
ddc::NonUniformBSplines< CDim, D >::Impl< DDim, MemorySpace >::Impl ( Impl< DDim, MemorySpace > const x)
default

Copy-constructs.

Parameters
xA reference to another Impl.

◆ Impl() [7/7]

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

Move-constructs.

Parameters
xAn rvalue to another Impl.

◆ ~Impl()

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

Destructs.

Member Function Documentation

◆ operator=() [1/2]

template<class CDim , std::size_t D>
template<class DDim , class MemorySpace >
Impl & ddc::NonUniformBSplines< CDim, 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 CDim , std::size_t D>
template<class DDim , class MemorySpace >
Impl & ddc::NonUniformBSplines< CDim, D >::Impl< DDim, MemorySpace >::operator= ( Impl< DDim, MemorySpace > &&  x)
default

Move-assigns.

Parameters
xAn rvalue to another Impl.
Returns
A reference to this object.

◆ eval_basis()

template<class CDim , std::size_t D>
template<class DDim , class MemorySpace >
KOKKOS_INLINE_FUNCTION ddc::DiscreteElement< DDim > ddc::NonUniformBSplines< CDim, D >::Impl< DDim, MemorySpace >::eval_basis ( DSpan1D  values,
ddc::Coordinate< CDim > const x 
) const

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.

Definition at line 463 of file bsplines_non_uniform.hpp.

◆ eval_deriv()

template<class CDim , std::size_t D>
template<class DDim , class MemorySpace >
KOKKOS_INLINE_FUNCTION ddc::DiscreteElement< DDim > ddc::NonUniformBSplines< CDim, D >::Impl< DDim, MemorySpace >::eval_deriv ( DSpan1D  derivs,
ddc::Coordinate< CDim > 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 derivated.

Definition at line 503 of file bsplines_non_uniform.hpp.

◆ eval_basis_and_n_derivs()

template<class CDim , std::size_t D>
template<class DDim , class MemorySpace >
KOKKOS_INLINE_FUNCTION ddc::DiscreteElement< DDim > ddc::NonUniformBSplines< CDim, D >::Impl< DDim, MemorySpace >::eval_basis_and_n_derivs ( ddc::DSpan2D  derivs,
ddc::Coordinate< CDim > 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/derivated.

Definition at line 563 of file bsplines_non_uniform.hpp.

◆ 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.

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

Definition at line 702 of file bsplines_non_uniform.hpp.

◆ get_first_support_knot()

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
DiscreteElement of the lower bound of the support of the B-spline.

Definition at line 271 of file bsplines_non_uniform.hpp.

◆ get_last_support_knot()

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
DiscreteElement of the upper bound of the support of the B-spline.

Definition at line 287 of file bsplines_non_uniform.hpp.

◆ rmin()

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

Returns the coordinate of the first break point of the domain on which the B-splines are defined.

Returns
Coordinate of the lower bound of the domain.

Definition at line 297 of file bsplines_non_uniform.hpp.

◆ rmax()

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

Returns the coordinate of the last break point of the domain on which the B-splines are defined.

Returns
Coordinate of the upper bound of the domain.

Definition at line 306 of file bsplines_non_uniform.hpp.

◆ length()

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

Returns the length of the domain.

Returns
The length of the domain.

Definition at line 315 of file bsplines_non_uniform.hpp.

◆ size()

template<class CDim , std::size_t D>
template<class DDim , class MemorySpace >
KOKKOS_INLINE_FUNCTION std::size_t ddc::NonUniformBSplines< CDim, 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.

Definition at line 328 of file bsplines_non_uniform.hpp.

◆ full_domain()

template<class CDim , std::size_t D>
template<class DDim , class MemorySpace >
KOKKOS_INLINE_FUNCTION discrete_domain_type ddc::NonUniformBSplines< CDim, 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.

Definition at line 337 of file bsplines_non_uniform.hpp.

◆ break_point_domain()

template<class CDim , std::size_t D>
template<class DDim , class MemorySpace >
KOKKOS_INLINE_FUNCTION ddc::DiscreteDomain< knot_discrete_dimension_type > ddc::NonUniformBSplines< CDim, D >::Impl< DDim, MemorySpace >::break_point_domain ( ) const
inline

Returns the discrete domain which describes the break points.

Returns
The discrete domain describing the break points.

Definition at line 347 of file bsplines_non_uniform.hpp.

◆ npoints()

template<class CDim , std::size_t D>
template<class DDim , class MemorySpace >
KOKKOS_INLINE_FUNCTION std::size_t ddc::NonUniformBSplines< CDim, D >::Impl< DDim, MemorySpace >::npoints ( ) const
inlinenoexcept

The number of break points.

The number of break points or cell boundaries.

Returns
The number of break points

Definition at line 358 of file bsplines_non_uniform.hpp.

◆ nbasis()

template<class CDim , std::size_t D>
template<class DDim , class MemorySpace >
KOKKOS_INLINE_FUNCTION std::size_t ddc::NonUniformBSplines< CDim, 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.

Definition at line 369 of file bsplines_non_uniform.hpp.

◆ ncells()

template<class CDim , std::size_t D>
template<class DDim , class MemorySpace >
KOKKOS_INLINE_FUNCTION std::size_t ddc::NonUniformBSplines< CDim, 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.

Definition at line 381 of file bsplines_non_uniform.hpp.

Friends And Related Symbol Documentation

◆ Impl

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

Definition at line 88 of file bsplines_non_uniform.hpp.


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