DDC 0.1.0
Loading...
Searching...
No Matches
ddc::SplineEvaluator< ExecSpace, MemorySpace, BSplines, EvaluationDDim, LowerExtrapolationRule, UpperExtrapolationRule, IDimX > 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, IDimX >:
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.
 
using batched_evaluation_domain_type = ddc::DiscreteDomain< IDimX... >
 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.
 
using batch_domain_type = ddc::remove_dims_of_t< batched_evaluation_domain_type, evaluation_discrete_dimension_type >
 The type of the batch domain (obtained by removing the dimension of interest from the whole domain).
 
using batched_spline_domain_type = ddc::replace_dim_of_t< batched_evaluation_domain_type, 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... CoordsDims>
void operator() (ddc::ChunkSpan< double, batched_evaluation_domain_type, Layout1, memory_space > const spline_eval, ddc::ChunkSpan< ddc::Coordinate< CoordsDims... > const, batched_evaluation_domain_type, Layout2, memory_space > const coords_eval, ddc::ChunkSpan< double const, batched_spline_domain_type, Layout3, memory_space > const spline_coef) const
 Evaluate 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... CoordsDims>
void deriv (ddc::ChunkSpan< double, batched_evaluation_domain_type, Layout1, memory_space > const spline_eval, ddc::ChunkSpan< ddc::Coordinate< CoordsDims... > const, batched_evaluation_domain_type, Layout2, memory_space > const coords_eval, ddc::ChunkSpan< double const, batched_spline_domain_type, Layout3, memory_space > const spline_coef) const
 Differentiate spline function (described by its spline coefficients) on a mesh.
 
template<class Layout1 , class Layout2 >
void integrate (ddc::ChunkSpan< double, batch_domain_type, Layout1, memory_space > const integrals, ddc::ChunkSpan< double const, batched_spline_domain_type, 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... IDimX>
class ddc::SplineEvaluator< ExecSpace, MemorySpace, BSplines, EvaluationDDim, LowerExtrapolationRule, UpperExtrapolationRule, IDimX >

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.
IDimXA variadic template of all the discrete dimensions forming the full space (EvaluationDDim + batched dimensions).

Definition at line 42 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 67 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 70 of file spline_evaluator.hpp.

◆ bsplines_type

◆ evaluation_domain_type

◆ batched_evaluation_domain_type

The type of the whole domain representing evaluation points.

Definition at line 79 of file spline_evaluator.hpp.

◆ spline_domain_type

The type of the 1D spline domain corresponding to the dimension of interest.

Definition at line 82 of file spline_evaluator.hpp.

◆ batch_domain_type

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

Definition at line 88 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.

Definition at line 95 of file spline_evaluator.hpp.

◆ lower_extrapolation_rule_type

The type of the extrapolation rule at the lower boundary.

Definition at line 101 of file spline_evaluator.hpp.

◆ upper_extrapolation_rule_type

The type of the extrapolation rule at the upper boundary.

Definition at line 104 of file spline_evaluator.hpp.

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 153 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 203 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 217 of file spline_evaluator.hpp.

◆ operator()() [1/2]

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 235 of file spline_evaluator.hpp.

◆ operator()() [2/2]

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 264 of file spline_evaluator.hpp.

◆ deriv() [1/2]

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 304 of file spline_evaluator.hpp.

◆ deriv() [2/2]

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 331 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 374 of file spline_evaluator.hpp.


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