A class for creating a spline approximation of a function. More...
#include <spline_builder.hpp>

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 = InterpolationDDim::continuous_dimension_type |
| The type of the interpolation continuous dimension (continuous dimension of interest) used by this class. | |
| using | interpolation_discrete_dimension_type = InterpolationDDim |
| The type of the interpolation discrete dimension (discrete dimension of interest) used by this class. | |
| using | bsplines_type = BSplines |
| The discrete dimension representing the B-splines. | |
| using | deriv_type = ddc::Deriv< continuous_dimension_type > |
| The type of the Deriv dimension at the boundaries. | |
| using | interpolation_domain_type = ddc::DiscreteDomain< interpolation_discrete_dimension_type > |
| The type of the domain for the 1D interpolation mesh used by this class. | |
| template<concepts::discrete_domain BatchedInterpolationDDom> | |
| using | batched_interpolation_domain_type = BatchedInterpolationDDom |
| The type of the whole domain representing interpolation points. | |
| template<concepts::discrete_domain BatchedInterpolationDDom> | |
| using | batch_domain_type = ddc::remove_dims_of_t< BatchedInterpolationDDom, interpolation_discrete_dimension_type > |
| The type of the batch domain (obtained by removing the dimension of interest from the whole domain). | |
| template<concepts::discrete_domain BatchedInterpolationDDom> | |
| using | batched_spline_domain_type = ddc::replace_dim_of_t< BatchedInterpolationDDom, interpolation_discrete_dimension_type, bsplines_type > |
| The type of the whole spline domain (cartesian product of 1D spline domain and batch domain) preserving the underlying memory layout (order of dimensions). | |
| template<concepts::discrete_domain BatchedInterpolationDDom> | |
| using | batched_derivs_domain_type = ddc::replace_dim_of_t< BatchedInterpolationDDom, interpolation_discrete_dimension_type, deriv_type > |
| The type of the whole Deriv domain (cartesian product of 1D Deriv domain and batch domain) preserving the underlying memory layout (order of dimensions). | |
Static Public Attributes | |
| static constexpr bool | s_odd = BSplines::degree() % 2 |
| Indicates if the degree of the splines is odd or even. | |
| static constexpr int | s_nbe_xmin = n_boundary_equations(SBCLower, BSplines::degree()) |
| The number of equations defining the closure relation at the lower bound. | |
| static constexpr int | s_nbe_xmax = n_boundary_equations(SBCUpper, BSplines::degree()) |
| The number of equations defining the closure relation at the upper bound. | |
| static constexpr int | s_nbv_xmin |
| The number of input values defining the closure relation at the lower bound. | |
| static constexpr int | s_nbv_xmax |
| The number of input values defining the closure relation at the upper bound. | |
| static constexpr ddc::SplineBuilderClosure | s_sbc_xmin = SBCLower |
| The closure relation implemented at the lower bound. | |
| static constexpr ddc::SplineBuilderClosure | s_sbc_xmax = SBCUpper |
| The closure relation implemented at the upper bound. | |
| static constexpr SplineSolver | s_spline_solver = Solver |
| The SplineSolver giving the backend used to perform the spline approximation. | |
A class for creating a spline approximation of a function.
A class which contains an operator () which can be used to build a spline approximation of a function. A spline approximation is represented by coefficients stored in a Chunk of B-splines. The spline is constructed such that it respects the closure relations SBCLower and SBCUpper, and it interpolates the function at the points on the interpolation_discrete_dimension associated with interpolation_discrete_dimension_type.
| ExecSpace | The Kokkos execution space on which the spline approximation is performed. |
| MemorySpace | The Kokkos memory space on which the data (interpolation function and splines coefficients) is stored. |
| BSplines | The discrete dimension representing the B-splines. |
| InterpolationDDim | The discrete dimension on which interpolation points are defined. |
| SBCLower | The lower closure relation. |
| SBCUpper | The upper closure relation. |
| Solver | The SplineSolver giving the backend used to perform the spline approximation. |
Definition at line 65 of file spline_builder.hpp.
| using ddc::SplineBuilder< ExecSpace, MemorySpace, BSplines, InterpolationDDim, SBCLower, SBCUpper, Solver >::exec_space = ExecSpace |
The type of the Kokkos execution space used by this class.
Definition at line 75 of file spline_builder.hpp.
| using ddc::SplineBuilder< ExecSpace, MemorySpace, BSplines, InterpolationDDim, SBCLower, SBCUpper, Solver >::memory_space = MemorySpace |
The type of the Kokkos memory space used by this class.
Definition at line 78 of file spline_builder.hpp.
| using ddc::SplineBuilder< ExecSpace, MemorySpace, BSplines, InterpolationDDim, SBCLower, SBCUpper, Solver >::continuous_dimension_type = InterpolationDDim::continuous_dimension_type |
The type of the interpolation continuous dimension (continuous dimension of interest) used by this class.
Definition at line 81 of file spline_builder.hpp.
| using ddc::SplineBuilder< ExecSpace, MemorySpace, BSplines, InterpolationDDim, SBCLower, SBCUpper, Solver >::interpolation_discrete_dimension_type = InterpolationDDim |
The type of the interpolation discrete dimension (discrete dimension of interest) used by this class.
Definition at line 84 of file spline_builder.hpp.
| using ddc::SplineBuilder< ExecSpace, MemorySpace, BSplines, InterpolationDDim, SBCLower, SBCUpper, Solver >::bsplines_type = BSplines |
The discrete dimension representing the B-splines.
Definition at line 87 of file spline_builder.hpp.
| using ddc::SplineBuilder< ExecSpace, MemorySpace, BSplines, InterpolationDDim, SBCLower, SBCUpper, Solver >::deriv_type = ddc::Deriv<continuous_dimension_type> |
The type of the Deriv dimension at the boundaries.
Definition at line 90 of file spline_builder.hpp.
| using ddc::SplineBuilder< ExecSpace, MemorySpace, BSplines, InterpolationDDim, SBCLower, SBCUpper, Solver >::interpolation_domain_type = ddc::DiscreteDomain<interpolation_discrete_dimension_type> |
The type of the domain for the 1D interpolation mesh used by this class.
Definition at line 93 of file spline_builder.hpp.
| using ddc::SplineBuilder< ExecSpace, MemorySpace, BSplines, InterpolationDDim, SBCLower, SBCUpper, Solver >::batched_interpolation_domain_type = BatchedInterpolationDDom |
The type of the whole domain representing interpolation points.
| The | batched discrete domain on which the interpolation points are defined. |
Definition at line 101 of file spline_builder.hpp.
| using ddc::SplineBuilder< ExecSpace, MemorySpace, BSplines, InterpolationDDim, SBCLower, SBCUpper, Solver >::batch_domain_type = ddc:: remove_dims_of_t<BatchedInterpolationDDom, interpolation_discrete_dimension_type> |
The type of the batch domain (obtained by removing the dimension of interest from the whole domain).
| The | batched discrete domain on which the interpolation points are defined. |
Example: For batched_interpolation_domain_type = DiscreteDomain<X,Y,Z> and a dimension of interest Y, this is DiscreteDomain<X,Z>
Definition at line 113 of file spline_builder.hpp.
| using ddc::SplineBuilder< ExecSpace, MemorySpace, BSplines, InterpolationDDim, SBCLower, SBCUpper, Solver >::batched_spline_domain_type = ddc::replace_dim_of_t< BatchedInterpolationDDom, interpolation_discrete_dimension_type, bsplines_type> |
The type of the whole spline domain (cartesian product of 1D spline domain and batch domain) preserving the underlying memory layout (order of dimensions).
| The | batched discrete domain on which the interpolation points are defined. |
Example: For batched_interpolation_domain_type = DiscreteDomain<X,Y,Z> and a dimension of interest Y (associated to a B-splines tag BSplinesY), this is DiscreteDomain<X,BSplinesY,Z>.
Definition at line 126 of file spline_builder.hpp.
| using ddc::SplineBuilder< ExecSpace, MemorySpace, BSplines, InterpolationDDim, SBCLower, SBCUpper, Solver >::batched_derivs_domain_type = ddc::replace_dim_of_t< BatchedInterpolationDDom, interpolation_discrete_dimension_type, deriv_type> |
The type of the whole Deriv domain (cartesian product of 1D Deriv domain and batch domain) preserving the underlying memory layout (order of dimensions).
| The | batched discrete domain on which the interpolation points are defined. |
Example: For batched_interpolation_domain_type = DiscreteDomain<X,Y,Z> and a dimension of interest Y, this is DiscreteDomain<X,Deriv<Y>,Z>
Definition at line 160 of file spline_builder.hpp.
|
inlineexplicit |
Build a SplineBuilder acting on interpolation_domain.
| label | A label used to tag parallel regions and memory allocations for profiling. |
| interpolation_domain | The domain on which the interpolation points are defined. |
| cols_per_chunk | A parameter used by the slicer (internal to the solver) to define the size of a chunk of right-hand sides of the linear problem to be computed in parallel (chunks are treated by the linear solver one-after-the-other). This value is optional. If no value is provided then the default value is chosen by the requested solver. |
| preconditioner_max_block_size | A parameter used by the slicer (internal to the solver) to define the size of a block used by the Block-Jacobi preconditioner. This value is optional. If no value is provided then the default value is chosen by the requested solver. |
Definition at line 239 of file spline_builder.hpp.
|
inlineexplicit |
Build a SplineBuilder acting on interpolation_domain.
| interpolation_domain | The domain on which the interpolation points are defined. |
| cols_per_chunk | A parameter used by the slicer (internal to the solver) to define the size of a chunk of right-hand sides of the linear problem to be computed in parallel (chunks are treated by the linear solver one-after-the-other). This value is optional. If no value is provided then the default value is chosen by the requested solver. |
| preconditioner_max_block_size | A parameter used by the slicer (internal to the solver) to define the size of a block used by the Block-Jacobi preconditioner. This value is optional. If no value is provided then the default value is chosen by the requested solver. |
Definition at line 290 of file spline_builder.hpp.
|
inlineexplicit |
Build a SplineBuilder acting on the interpolation domain contained by batched_interpolation_domain.
| label | A label used to tag parallel regions and memory allocations for profiling. |
| batched_interpolation_domain | The whole domain on which the interpolation points are defined. |
| cols_per_chunk | A parameter used by the slicer (internal to the solver) to define the size of a chunk of right-hand sides of the linear problem to be computed in parallel (chunks are treated by the linear solver one-after-the-other). This value is optional. If no value is provided then the default value is chosen by the requested solver. |
| preconditioner_max_block_size | A parameter used by the slicer (internal to the solver) to define the size of a block used by the Block-Jacobi preconditioner. This value is optional. If no value is provided then the default value is chosen by the requested solver. |
Definition at line 321 of file spline_builder.hpp.
|
inlineexplicit |
Build a SplineBuilder acting on the interpolation domain contained by batched_interpolation_domain.
| batched_interpolation_domain | The whole domain on which the interpolation points are defined. |
| cols_per_chunk | A parameter used by the slicer (internal to the solver) to define the size of a chunk of right-hand sides of the linear problem to be computed in parallel (chunks are treated by the linear solver one-after-the-other). This value is optional. If no value is provided then the default value is chosen by the requested solver. |
| preconditioner_max_block_size | A parameter used by the slicer (internal to the solver) to define the size of a block used by the Block-Jacobi preconditioner. This value is optional. If no value is provided then the default value is chosen by the requested solver. |
Definition at line 351 of file spline_builder.hpp.
|
delete |
Copy-constructor is deleted.
|
default |
Move-constructs.
| x | An rvalue to another SplineBuilder. |
|
default |
Destructs.
| delete |
Copy-assignment is deleted.
| default |
|
inlinenoexcept |
Get the domain for the 1D interpolation mesh used by this class.
This is 1D because it is defined along the dimension of interest.
Definition at line 393 of file spline_builder.hpp.
|
inlinenoexcept |
Get the whole domain representing interpolation points.
Values of the function must be provided on this domain in order to build a spline representation of the function (cartesian product of 1D interpolation_domain and batch_domain).
| batched_interpolation_domain | The whole domain on which the interpolation points are defined. |
Definition at line 409 of file spline_builder.hpp.
|
inlinenoexcept |
Get the batch domain.
Obtained by removing the dimension of interest from the whole interpolation domain.
| batched_interpolation_domain | The whole domain on which the interpolation points are defined. |
Definition at line 426 of file spline_builder.hpp.
|
inlinenoexcept |
Get the 1D domain on which spline coefficients are defined.
The 1D spline domain corresponding to the dimension of interest.
Definition at line 440 of file spline_builder.hpp.
|
inlinenoexcept |
Get the whole domain on which spline coefficients are defined.
Spline approximations (spline-transformed functions) are computed on this domain.
| batched_interpolation_domain | The whole domain on which the interpolation points are defined. |
Definition at line 455 of file spline_builder.hpp.
|
inlinenoexcept |
Get the whole domain on which derivatives on lower boundary are defined.
This is only used with SplineBuilderClosure::HERMITE closure relations.
| batched_interpolation_domain | The whole domain on which the interpolation points are defined. |
Definition at line 499 of file spline_builder.hpp.
|
inlinenoexcept |
Get the whole domain on which derivatives on upper boundary are defined.
This is only used with SplineBuilderClosure::HERMITE closure relations.
| batched_interpolation_domain | The whole domain on which the interpolation points are defined. |
Definition at line 520 of file spline_builder.hpp.
| void ddc::SplineBuilder< ExecSpace, MemorySpace, BSplines, InterpolationDDim, SBCLower, SBCUpper, Solver >::operator() | ( | ddc::ChunkSpan< double, batched_spline_domain_type< BatchedInterpolationDDom >, Layout, memory_space > | spline, |
| ddc::ChunkSpan< double const, BatchedInterpolationDDom, Layout, memory_space > | vals, | ||
| std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type< BatchedInterpolationDDom >, Layout, memory_space > > | derivs_xmin = std::nullopt, |
||
| std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type< BatchedInterpolationDDom >, Layout, memory_space > > | derivs_xmax = std::nullopt |
||
| ) | const |
Compute a spline approximation of a function.
Use the values of a function (defined on SplineBuilder::batched_interpolation_domain) and the derivatives of the function at the boundaries (in the case of SplineBuilderClosure::HERMITE only, defined on SplineBuilder::batched_derivs_xmin_domain and SplineBuilder::batched_derivs_xmax_domain) to calculate a spline approximation of this function.
The spline approximation is stored as a ChunkSpan of coefficients associated with B-splines.
| [out] | spline | The coefficients of the spline computed by this SplineBuilder. |
| [in] | vals | The values of the function on the interpolation mesh. |
| [in] | derivs_xmin | The values of the derivatives at the lower boundary (used only with SplineBuilderClosure::HERMITE lower closure relation). |
| [in] | derivs_xmax | The values of the derivatives at the upper boundary (used only with SplineBuilderClosure::HERMITE upper closure relation). |
Definition at line 916 of file spline_builder.hpp.
| std::tuple< ddc::Chunk< double, ddc::DiscreteDomain< ddc::Deriv< typename InterpolationDDim::continuous_dimension_type > >, ddc::KokkosAllocator< double, OutMemorySpace > >, ddc::Chunk< double, ddc::DiscreteDomain< InterpolationDDim >, ddc::KokkosAllocator< double, OutMemorySpace > >, ddc::Chunk< double, ddc::DiscreteDomain< ddc::Deriv< typename InterpolationDDim::continuous_dimension_type > >, ddc::KokkosAllocator< double, OutMemorySpace > > > ddc::SplineBuilder< ExecSpace, MemorySpace, BSplines, InterpolationDDim, SBCLower, SBCUpper, Solver >::quadrature_coefficients | ( | ) | const |
Compute the quadrature coefficients associated to the b-splines used by this SplineBuilder.
Those coefficients can be used to perform integration way faster than SplineEvaluator::integrate().
This function solves matrix equation A^t*Q=integral_bsplines. In case of HERMITE closure relations, integral_bsplines contains the integral coefficients at the boundaries, and Q thus has to be split in three parts (quadrature coefficients for the derivatives at lower boundary, for the values inside the domain and for the derivatives at upper boundary).
A discrete function f can then be integrated using sum_j Q_j*f_j for j in interpolation_domain. If closure relation is HERMITE, sum_j Qderiv_j*(d^j f/dx^j) for j in derivs_domain must be added at the boundary.
Please refer to section 2.8.1 of Emily's Bourne phd (https://theses.fr/2022AIXM0412) for more information and to the (Non)PeriodicSplineBuilderTest for example usage to compute integrals.
| OutMemorySpace | The Kokkos::MemorySpace on which the quadrature coefficients are be returned (but they are computed on ExecSpace then copied). |
Definition at line 1139 of file spline_builder.hpp.
|
staticconstexpr |
Indicates if the degree of the splines is odd or even.
Definition at line 166 of file spline_builder.hpp.
|
staticconstexpr |
The number of equations defining the closure relation at the lower bound.
Definition at line 169 of file spline_builder.hpp.
|
staticconstexpr |
The number of equations defining the closure relation at the upper bound.
Definition at line 172 of file spline_builder.hpp.
|
staticconstexpr |
The number of input values defining the closure relation at the lower bound.
Definition at line 175 of file spline_builder.hpp.
|
staticconstexpr |
The number of input values defining the closure relation at the upper bound.
Definition at line 180 of file spline_builder.hpp.
|
staticconstexpr |
The closure relation implemented at the lower bound.
Definition at line 197 of file spline_builder.hpp.
|
staticconstexpr |
The closure relation implemented at the upper bound.
Definition at line 200 of file spline_builder.hpp.
|
staticconstexpr |
The SplineSolver giving the backend used to perform the spline approximation.
Definition at line 203 of file spline_builder.hpp.