DDC 0.5.2
Loading...
Searching...
No Matches
ddc::SplineEvaluator< ExecSpace, MemorySpace, BSplines, EvaluationDDim, LowerExtrapolationRule, UpperExtrapolationRule > Class Template Reference

A class to evaluate, differentiate or integrate a spline function. More...

#include <spline_evaluator.hpp>

Collaboration diagram for ddc::SplineEvaluator< ExecSpace, MemorySpace, BSplines, EvaluationDDim, LowerExtrapolationRule, UpperExtrapolationRule >:
Collaboration graph

Public Types

using exec_space = ExecSpace
 The type of the Kokkos execution space used by this class.
 
using memory_space = MemorySpace
 The type of the Kokkos memory space used by this class.
 
using continuous_dimension_type = typename BSplines::continuous_dimension_type
 The type of the evaluation continuous dimension (continuous dimension of interest) used by this class.
 
using evaluation_discrete_dimension_type = EvaluationDDim
 The type of the evaluation discrete dimension (discrete dimension of interest) used by this class.
 
using bsplines_type = BSplines
 The discrete dimension representing the B-splines.
 
using evaluation_domain_type = ddc::DiscreteDomain< evaluation_discrete_dimension_type >
 The type of the domain for the 1D evaluation mesh used by this class.
 
template<class BatchedInterpolationDDom , class = std::enable_if_t<ddc::is_discrete_domain_v<BatchedInterpolationDDom>>>
using batched_evaluation_domain_type = BatchedInterpolationDDom
 The type of the whole domain representing evaluation points.
 
using spline_domain_type = ddc::DiscreteDomain< bsplines_type >
 The type of the 1D spline domain corresponding to the dimension of interest.
 
template<class BatchedInterpolationDDom , class = std::enable_if_t<ddc::is_discrete_domain_v<BatchedInterpolationDDom>>>
using batch_domain_type = ddc::remove_dims_of_t< BatchedInterpolationDDom, evaluation_discrete_dimension_type >
 The type of the batch domain (obtained by removing the dimension of interest from the whole domain).
 
template<class BatchedInterpolationDDom , class = std::enable_if_t<ddc::is_discrete_domain_v<BatchedInterpolationDDom>>>
using batched_spline_domain_type = ddc::replace_dim_of_t< BatchedInterpolationDDom, evaluation_discrete_dimension_type, bsplines_type >
 The type of the whole spline domain (cartesian product of 1D spline domain and batch domain) preserving the order of dimensions.
 
using lower_extrapolation_rule_type = LowerExtrapolationRule
 The type of the extrapolation rule at the lower boundary.
 
using upper_extrapolation_rule_type = UpperExtrapolationRule
 The type of the extrapolation rule at the upper boundary.
 

Public Member Functions

 SplineEvaluator (LowerExtrapolationRule const &lower_extrap_rule, UpperExtrapolationRule const &upper_extrap_rule)
 Build a SplineEvaluator acting on batched_spline_domain.
 
 SplineEvaluator (SplineEvaluator const &x)=default
 Copy-constructs.
 
 SplineEvaluator (SplineEvaluator &&x)=default
 Move-constructs.
 
 ~SplineEvaluator ()=default
 Destructs.
 
SplineEvaluatoroperator= (SplineEvaluator const &x)=default
 Copy-assigns.
 
SplineEvaluatoroperator= (SplineEvaluator &&x)=default
 Move-assigns.
 
lower_extrapolation_rule_type lower_extrapolation_rule () const
 Get the lower extrapolation rule.
 
upper_extrapolation_rule_type upper_extrapolation_rule () const
 Get the upper extrapolation rule.
 
template<class Layout , class... CoordsDims>
KOKKOS_FUNCTION double operator() (ddc::Coordinate< CoordsDims... > const &coord_eval, ddc::ChunkSpan< double const, spline_domain_type, Layout, memory_space > const spline_coef) const
 Evaluate 1D spline function (described by its spline coefficients) at a given coordinate.
 
