A class for creating a spline approximation of a function. More...
Public Types | |
using | exec_space = ExecSpace |
using | memory_space = MemorySpace |
using | interpolation_mesh_type = InterpolationMesh |
The type of the interpolation mesh used by this class. | |
using | bsplines_type = BSplines |
The type of the BSplines which are compatible with this class. | |
using | deriv_type = ddc::Deriv<tag_type> |
using | interpolation_domain_type = ddc::DiscreteDomain<interpolation_mesh_type> |
The type of the domain for the interpolation mesh used by this class. | |
using | batched_interpolation_domain_type = ddc::DiscreteDomain<IDimX...> |
using | batch_domain_type |
using | batched_spline_domain_type |
using | batched_spline_tr_domain_type |
using | batched_derivs_domain_type |
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_nbc_xmin = n_boundary_equations(BcXmin, BSplines::degree()) |
The number of equations which define the boundary conditions at the lower bound. | |
static constexpr int | s_nbc_xmax = n_boundary_equations(BcXmax, BSplines::degree()) |
The number of equations which define the boundary conditions at the upper bound. | |
static constexpr ddc::BoundCond | s_bc_xmin = BcXmin |
The boundary condition implemented at the lower bound. | |
static constexpr ddc::BoundCond | s_bc_xmax = BcXmax |
The boundary condition implemented at the upper bound. | |
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 BSplines. The spline is constructed such that it respects the boundary conditions BcXmin and BcXmax, and it interpolates the function at the points on the interpolation_mesh associated with interpolation_mesh_type.
using ddc::SplineBuilder< ExecSpace, MemorySpace, BSplines, InterpolationMesh, BcXmin, BcXmax, Solver, IDimX >::exec_space = ExecSpace |
using ddc::SplineBuilder< ExecSpace, MemorySpace, BSplines, InterpolationMesh, BcXmin, BcXmax, Solver, IDimX >::memory_space = MemorySpace |
using ddc::SplineBuilder< ExecSpace, MemorySpace, BSplines, InterpolationMesh, BcXmin, BcXmax, Solver, IDimX >::interpolation_mesh_type = InterpolationMesh |
The type of the interpolation mesh used by this class.
using ddc::SplineBuilder< ExecSpace, MemorySpace, BSplines, InterpolationMesh, BcXmin, BcXmax, Solver, IDimX >::bsplines_type = BSplines |
The type of the BSplines which are compatible with this class.
using ddc::SplineBuilder< ExecSpace, MemorySpace, BSplines, InterpolationMesh, BcXmin, BcXmax, Solver, IDimX >::deriv_type = ddc::Deriv<tag_type> |
using ddc::SplineBuilder< ExecSpace, MemorySpace, BSplines, InterpolationMesh, BcXmin, BcXmax, Solver, IDimX >::interpolation_domain_type = ddc::DiscreteDomain<interpolation_mesh_type> |
The type of the domain for the interpolation mesh used by this class.
using ddc::SplineBuilder< ExecSpace, MemorySpace, BSplines, InterpolationMesh, BcXmin, BcXmax, Solver, IDimX >::batched_interpolation_domain_type = ddc::DiscreteDomain<IDimX...> |
using ddc::SplineBuilder< ExecSpace, MemorySpace, BSplines, InterpolationMesh, BcXmin, BcXmax, Solver, IDimX >::batch_domain_type |
using ddc::SplineBuilder< ExecSpace, MemorySpace, BSplines, InterpolationMesh, BcXmin, BcXmax, Solver, IDimX >::batched_spline_domain_type |
using ddc::SplineBuilder< ExecSpace, MemorySpace, BSplines, InterpolationMesh, BcXmin, BcXmax, Solver, IDimX >::batched_spline_tr_domain_type |
using ddc::SplineBuilder< ExecSpace, MemorySpace, BSplines, InterpolationMesh, BcXmin, BcXmax, Solver, IDimX >::batched_derivs_domain_type |
|
inlineexplicit |
|
delete |
|
default |
Create a new SplineBuilder by copy.
x | The SplineBuilder being copied. |
|
default |
|
delete |
|
default |
Copy a SplineBuilder.
x | The SplineBuilder being copied. |
|
inlinenoexcept |
|
inlinenoexcept |
Get the domain from which the approximation is defined.
Get the domain on which values of the function must be provided in order to build a spline approximation of the function.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Get the domain on which the approximation is defined.
Get the domain of the basis-splines for which the coefficients of the spline approximation must be calculated.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Get the interpolation matrix.
Get the interpolation matrix. This can be useful for debugging (as it allows one to print the matrix) or for more complex quadrature schemes.
void ddc::SplineBuilder< ExecSpace, MemorySpace, BSplines, InterpolationMesh, BcXmin, BcXmax, Solver, IDimX >::operator() | ( | ddc::ChunkSpan< double, batched_spline_domain_type, Layout, memory_space > | spline, |
ddc::ChunkSpan< double const, batched_interpolation_domain_type, Layout, memory_space > | vals, | ||
std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type, Layout, memory_space > > const | derivs_xmin = std::nullopt, | ||
std::optional< ddc::ChunkSpan< double const, batched_derivs_domain_type, Layout, memory_space > > const | derivs_xmax = std::nullopt ) const |
Build a spline approximation of a function.
Use the values of a function at known grid points (as specified by SplineBuilder::interpolation_domain) and the derivatives of the function at the boundaries (if necessary for the chosen boundary conditions) to calculate a spline approximation of a function.
The spline approximation is stored as a ChunkSpan of coefficients associated with basis-splines.
[out] | spline | The coefficients of the spline calculated by the function. |
[in] | vals | The values of the function at the grid points. |
[in] | derivs_xmin | The values of the derivatives at the lower boundary. |
[in] | derivs_xmax | The values of the derivatives at the upper boundary. |
|
staticconstexpr |
Indicates if the degree of the splines is odd or even.
|
staticconstexpr |
The number of equations which define the boundary conditions at the lower bound.
|
staticconstexpr |
The number of equations which define the boundary conditions at the upper bound.
|
staticconstexpr |
The boundary condition implemented at the lower bound.
|
staticconstexpr |
The boundary condition implemented at the upper bound.