10#include <Kokkos_Core.hpp>
15namespace ddc::detail {
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34template <
class ExecSpace>
35class SplinesLinearProblem3x3Blocks :
public SplinesLinearProblem2x2Blocks<ExecSpace>
38 using typename SplinesLinearProblem2x2Blocks<ExecSpace>::MultiRHS;
39 using SplinesLinearProblem2x2Blocks<ExecSpace>::size;
40 using SplinesLinearProblem2x2Blocks<ExecSpace>::solve;
41 using SplinesLinearProblem2x2Blocks<ExecSpace>::m_top_left_block;
44 std::size_t m_top_size;
48
49
50
51
52
53
54 explicit SplinesLinearProblem3x3Blocks(
57 std::unique_ptr<SplinesLinearProblem<ExecSpace>> center_block);
59 SplinesLinearProblem3x3Blocks(SplinesLinearProblem3x3Blocks
const& rhs) =
delete;
61 SplinesLinearProblem3x3Blocks(SplinesLinearProblem3x3Blocks&& rhs) =
delete;
63 ~SplinesLinearProblem3x3Blocks()
override;
65 SplinesLinearProblem3x3Blocks& operator=(SplinesLinearProblem3x3Blocks
const& rhs) =
delete;
67 SplinesLinearProblem3x3Blocks& operator=(SplinesLinearProblem3x3Blocks&& rhs) =
delete;
71 void adjust_indices(std::size_t& i, std::size_t& j)
const;
74 double get_element(std::size_t i, std::size_t j)
const override;
76 void set_element(std::size_t i, std::size_t j,
double aij)
override;
80
81
82
83
84
85
86
87
88
89
90 void interchange_rows_from_3_to_2_blocks_rhs(MultiRHS b)
const;
93
94
95
96
97
98
99
100
101
102 void interchange_rows_from_2_to_3_blocks_rhs(MultiRHS b)
const;
106
107
108
109
110
111
112
113
114
115 void solve(MultiRHS b,
bool transpose)
const override;
118 std::size_t impl_required_number_of_rhs_rows()
const override;
121#if defined(KOKKOS_ENABLE_SERIAL
)
122extern template class SplinesLinearProblem3x3Blocks<Kokkos::Serial>;
124#if defined(KOKKOS_ENABLE_OPENMP)
125extern template class SplinesLinearProblem3x3Blocks<Kokkos::OpenMP>;
127#if defined(KOKKOS_ENABLE_CUDA)
128extern template class SplinesLinearProblem3x3Blocks<Kokkos::Cuda>;
130#if defined(KOKKOS_ENABLE_HIP)
131extern template class SplinesLinearProblem3x3Blocks<Kokkos::HIP>;
133#if defined(KOKKOS_ENABLE_SYCL)
134extern template class SplinesLinearProblem3x3Blocks<Kokkos::SYCL>;
friend class DiscreteDomain
KOKKOS_FUNCTION constexpr bool operator!=(DiscreteVector< OTags... > const &rhs) const noexcept
A class which provides helper functions to initialise the Greville points from a B-Spline definition.
static ddc::DiscreteDomain< Sampling > get_domain()
Get the domain which gives us access to all of the Greville points.
static auto get_sampling()
Get the UniformPointSampling defining the Greville points.
Helper class for the initialisation of the mesh of interpolation points.
static auto get_sampling()
Get the sampling of interpolation points.
static ddc::DiscreteDomain< Sampling > get_domain()
Get the domain which can be used to access the interpolation points in the sampling.
A class for creating a spline approximation of a function.
batched_derivs_domain_type< BatchedInterpolationDDom > batched_derivs_xmax_domain(BatchedInterpolationDDom const &batched_interpolation_domain) const noexcept
Get the whole domain on which derivatives on upper boundary are defined.
static constexpr SplineSolver s_spline_solver
The SplineSolver giving the backend used to perform the spline approximation.
batch_domain_type< BatchedInterpolationDDom > batch_domain(BatchedInterpolationDDom const &batched_interpolation_domain) const noexcept
Get the batch domain.
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 > > > quadrature_coefficients() const
Compute the quadrature coefficients associated to the b-splines used by this SplineBuilder.
SplineBuilder & operator=(SplineBuilder const &x)=delete
Copy-assignment is deleted.
SplineBuilder(SplineBuilder &&x)=default
Move-constructs.
SplineBuilder(interpolation_domain_type const &interpolation_domain, std::optional< std::size_t > cols_per_chunk=std::nullopt, std::optional< unsigned int > preconditioner_max_block_size=std::nullopt)
Build a SplineBuilder acting on interpolation_domain.
static constexpr ddc::BoundCond s_bc_xmin
The boundary condition implemented at the lower bound.
static constexpr int s_nbc_xmin
The number of equations defining the boundary condition at the lower bound.
SplineBuilder & operator=(SplineBuilder &&x)=default
Move-assigns.
BatchedInterpolationDDom batched_interpolation_domain(BatchedInterpolationDDom const &batched_interpolation_domain) const noexcept
Get the whole domain representing interpolation points.
SplineBuilder(SplineBuilder const &x)=delete
Copy-constructor is deleted.
SplineBuilder(BatchedInterpolationDDom const &batched_interpolation_domain, std::optional< std::size_t > cols_per_chunk=std::nullopt, std::optional< unsigned int > preconditioner_max_block_size=std::nullopt)
Build a SplineBuilder acting on the interpolation domain contained by batched_interpolation_domain.
static constexpr bool s_odd
Indicates if the degree of the splines is odd or even.
interpolation_domain_type interpolation_domain() const noexcept
Get the domain for the 1D interpolation mesh used by this class.
batched_derivs_domain_type< BatchedInterpolationDDom > batched_derivs_xmin_domain(BatchedInterpolationDDom const &batched_interpolation_domain) const noexcept
Get the whole domain on which derivatives on lower boundary are defined.
static constexpr ddc::BoundCond s_bc_xmax
The boundary condition implemented at the upper bound.
static constexpr int s_nbc_xmax
The number of equations defining the boundary condition at the upper bound.
void 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.
batched_spline_domain_type< BatchedInterpolationDDom > batched_spline_domain(BatchedInterpolationDDom const &batched_interpolation_domain) const noexcept
Get the whole domain on which spline coefficients are defined.
ddc::DiscreteDomain< bsplines_type > spline_domain() const noexcept
Get the 1D domain on which spline coefficients are defined.
~SplineBuilder()=default
Destructs.
The top-level namespace of DDC.
constexpr int n_boundary_equations(ddc::BoundCond const bc, std::size_t const degree)
Return the number of equations needed to describe a given boundary condition.
constexpr bool is_uniform_bsplines_v
Indicates if a tag corresponds to uniform B-splines or not.
BoundCond
An enum representing a spline boundary condition.
@ GREVILLE
Use Greville points instead of conditions on derivative for B-Spline interpolation.
@ HERMITE
Hermite boundary condition.
@ PERIODIC
Periodic boundary condition u(1)=u(n)
ddc::ChunkSpan< double, ddc::DiscreteDomain< DDim >, Layout, MemorySpace > integrals(ExecSpace const &execution_space, ddc::ChunkSpan< double, ddc::DiscreteDomain< DDim >, Layout, MemorySpace > int_vals)
Compute the integrals of the B-splines.
SplineSolver
An enum determining the backend solver of a SplineBuilder or SplineBuilder2d.
@ LAPACK
Enum member to identify the LAPACK-based solver (direct method)
@ GINKGO
Enum member to identify the Ginkgo-based solver (iterative method)
constexpr bool is_non_uniform_bsplines_v
Indicates if a tag corresponds to non-uniform B-splines or not.
A templated struct representing a discrete dimension storing the derivatives of a function along a co...
If the type DDim is a B-spline, defines type to the discrete dimension of the associated knots.