template<class Layout1 , class Layout2 , class Layout3 , class BatchedInterpolationDDom , class... CoordsDims>
void operator() (ddc::ChunkSpan< double, BatchedInterpolationDDom, Layout1, memory_space > const spline_eval, ddc::ChunkSpan< ddc::Coordinate< CoordsDims... > const, BatchedInterpolationDDom, Layout2, memory_space > const coords_eval, ddc::ChunkSpan< double const, batched_spline_domain_type< BatchedInterpolationDDom >, Layout3, memory_space > const spline_coef) const
 Evaluate spline function (described by its spline coefficients) on a mesh.
 
template<class Layout1 , class Layout2 , class BatchedInterpolationDDom >
void operator() (ddc::ChunkSpan< double, BatchedInterpolationDDom, Layout1, memory_space > const spline_eval, ddc::ChunkSpan< double const, batched_spline_domain_type< BatchedInterpolationDDom >, Layout2, memory_space > const spline_coef) const
 Evaluate a spline function (described by its spline coefficients) on a mesh.
 
template<class Layout , class... CoordsDims>
KOKKOS_FUNCTION double deriv (ddc::Coordinate< CoordsDims... > const &coord_eval, ddc::ChunkSpan< double const, spline_domain_type, Layout, memory_space > const spline_coef) const
 Differentiate 1D spline function (described by its spline coefficients) at a given coordinate.
 
template<class Layout1 , class Layout2 , class Layout3 , class BatchedInterpolationDDom , class... CoordsDims>
void deriv (ddc::ChunkSpan< double, BatchedInterpolationDDom, Layout1, memory_space > const spline_eval, ddc::ChunkSpan< ddc::Coordinate< CoordsDims... > const, BatchedInterpolationDDom, Layout2, memory_space > const coords_eval, ddc::ChunkSpan< double const, batched_spline_domain_type< BatchedInterpolationDDom >, Layout3, memory_space > const spline_coef) const
 Differentiate spline function (described by its spline coefficients) on a mesh.
 
template<class Layout1 , class Layout2 , class BatchedInterpolationDDom >
void deriv (ddc::ChunkSpan< double, BatchedInterpolationDDom, Layout1, memory_space > const spline_eval, ddc::ChunkSpan< double const, batched_spline_domain_type< BatchedInterpolationDDom >, Layout2, memory_space > const spline_coef) const
 Differentiate spline function (described by its spline coefficients) on a mesh.
 
template<class Layout1 , class Layout2 , class BatchedDDom , class BatchedSplineDDom >
void integrate (ddc::ChunkSpan< double, BatchedDDom, Layout1, memory_space > const integrals, ddc::ChunkSpan< double const, BatchedSplineDDom, Layout2, memory_space > const spline_coef) const
 Perform batched 1D integrations of a spline function (described by its spline coefficients) along the dimension of interest and store results on a subdomain of batch_domain.
 

Detailed Description

template<class ExecSpace, class MemorySpace, class BSplines, class EvaluationDDim, class LowerExtrapolationRule, class UpperExtrapolationRule>
class ddc::SplineEvaluator< ExecSpace, MemorySpace, BSplines, EvaluationDDim, LowerExtrapolationRule, UpperExtrapolationRule >

A class to evaluate, differentiate or integrate a spline function.

A class which contains an operator () which can be used to evaluate, differentiate or integrate a spline function.

Template Parameters
ExecSpaceThe Kokkos execution space on which the spline evaluation is performed.
MemorySpaceThe Kokkos memory space on which the data (spline coefficients and evaluation) is stored.
BSplinesThe discrete dimension representing the B-splines.
EvaluationDDimThe discrete dimension on which evaluation points are defined.
LowerExtrapolationRuleThe lower extrapolation rule type.
UpperExtrapolationRuleThe upper extrapolation rule type.

Definition at line 40 of file spline_evaluator.hpp.

Member Typedef Documentation

◆ exec_space

◆ memory_space

◆ continuous_dimension_type

The type of the evaluation continuous dimension (continuous dimension of interest) used by this class.

Definition at line 65 of file spline_evaluator.hpp.

◆ evaluation_discrete_dimension_type

The type of the evaluation discrete dimension (discrete dimension of interest) used by this class.

Definition at line 68 of file spline_evaluator.hpp.

◆ bsplines_type

◆ evaluation_domain_type

◆ batched_evaluation_domain_type

The type of the whole domain representing evaluation points.

Template Parameters
Thebatched discrete domain on which the interpolation points are defined.

Definition at line 84 of file spline_evaluator.hpp.

◆ spline_domain_type

◆ batch_domain_type

The type of the batch domain (obtained by removing the dimension of interest from the whole domain).

Template Parameters
Thebatched discrete domain on which the interpolation points are defined.

Definition at line 98 of file spline_evaluator.hpp.

◆ batched_spline_domain_type

The type of the whole spline domain (cartesian product of 1D spline domain and batch domain) preserving the order of dimensions.

Template Parameters
Thebatched discrete domain on which the interpolation points are defined.

Definition at line 110 of file spline_evaluator.hpp.

◆ lower_extrapolation_rule_type

◆ upper_extrapolation_rule_type

Constructor & Destructor Documentation

◆ SplineEvaluator() [1/3]

Build a SplineEvaluator acting on batched_spline_domain.

Parameters
lower_extrap_ruleThe extrapolation rule at the lower boundary.
upper_extrap_ruleThe extrapolation rule at the upper boundary.
See also
NullExtrapolationRule ConstantExtrapolationRule PeriodicExtrapolationRule

Definition at line 168 of file spline_evaluator.hpp.

◆ SplineEvaluator() [2/3]

◆ SplineEvaluator() [3/3]

◆ ~SplineEvaluator()

Member Function Documentation

◆ operator=() [1/2]

◆ operator=() [2/2]

◆ lower_extrapolation_rule()

Get the lower extrapolation rule.

Extrapolation rules are functors used to define the behavior of the SplineEvaluator out of the domain where the break points of the B-splines are defined.

Returns
The lower extrapolation rule.
See also
NullExtrapolationRule ConstantExtrapolationRule PeriodicExtrapolationRule

Definition at line 218 of file spline_evaluator.hpp.

◆ upper_extrapolation_rule()

Get the upper extrapolation rule.

Extrapolation rules are functors used to define the behavior of the SplineEvaluator out of the domain where the break points of the B-splines are defined.

Returns
The upper extrapolation rule.
See also
NullExtrapolationRule ConstantExtrapolationRule PeriodicExtrapolationRule

Definition at line 232 of file spline_evaluator.hpp.

◆ operator()() [1/3]

Evaluate 1D spline function (described by its spline coefficients) at a given coordinate.

The spline coefficients represent a 1D spline function defined on a B-splines (basis splines). They can be obtained via various methods, such as using a SplineBuilder.

Remark: calling SplineBuilder then SplineEvaluator corresponds to a spline interpolation.

Parameters
coord_evalThe coordinate where the spline is evaluated. Note that only the component along the dimension of interest is used.
spline_coefA ChunkSpan storing the 1D spline coefficients.
Returns
The value of the spline function at the desired coordinate.

Definition at line 250 of file spline_evaluator.hpp.

◆ operator()() [2/3]

Evaluate spline function (described by its spline coefficients) on a mesh.

The spline coefficients represent a spline function defined on a cartesian product of batch_domain and B-splines (basis splines). They can be obtained via various methods, such as using a SplineBuilder.

This is not a multidimensional evaluation. This is a batched 1D evaluation. This means that for each slice of coordinates identified by a batch_domain_type::discrete_element_type, the evaluation is performed with the 1D set of spline coefficients identified by the same batch_domain_type::discrete_element_type.

Remark: calling SplineBuilder then SplineEvaluator corresponds to a spline interpolation.

Parameters
[out]spline_evalThe values of the spline function at the desired coordinates. For practical reasons those are stored in a ChunkSpan defined on a batched_evaluation_domain_type.
[in]coords_evalThe coordinates where the spline is evaluated. Those are stored in a ChunkSpan defined on a batched_evaluation_domain_type. Note that the coordinates of the points represented by this domain are unused and irrelevant (but the points themselves (DiscreteElement) are used to select the set of 1D spline coefficients retained to perform the evaluation).
[in]spline_coefA ChunkSpan storing the spline coefficients.

Definition at line 284 of file spline_evaluator.hpp.

◆ operator()() [3/3]

Evaluate a spline function (described by its spline coefficients) on a mesh.

The spline coefficients represent a spline function defined on a cartesian product of batch_domain and B-splines (basis splines). They can be obtained via various methods, such as using a SplineBuilder.

This is not a multidimensional evaluation. This is a batched 1D evaluation. This means that for each slice of spline_eval the evaluation is performed with the 1D set of spline coefficients identified by the same batch_domain_type::discrete_element_type.

Remark: calling SplineBuilder then SplineEvaluator corresponds to a spline interpolation.

Parameters
[out]spline_evalThe values of the spline function at the coordinates of the mesh.
[in]spline_coefA ChunkSpan storing the spline coefficients.

Definition at line 336 of file spline_evaluator.hpp.

◆ deriv() [1/3]

Differentiate 1D spline function (described by its spline coefficients) at a given coordinate.

The spline coefficients represent a 1D spline function defined on a B-splines (basis splines). They can be obtained via various methods, such as using a SplineBuilder.

Parameters
coord_evalThe coordinate where the spline is differentiated. Note that only the component along the dimension of interest is used.
spline_coefA ChunkSpan storing the 1D spline coefficients.
Returns
The derivative of the spline function at the desired coordinate.

Definition at line 377 of file spline_evaluator.hpp.

◆ deriv() [2/3]

Differentiate spline function (described by its spline coefficients) on a mesh.

The spline coefficients represent a spline function defined on a cartesian product of batch_domain and B-splines (basis splines). They can be obtained via various methods, such as using a SplineBuilder.

The derivation is not performed in a multidimensional way (in any sense). This is a batched 1D derivation. This means that for each slice of coordinates identified by a batch_domain_type::discrete_element_type, the derivation is performed with the 1D set of spline coefficients identified by the same batch_domain_type::discrete_element_type.

Parameters
[out]spline_evalThe derivatives of the spline function at the desired coordinates. For practical reasons those are stored in a ChunkSpan defined on a batched_evaluation_domain_type.
[in]coords_evalThe coordinates where the spline is differentiated. Those are stored in a ChunkSpan defined on a batched_evaluation_domain_type. Note that the coordinates of the points represented by this domain are unused and irrelevant (but the points themselves (DiscreteElement) are used to select the set of 1D spline coefficients retained to perform the evaluation).
[in]spline_coefA ChunkSpan storing the spline coefficients.

Definition at line 409 of file spline_evaluator.hpp.

◆ deriv() [3/3]

Differentiate spline function (described by its spline coefficients) on a mesh.

The spline coefficients represent a spline function defined on a cartesian product of batch_domain and B-splines (basis splines). They can be obtained via various methods, such as using a SplineBuilder.

The derivation is not performed in a multidimensional way (in any sense). This is a batched 1D derivation. This is not a multidimensional evaluation. This is a batched 1D evaluation. This means that for each slice of spline_eval the evaluation is performed with the 1D set of spline coefficients identified by the same batch_domain_type::discrete_element_type.

Parameters
[out]spline_evalThe derivatives of the spline function at the coordinates.
[in]spline_coefA ChunkSpan storing the spline coefficients.

Definition at line 458 of file spline_evaluator.hpp.

◆ integrate()

Perform batched 1D integrations of a spline function (described by its spline coefficients) along the dimension of interest and store results on a subdomain of batch_domain.

The spline coefficients represent a spline function defined on a B-splines (basis splines). They can be obtained via the SplineBuilder.

The integration is not performed in a multidimensional way (in any sense). This is a batched 1D integration. This means that for each element of integrals, the integration is performed with the 1D set of spline coefficients identified by the same DiscreteElement.

Parameters
[out]integralsThe integrals of the spline function on the subdomain of batch_domain. For practical reasons those are stored in a ChunkSpan defined on a batch_domain_type. Note that the coordinates of the points represented by this domain are unused and irrelevant.
[in]spline_coefA ChunkSpan storing the spline coefficients.

Definition at line 502 of file spline_evaluator.hpp.


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