From f60b990ce6d962b6bef64b1a3f00f04a2a0b666a Mon Sep 17 00:00:00 2001 From: blegouix Date: Tue, 2 Apr 2024 19:58:08 +0200 Subject: [PATCH 01/89] init --- examples/characteristics_advection.cpp | 4 +- .../ddc/kernels/splines/spline_builder.hpp | 79 ++++---- .../ddc/kernels/splines/spline_builder_2d.hpp | 172 +++++++++++------- .../ddc/kernels/splines/spline_evaluator.hpp | 51 ++++-- .../kernels/splines/spline_evaluator_2d.hpp | 117 +++++++----- tests/splines/batched_2d_spline_builder.cpp | 2 +- tests/splines/batched_spline_builder.cpp | 2 +- tests/splines/extrapolation_rule.cpp | 2 +- tests/splines/periodicity_spline_builder.cpp | 2 +- 9 files changed, 262 insertions(+), 169 deletions(-) diff --git a/examples/characteristics_advection.cpp b/examples/characteristics_advection.cpp index e9a45d1f5..4e94b04fd 100644 --- a/examples/characteristics_advection.cpp +++ b/examples/characteristics_advection.cpp @@ -232,13 +232,13 @@ int main(int argc, char** argv) //! [instantiate intermediate chunks] // Instantiate chunk of spline coefs to receive output of spline_builder ddc::Chunk coef_alloc( - spline_builder.spline_domain(), + spline_builder.batched_spline_domain(), ddc::DeviceAllocator()); ddc::ChunkSpan coef = coef_alloc.span_view(); // Instantiate chunk to receive feet coords ddc::Chunk feet_coords_alloc( - spline_builder.vals_domain(), + spline_builder.batched_interpolation_domain(), ddc::DeviceAllocator>()); ddc::ChunkSpan feet_coords = feet_coords_alloc.span_view(); //! [instantiate intermediate chunks] diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index 2d2b33a04..0d841d492 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -78,7 +78,7 @@ class SplineBuilder */ using interpolation_domain_type = ddc::DiscreteDomain; - using vals_domain_type = ddc::DiscreteDomain; + using batched_interpolation_domain_type = ddc::DiscreteDomain; using batch_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, bsplines_type, Tag>; - using spline_domain_type = + using batched_batched_spline_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, ddc::detail::TypeSeq>>; - using spline_tr_domain_type = + using batched_spline_tr_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::type_seq_remove_t< ddc::detail::TypeSeq, ddc::detail::TypeSeq>>>; - using derivs_domain_type = + using batched_derivs_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, @@ -152,7 +152,7 @@ class SplineBuilder static constexpr ddc::BoundCond s_bc_xmax = BcXmax; private: - vals_domain_type m_vals_domain; + batched_interpolation_domain_type m_batched_interpolation_domain; int m_offset; @@ -165,10 +165,10 @@ class SplineBuilder int compute_offset(interpolation_domain_type const& interpolation_domain); explicit SplineBuilder( - vals_domain_type const& vals_domain, + batched_interpolation_domain_type const& batched_interpolation_domain, std::optional cols_per_chunk = std::nullopt, std::optional preconditionner_max_block_size = std::nullopt) - : m_vals_domain(vals_domain) + : m_batched_interpolation_domain(batched_interpolation_domain) , m_offset(compute_offset(interpolation_domain())) , m_dx((ddc::discrete_space().rmax() - ddc::discrete_space().rmin()) / ddc::discrete_space().ncells()) @@ -212,9 +212,9 @@ class SplineBuilder */ SplineBuilder& operator=(SplineBuilder&& x) = default; - vals_domain_type vals_domain() const noexcept + batched_interpolation_domain_type batched_interpolation_domain() const noexcept { - return m_vals_domain; + return m_batched_interpolation_domain; } /** @@ -227,15 +227,15 @@ class SplineBuilder */ interpolation_domain_type interpolation_domain() const noexcept { - return interpolation_domain_type(vals_domain()); + return interpolation_domain_type(batched_interpolation_domain()); } batch_domain_type batch_domain() const noexcept { - return ddc::remove_dims_of(vals_domain(), interpolation_domain()); + return ddc::remove_dims_of(batched_interpolation_domain(), interpolation_domain()); } - ddc::DiscreteDomain bsplines_domain() const noexcept // TODO : clarify name + ddc::DiscreteDomain spline_domain() const noexcept // TODO : clarify name { return ddc::discrete_space().full_domain(); } @@ -248,31 +248,31 @@ class SplineBuilder * * @return The domain for the splines. */ - spline_domain_type spline_domain() const noexcept + batched_batched_spline_domain_type batched_spline_domain() const noexcept { return ddc::replace_dim_of< interpolation_mesh_type, - bsplines_type>(vals_domain(), bsplines_domain()); + bsplines_type>(batched_interpolation_domain(), spline_domain()); } - spline_tr_domain_type spline_tr_domain() const noexcept + batched_spline_tr_domain_type spline_tr_domain() const noexcept { - return spline_tr_domain_type(bsplines_domain(), batch_domain()); + return batched_spline_tr_domain_type(spline_domain(), batch_domain()); } - derivs_domain_type derivs_xmin_domain() const noexcept + batched_derivs_domain_type derivs_xmin_domain() const noexcept { return ddc::replace_dim_of( - vals_domain(), + batched_interpolation_domain(), ddc::DiscreteDomain( ddc::DiscreteElement(1), ddc::DiscreteVector(s_nbc_xmin))); } - derivs_domain_type derivs_xmax_domain() const noexcept + batched_derivs_domain_type derivs_xmax_domain() const noexcept { return ddc::replace_dim_of( - vals_domain(), + batched_interpolation_domain(), ddc::DiscreteDomain( ddc::DiscreteElement(1), ddc::DiscreteVector(s_nbc_xmax))); @@ -309,15 +309,20 @@ class SplineBuilder */ template void operator()( - ddc::ChunkSpan spline, - ddc::ChunkSpan vals, - std::optional< - ddc::ChunkSpan> const - derivs_xmin + ddc::ChunkSpan spline, + ddc::ChunkSpan + vals, + std::optional> const derivs_xmin = std::nullopt, - std::optional< - ddc::ChunkSpan> const - derivs_xmax + std::optional> const derivs_xmax = std::nullopt) const; private: @@ -629,12 +634,18 @@ void SplineBuilder< Solver, IDimX...>:: operator()( - ddc::ChunkSpan spline, - ddc::ChunkSpan vals, - std::optional> const - derivs_xmin, - std::optional> const - derivs_xmax) const + ddc::ChunkSpan spline, + ddc::ChunkSpan vals, + std::optional> const derivs_xmin, + std::optional> const derivs_xmax) const { assert(vals.template extent() == ddc::discrete_space().nbasis() - s_nbe_xmin - s_nbe_xmax); diff --git a/include/ddc/kernels/splines/spline_builder_2d.hpp b/include/ddc/kernels/splines/spline_builder_2d.hpp index 5d815527e..d4c9691e1 100644 --- a/include/ddc/kernels/splines/spline_builder_2d.hpp +++ b/include/ddc/kernels/splines/spline_builder_2d.hpp @@ -113,26 +113,26 @@ class SplineBuilder2D using interpolation_domain_type = ddc::DiscreteDomain; - using vals_domain_type = ddc::DiscreteDomain; + using batched_interpolation_domain_type = ddc::DiscreteDomain; using batch_domain_type = ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq>>; - using spline_domain_type + using batched_batched_spline_domain_type = ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, ddc::detail::TypeSeq>>; - using derivs_domain_type1 = typename builder_type1::derivs_domain_type; - using derivs_domain_type2 + using batched_derivs_domain_type1 = typename builder_type1::batched_derivs_domain_type; + using batched_derivs_domain_type2 = ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, ddc::detail::TypeSeq>>; - using derivs_domain_type + using batched_derivs_domain_type = ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, @@ -147,24 +147,27 @@ class SplineBuilder2D /** * @brief Create a new SplineBuilder2D. * - * @param vals_domain + * @param batched_interpolation_domain * The 2D domain on which points will be provided in order to * create the 2D spline approximation. * @param cols_per_chunk The number of columns in the rhs passed to the underlying linear solver. * @param preconditionner_max_block_size The block size of in the block Jacobi preconditioner. */ explicit SplineBuilder2D( - vals_domain_type const& vals_domain, + batched_interpolation_domain_type const& batched_interpolation_domain, std::optional cols_per_chunk = std::nullopt, std::optional preconditionner_max_block_size = std::nullopt) - : m_spline_builder1(vals_domain, cols_per_chunk, preconditionner_max_block_size) + : m_spline_builder1( + batched_interpolation_domain, + cols_per_chunk, + preconditionner_max_block_size) , m_spline_builder_deriv1(ddc::replace_dim_of( - m_spline_builder1.vals_domain(), + m_spline_builder1.batched_interpolation_domain(), ddc::DiscreteDomain( ddc::DiscreteElement(1), ddc::DiscreteVector(bsplines_type2::degree() / 2)))) , m_spline_builder2( - m_spline_builder1.spline_domain(), + m_spline_builder1.batched_spline_domain(), cols_per_chunk, preconditionner_max_block_size) { @@ -200,9 +203,9 @@ class SplineBuilder2D */ SplineBuilder2D& operator=(SplineBuilder2D&& x) = default; - vals_domain_type vals_domain() const noexcept + batched_interpolation_domain_type batched_interpolation_domain() const noexcept { - return m_spline_builder1.vals_domain(); + return m_spline_builder1.batched_interpolation_domain(); } /** @@ -222,7 +225,7 @@ class SplineBuilder2D batch_domain_type batch_domain() const noexcept { - return ddc::remove_dims_of(vals_domain(), interpolation_domain()); + return ddc::remove_dims_of(batched_interpolation_domain(), interpolation_domain()); } /** @@ -233,7 +236,7 @@ class SplineBuilder2D * * @return The 2D domain for the splines. */ - ddc::DiscreteDomain bsplines_domain() + ddc::DiscreteDomain spline_domain() const noexcept // TODO : clarify name { return ddc::DiscreteDomain( @@ -241,13 +244,13 @@ class SplineBuilder2D ddc::discrete_space().full_domain()); } - spline_domain_type spline_domain() const noexcept + batched_batched_spline_domain_type batched_spline_domain() const noexcept { return ddc::replace_dim_of( ddc::replace_dim_of< interpolation_mesh_type2, - bsplines_type2>(vals_domain(), bsplines_domain()), - bsplines_domain()); + bsplines_type2>(batched_interpolation_domain(), spline_domain()), + spline_domain()); } /** @@ -288,39 +291,56 @@ class SplineBuilder2D */ template void operator()( - ddc::ChunkSpan spline, - ddc::ChunkSpan vals, - std::optional< - ddc::ChunkSpan> const - derivs_min1 + ddc::ChunkSpan spline, + ddc::ChunkSpan + vals, + std::optional> const derivs_min1 = std::nullopt, - std::optional< - ddc::ChunkSpan> const - derivs_max1 + std::optional> const derivs_max1 = std::nullopt, - std::optional< - ddc::ChunkSpan> const - derivs_min2 + std::optional> const derivs_min2 = std::nullopt, - std::optional< - ddc::ChunkSpan> const - derivs_max2 + std::optional> const derivs_max2 = std::nullopt, - std::optional< - ddc::ChunkSpan> const - mixed_derivs_min1_min2 + std::optional> const mixed_derivs_min1_min2 = std::nullopt, - std::optional< - ddc::ChunkSpan> const - mixed_derivs_max1_min2 + std::optional> const mixed_derivs_max1_min2 = std::nullopt, - std::optional< - ddc::ChunkSpan> const - mixed_derivs_min1_max2 + std::optional> const mixed_derivs_min1_max2 = std::nullopt, - std::optional< - ddc::ChunkSpan> const - mixed_derivs_max1_max2 + std::optional> const mixed_derivs_max1_max2 = std::nullopt) const; }; @@ -353,29 +373,53 @@ void SplineBuilder2D< Solver, IDimX...>:: operator()( - ddc::ChunkSpan spline, - ddc::ChunkSpan vals, - std::optional> const - derivs_min1, - std::optional> const - derivs_max1, - std::optional> const - derivs_min2, - std::optional> const - derivs_max2, - std::optional> const - mixed_derivs_min1_min2, - std::optional> const - mixed_derivs_max1_min2, - std::optional> const - mixed_derivs_min1_max2, - std::optional> const - mixed_derivs_max1_max2) const + ddc::ChunkSpan spline, + ddc::ChunkSpan vals, + std::optional> const derivs_min1, + std::optional> const derivs_max1, + std::optional> const derivs_min2, + std::optional> const derivs_max2, + std::optional> const mixed_derivs_min1_min2, + std::optional> const mixed_derivs_max1_min2, + std::optional> const mixed_derivs_min1_max2, + std::optional> const mixed_derivs_max1_max2) const { // TODO: perform computations along dimension 1 on different streams ? // Spline1-transform derivs_min2 (to spline1_deriv_min) ddc::Chunk spline1_deriv_min_alloc( - m_spline_builder_deriv1.spline_domain(), + m_spline_builder_deriv1.batched_spline_domain(), ddc::KokkosAllocator()); auto spline1_deriv_min = spline1_deriv_min_alloc.span_view(); auto spline1_deriv_min_opt = std::optional(spline1_deriv_min.span_cview()); @@ -391,7 +435,7 @@ operator()( // Spline1-transform vals (to spline1) ddc::Chunk spline1_alloc( - m_spline_builder1.spline_domain(), + m_spline_builder1.batched_spline_domain(), ddc::KokkosAllocator()); ddc::ChunkSpan spline1 = spline1_alloc.span_view(); @@ -399,7 +443,7 @@ operator()( // Spline1-transform derivs_max2 (to spline1_deriv_max) ddc::Chunk spline1_deriv_max_alloc( - m_spline_builder_deriv1.spline_domain(), + m_spline_builder_deriv1.batched_spline_domain(), ddc::KokkosAllocator()); auto spline1_deriv_max = spline1_deriv_max_alloc.span_view(); auto spline1_deriv_max_opt = std::optional(spline1_deriv_max.span_cview()); diff --git a/include/ddc/kernels/splines/spline_evaluator.hpp b/include/ddc/kernels/splines/spline_evaluator.hpp index fc5295c2d..dff77f8e7 100644 --- a/include/ddc/kernels/splines/spline_evaluator.hpp +++ b/include/ddc/kernels/splines/spline_evaluator.hpp @@ -49,9 +49,9 @@ class SplineEvaluator using interpolation_domain_type = ddc::DiscreteDomain; - using vals_domain_type = ddc::DiscreteDomain; + using batched_interpolation_domain_type = ddc::DiscreteDomain; - using bsplines_domain_type = ddc::DiscreteDomain; + using batched_spline_domain_type = ddc::DiscreteDomain; using batch_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, bsplines_type, Tag>; - using spline_domain_type = + using batched_batched_spline_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, @@ -91,7 +91,7 @@ class SplineEvaluator ddc::Coordinate, ddc::ChunkSpan< double const, - bsplines_domain_type, + batched_spline_domain_type, std::experimental::layout_right, memory_space>>, "LeftExtrapolationRule::operator() has to be callable with usual arguments."); @@ -102,7 +102,7 @@ class SplineEvaluator ddc::Coordinate, ddc::ChunkSpan< double const, - bsplines_domain_type, + batched_spline_domain_type, std::experimental::layout_right, memory_space>>, "RightExtrapolationRule::operator() has to be callable with usual arguments."); @@ -138,7 +138,7 @@ class SplineEvaluator template KOKKOS_FUNCTION double operator()( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { return eval(coord_eval, spline_coef); @@ -146,14 +146,18 @@ class SplineEvaluator template void operator()( - ddc::ChunkSpan const spline_eval, + ddc::ChunkSpan const + spline_eval, ddc::ChunkSpan< ddc::Coordinate const, - vals_domain_type, + batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan const - spline_coef) const + ddc::ChunkSpan< + double const, + batched_batched_spline_domain_type, + Layout3, + memory_space> const spline_coef) const { interpolation_domain_type const interpolation_domain(spline_eval.domain()); batch_domain_type const batch_domain(spline_eval.domain()); @@ -174,7 +178,7 @@ class SplineEvaluator template KOKKOS_FUNCTION double deriv( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { return eval_no_bc(coord_eval, spline_coef); @@ -182,14 +186,18 @@ class SplineEvaluator template void deriv( - ddc::ChunkSpan const spline_eval, + ddc::ChunkSpan const + spline_eval, ddc::ChunkSpan< ddc::Coordinate const, - vals_domain_type, + batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan const - spline_coef) const + ddc::ChunkSpan< + double const, + batched_batched_spline_domain_type, + Layout3, + memory_space> const spline_coef) const { interpolation_domain_type const interpolation_domain(spline_eval.domain()); batch_domain_type const batch_domain(spline_eval.domain()); @@ -211,8 +219,11 @@ class SplineEvaluator template void integrate( ddc::ChunkSpan const integrals, - ddc::ChunkSpan const - spline_coef) const + ddc::ChunkSpan< + double const, + batched_batched_spline_domain_type, + Layout2, + memory_space> const spline_coef) const { batch_domain_type const batch_domain(integrals.domain()); ddc::Chunk values_alloc( @@ -228,7 +239,7 @@ class SplineEvaluator batch_domain, KOKKOS_LAMBDA(typename batch_domain_type::discrete_element_type const j) { integrals(j) = 0; - for (typename bsplines_domain_type::discrete_element_type const i : + for (typename batched_spline_domain_type::discrete_element_type const i : values.domain()) { integrals(j) += spline_coef(i, j) * values(i); } @@ -239,7 +250,7 @@ class SplineEvaluator template KOKKOS_INLINE_FUNCTION double eval( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { ddc::Coordinate @@ -269,7 +280,7 @@ class SplineEvaluator template KOKKOS_INLINE_FUNCTION double eval_no_bc( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { static_assert( diff --git a/include/ddc/kernels/splines/spline_evaluator_2d.hpp b/include/ddc/kernels/splines/spline_evaluator_2d.hpp index 168ab7b08..30a3c3732 100644 --- a/include/ddc/kernels/splines/spline_evaluator_2d.hpp +++ b/include/ddc/kernels/splines/spline_evaluator_2d.hpp @@ -66,11 +66,11 @@ class SplineEvaluator2D using interpolation_domain_type = ddc::DiscreteDomain; - using vals_domain_type = ddc::DiscreteDomain; + using batched_interpolation_domain_type = ddc::DiscreteDomain; - using bsplines_domain_type1 = ddc::DiscreteDomain; - using bsplines_domain_type2 = ddc::DiscreteDomain; - using bsplines_domain_type = ddc::DiscreteDomain; + using batched_spline_domain_type1 = ddc::DiscreteDomain; + using batched_spline_domain_type2 = ddc::DiscreteDomain; + using batched_spline_domain_type = ddc::DiscreteDomain; using batch_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, bsplines_type2, Tag>>; - using spline_domain_type = + using batched_batched_spline_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, @@ -124,7 +124,7 @@ class SplineEvaluator2D ddc::Coordinate, ddc::ChunkSpan< double const, - bsplines_domain_type, + batched_spline_domain_type, std::experimental::layout_right, memory_space>>, "LeftExtrapolationRule1::operator() has to be callable " @@ -136,7 +136,7 @@ class SplineEvaluator2D ddc::Coordinate, ddc::ChunkSpan< double const, - bsplines_domain_type, + batched_spline_domain_type, std::experimental::layout_right, memory_space>>, "RightExtrapolationRule1::operator() has to be callable " @@ -148,7 +148,7 @@ class SplineEvaluator2D ddc::Coordinate, ddc::ChunkSpan< double const, - bsplines_domain_type, + batched_spline_domain_type, std::experimental::layout_right, memory_space>>, "LeftExtrapolationRule2::operator() has to be callable " @@ -160,7 +160,7 @@ class SplineEvaluator2D ddc::Coordinate, ddc::ChunkSpan< double const, - bsplines_domain_type, + batched_spline_domain_type, std::experimental::layout_right, memory_space>>, "RightExtrapolationRule2::operator() has to be callable " @@ -271,7 +271,7 @@ class SplineEvaluator2D template KOKKOS_FUNCTION double operator()( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { return eval(coord_eval, spline_coef); @@ -279,14 +279,18 @@ class SplineEvaluator2D template void operator()( - ddc::ChunkSpan const spline_eval, + ddc::ChunkSpan const + spline_eval, ddc::ChunkSpan< ddc::Coordinate const, - vals_domain_type, + batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan const - spline_coef) const + ddc::ChunkSpan< + double const, + batched_batched_spline_domain_type, + Layout3, + memory_space> const spline_coef) const { batch_domain_type batch_domain(coords_eval.domain()); interpolation_domain_type1 const interpolation_domain1(spline_eval.domain()); @@ -319,7 +323,7 @@ class SplineEvaluator2D template KOKKOS_FUNCTION double deriv_dim_1( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { return eval_no_bc(coord_eval, spline_coef); @@ -338,7 +342,7 @@ class SplineEvaluator2D template KOKKOS_FUNCTION double deriv_dim_2( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { return eval_no_bc(coord_eval, spline_coef); @@ -357,7 +361,7 @@ class SplineEvaluator2D template KOKKOS_FUNCTION double deriv_1_and_2( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { return eval_no_bc(coord_eval, spline_coef); @@ -366,7 +370,7 @@ class SplineEvaluator2D template KOKKOS_FUNCTION double deriv( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { static_assert( @@ -389,7 +393,7 @@ class SplineEvaluator2D template KOKKOS_FUNCTION double deriv2( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { static_assert( @@ -416,14 +420,18 @@ class SplineEvaluator2D */ template void deriv_dim_1( - ddc::ChunkSpan const spline_eval, + ddc::ChunkSpan const + spline_eval, ddc::ChunkSpan< ddc::Coordinate const, - vals_domain_type, + batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan const - spline_coef) const + ddc::ChunkSpan< + double const, + batched_batched_spline_domain_type, + Layout3, + memory_space> const spline_coef) const { batch_domain_type batch_domain(coords_eval.domain()); interpolation_domain_type1 const interpolation_domain1(spline_eval.domain()); @@ -457,14 +465,18 @@ class SplineEvaluator2D */ template void deriv_dim_2( - ddc::ChunkSpan const spline_eval, + ddc::ChunkSpan const + spline_eval, ddc::ChunkSpan< ddc::Coordinate const, - vals_domain_type, + batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan const - spline_coef) const + ddc::ChunkSpan< + double const, + batched_batched_spline_domain_type, + Layout3, + memory_space> const spline_coef) const { batch_domain_type batch_domain(coords_eval.domain()); interpolation_domain_type1 const interpolation_domain1(spline_eval.domain()); @@ -498,14 +510,18 @@ class SplineEvaluator2D */ template void deriv_1_and_2( - ddc::ChunkSpan const spline_eval, + ddc::ChunkSpan const + spline_eval, ddc::ChunkSpan< ddc::Coordinate const, - vals_domain_type, + batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan const - spline_coef) const + ddc::ChunkSpan< + double const, + batched_batched_spline_domain_type, + Layout3, + memory_space> const spline_coef) const { batch_domain_type batch_domain(coords_eval.domain()); interpolation_domain_type1 const interpolation_domain1(spline_eval.domain()); @@ -529,14 +545,18 @@ class SplineEvaluator2D template void deriv( - ddc::ChunkSpan const spline_eval, + ddc::ChunkSpan const + spline_eval, ddc::ChunkSpan< ddc::Coordinate const, - vals_domain_type, + batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan const - spline_coef) const + ddc::ChunkSpan< + double const, + batched_batched_spline_domain_type, + Layout3, + memory_space> const spline_coef) const { static_assert( std::is_same_v< @@ -563,14 +583,18 @@ class SplineEvaluator2D class Layout3, class... CoordsDims> void deriv2( - ddc::ChunkSpan const spline_eval, + ddc::ChunkSpan const + spline_eval, ddc::ChunkSpan< ddc::Coordinate const, - vals_domain_type, + batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan const - spline_coef) const + ddc::ChunkSpan< + double const, + batched_batched_spline_domain_type, + Layout3, + memory_space> const spline_coef) const { static_assert( (std::is_same_v< @@ -594,8 +618,11 @@ class SplineEvaluator2D template void integrate( ddc::ChunkSpan const integrals, - ddc::ChunkSpan const - spline_coef) const + ddc::ChunkSpan< + double const, + batched_batched_spline_domain_type, + Layout2, + memory_space> const spline_coef) const { batch_domain_type batch_domain(integrals.domain()); ddc::Chunk values1_alloc( @@ -618,9 +645,9 @@ class SplineEvaluator2D batch_domain, KOKKOS_LAMBDA(typename batch_domain_type::discrete_element_type const j) { integrals(j) = 0; - for (typename bsplines_domain_type1::discrete_element_type const i1 : + for (typename batched_spline_domain_type1::discrete_element_type const i1 : values1.domain()) { - for (typename bsplines_domain_type2::discrete_element_type const i2 : + for (typename batched_spline_domain_type2::discrete_element_type const i2 : values2.domain()) { integrals(j) += spline_coef(i1, i2, j) * values1(i1) * values2(i2); } @@ -651,7 +678,7 @@ class SplineEvaluator2D template KOKKOS_INLINE_FUNCTION double eval( ddc::Coordinate coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { using Dim1 = typename interpolation_mesh_type1::continuous_dimension_type; @@ -720,7 +747,7 @@ class SplineEvaluator2D template KOKKOS_INLINE_FUNCTION double eval_no_bc( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { static_assert( diff --git a/tests/splines/batched_2d_spline_builder.cpp b/tests/splines/batched_2d_spline_builder.cpp index 0f5de6cc8..17137e3b1 100644 --- a/tests/splines/batched_2d_spline_builder.cpp +++ b/tests/splines/batched_2d_spline_builder.cpp @@ -275,7 +275,7 @@ static void Batched2dSplineTest() // Compute usefull domains (dom_interpolation, dom_batch, dom_bsplines and dom_spline) ddc::DiscreteDomain, IDim> const dom_interpolation = spline_builder.interpolation_domain(); - auto const dom_spline = spline_builder.spline_domain(); + auto const dom_spline = spline_builder.batched_spline_domain(); // Allocate and fill a chunk containing values to be passed as input to spline_builder. Those are values of cosine along interest dimension duplicated along batch dimensions ddc::Chunk vals1_cpu_alloc( diff --git a/tests/splines/batched_spline_builder.cpp b/tests/splines/batched_spline_builder.cpp index 8eeb433b3..4070e263a 100644 --- a/tests/splines/batched_spline_builder.cpp +++ b/tests/splines/batched_spline_builder.cpp @@ -224,7 +224,7 @@ static void BatchedSplineTest() // Compute usefull domains (dom_interpolation, dom_batch, dom_bsplines and dom_spline) ddc::DiscreteDomain> const dom_interpolation = spline_builder.interpolation_domain(); auto const dom_batch = spline_builder.batch_domain(); - auto const dom_spline = spline_builder.spline_domain(); + auto const dom_spline = spline_builder.batched_spline_domain(); // Allocate and fill a chunk containing values to be passed as input to spline_builder. Those are values of cosine along interest dimension duplicated along batch dimensions ddc::Chunk vals1_cpu_alloc( diff --git a/tests/splines/extrapolation_rule.cpp b/tests/splines/extrapolation_rule.cpp index 864b51f76..fae128159 100644 --- a/tests/splines/extrapolation_rule.cpp +++ b/tests/splines/extrapolation_rule.cpp @@ -234,7 +234,7 @@ static void ExtrapolationRuleSplineTest() // Compute usefull domains (dom_interpolation, dom_batch, dom_bsplines and dom_spline) ddc::DiscreteDomain, IDim> const dom_interpolation = spline_builder.interpolation_domain(); - auto const dom_spline = spline_builder.spline_domain(); + auto const dom_spline = spline_builder.batched_spline_domain(); // Allocate and fill a chunk containing values to be passed as input to spline_builder. Those are values of cosine along interest dimension duplicated along batch dimensions ddc::Chunk vals1_cpu_alloc( diff --git a/tests/splines/periodicity_spline_builder.cpp b/tests/splines/periodicity_spline_builder.cpp index bed04565c..18c7b2b7c 100644 --- a/tests/splines/periodicity_spline_builder.cpp +++ b/tests/splines/periodicity_spline_builder.cpp @@ -139,7 +139,7 @@ static void PeriodicitySplineBuilderTest() spline_builder(dom_vals); // Compute usefull domains (dom_interpolation, dom_batch, dom_bsplines and dom_spline) - ddc::DiscreteDomain> const dom_bsplines = spline_builder.bsplines_domain(); + ddc::DiscreteDomain> const dom_bsplines = spline_builder.spline_domain(); // Allocate and fill a chunk containing values to be passed as input to spline_builder. Those are values of cosine along interest dimension duplicated along batch dimensions ddc::Chunk vals1_cpu_alloc( From 84a5ca710fc2cf863c247a66746ae4882b5d0bdd Mon Sep 17 00:00:00 2001 From: blegouix Date: Wed, 3 Apr 2024 10:36:52 +0200 Subject: [PATCH 02/89] missing sed in benchmark --- benchmarks/splines.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmarks/splines.cpp b/benchmarks/splines.cpp index f9f5b8cab..750c7425b 100644 --- a/benchmarks/splines.cpp +++ b/benchmarks/splines.cpp @@ -127,11 +127,11 @@ static void characteristics_advection(benchmark::State& state) DDimY> spline_evaluator(periodic_extrapolation, periodic_extrapolation); ddc::Chunk coef_alloc( - spline_builder.spline_domain(), + spline_builder.batched_spline_domain(), ddc::KokkosAllocator()); ddc::ChunkSpan coef = coef_alloc.span_view(); ddc::Chunk feet_coords_alloc( - spline_builder.vals_domain(), + spline_builder.batched_interpolation_domain(), ddc::KokkosAllocator< ddc::Coordinate, Kokkos::DefaultExecutionSpace::memory_space>()); From 96d4fdb7e7e8082b9c5ad4d7954a5394c558e864 Mon Sep 17 00:00:00 2001 From: blegouix Date: Mon, 15 Apr 2024 17:41:53 +0200 Subject: [PATCH 03/89] fix --- .../ddc/kernels/splines/spline_builder.hpp | 8 +-- .../ddc/kernels/splines/spline_builder_2d.hpp | 8 +-- .../ddc/kernels/splines/spline_evaluator.hpp | 24 ++++----- .../kernels/splines/spline_evaluator_2d.hpp | 50 +++++++++---------- 4 files changed, 45 insertions(+), 45 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index 0d841d492..72dcdda78 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -89,7 +89,7 @@ class SplineBuilder using spline_dim_type = std::conditional_t, bsplines_type, Tag>; - using batched_batched_spline_domain_type = + using batched_spline_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, @@ -248,7 +248,7 @@ class SplineBuilder * * @return The domain for the splines. */ - batched_batched_spline_domain_type batched_spline_domain() const noexcept + batched_spline_domain_type batched_spline_domain() const noexcept { return ddc::replace_dim_of< interpolation_mesh_type, @@ -309,7 +309,7 @@ class SplineBuilder */ template void operator()( - ddc::ChunkSpan spline, + ddc::ChunkSpan spline, ddc::ChunkSpan vals, std::optional:: operator()( - ddc::ChunkSpan spline, + ddc::ChunkSpan spline, ddc::ChunkSpan vals, std::optional, ddc::detail::TypeSeq>>; - using batched_batched_spline_domain_type + using batched_spline_domain_type = ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, @@ -244,7 +244,7 @@ class SplineBuilder2D ddc::discrete_space().full_domain()); } - batched_batched_spline_domain_type batched_spline_domain() const noexcept + batched_spline_domain_type batched_spline_domain() const noexcept { return ddc::replace_dim_of( ddc::replace_dim_of< @@ -291,7 +291,7 @@ class SplineBuilder2D */ template void operator()( - ddc::ChunkSpan spline, + ddc::ChunkSpan spline, ddc::ChunkSpan vals, std::optional:: operator()( - ddc::ChunkSpan spline, + ddc::ChunkSpan spline, ddc::ChunkSpan vals, std::optional; - using batched_spline_domain_type = ddc::DiscreteDomain; + using spline_domain_type = ddc::DiscreteDomain; using batch_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, bsplines_type, Tag>; - using batched_batched_spline_domain_type = + using batched_spline_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, @@ -91,7 +91,7 @@ class SplineEvaluator ddc::Coordinate, ddc::ChunkSpan< double const, - batched_spline_domain_type, + spline_domain_type, std::experimental::layout_right, memory_space>>, "LeftExtrapolationRule::operator() has to be callable with usual arguments."); @@ -102,7 +102,7 @@ class SplineEvaluator ddc::Coordinate, ddc::ChunkSpan< double const, - batched_spline_domain_type, + spline_domain_type, std::experimental::layout_right, memory_space>>, "RightExtrapolationRule::operator() has to be callable with usual arguments."); @@ -138,7 +138,7 @@ class SplineEvaluator template KOKKOS_FUNCTION double operator()( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { return eval(coord_eval, spline_coef); @@ -155,7 +155,7 @@ class SplineEvaluator memory_space> const coords_eval, ddc::ChunkSpan< double const, - batched_batched_spline_domain_type, + batched_spline_domain_type, Layout3, memory_space> const spline_coef) const { @@ -178,7 +178,7 @@ class SplineEvaluator template KOKKOS_FUNCTION double deriv( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { return eval_no_bc(coord_eval, spline_coef); @@ -195,7 +195,7 @@ class SplineEvaluator memory_space> const coords_eval, ddc::ChunkSpan< double const, - batched_batched_spline_domain_type, + batched_spline_domain_type, Layout3, memory_space> const spline_coef) const { @@ -221,7 +221,7 @@ class SplineEvaluator ddc::ChunkSpan const integrals, ddc::ChunkSpan< double const, - batched_batched_spline_domain_type, + batched_spline_domain_type, Layout2, memory_space> const spline_coef) const { @@ -239,7 +239,7 @@ class SplineEvaluator batch_domain, KOKKOS_LAMBDA(typename batch_domain_type::discrete_element_type const j) { integrals(j) = 0; - for (typename batched_spline_domain_type::discrete_element_type const i : + for (typename spline_domain_type::discrete_element_type const i : values.domain()) { integrals(j) += spline_coef(i, j) * values(i); } @@ -250,7 +250,7 @@ class SplineEvaluator template KOKKOS_INLINE_FUNCTION double eval( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { ddc::Coordinate @@ -280,7 +280,7 @@ class SplineEvaluator template KOKKOS_INLINE_FUNCTION double eval_no_bc( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { static_assert( diff --git a/include/ddc/kernels/splines/spline_evaluator_2d.hpp b/include/ddc/kernels/splines/spline_evaluator_2d.hpp index 30a3c3732..69457e190 100644 --- a/include/ddc/kernels/splines/spline_evaluator_2d.hpp +++ b/include/ddc/kernels/splines/spline_evaluator_2d.hpp @@ -68,9 +68,9 @@ class SplineEvaluator2D using batched_interpolation_domain_type = ddc::DiscreteDomain; - using batched_spline_domain_type1 = ddc::DiscreteDomain; - using batched_spline_domain_type2 = ddc::DiscreteDomain; - using batched_spline_domain_type = ddc::DiscreteDomain; + using spline_domain_type1 = ddc::DiscreteDomain; + using spline_domain_type2 = ddc::DiscreteDomain; + using spline_domain_type = ddc::DiscreteDomain; using batch_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, bsplines_type2, Tag>>; - using batched_batched_spline_domain_type = + using batched_spline_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, @@ -124,7 +124,7 @@ class SplineEvaluator2D ddc::Coordinate, ddc::ChunkSpan< double const, - batched_spline_domain_type, + spline_domain_type, std::experimental::layout_right, memory_space>>, "LeftExtrapolationRule1::operator() has to be callable " @@ -136,7 +136,7 @@ class SplineEvaluator2D ddc::Coordinate, ddc::ChunkSpan< double const, - batched_spline_domain_type, + spline_domain_type, std::experimental::layout_right, memory_space>>, "RightExtrapolationRule1::operator() has to be callable " @@ -148,7 +148,7 @@ class SplineEvaluator2D ddc::Coordinate, ddc::ChunkSpan< double const, - batched_spline_domain_type, + spline_domain_type, std::experimental::layout_right, memory_space>>, "LeftExtrapolationRule2::operator() has to be callable " @@ -160,7 +160,7 @@ class SplineEvaluator2D ddc::Coordinate, ddc::ChunkSpan< double const, - batched_spline_domain_type, + spline_domain_type, std::experimental::layout_right, memory_space>>, "RightExtrapolationRule2::operator() has to be callable " @@ -271,7 +271,7 @@ class SplineEvaluator2D template KOKKOS_FUNCTION double operator()( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { return eval(coord_eval, spline_coef); @@ -288,7 +288,7 @@ class SplineEvaluator2D memory_space> const coords_eval, ddc::ChunkSpan< double const, - batched_batched_spline_domain_type, + batched_spline_domain_type, Layout3, memory_space> const spline_coef) const { @@ -323,7 +323,7 @@ class SplineEvaluator2D template KOKKOS_FUNCTION double deriv_dim_1( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { return eval_no_bc(coord_eval, spline_coef); @@ -342,7 +342,7 @@ class SplineEvaluator2D template KOKKOS_FUNCTION double deriv_dim_2( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { return eval_no_bc(coord_eval, spline_coef); @@ -361,7 +361,7 @@ class SplineEvaluator2D template KOKKOS_FUNCTION double deriv_1_and_2( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { return eval_no_bc(coord_eval, spline_coef); @@ -370,7 +370,7 @@ class SplineEvaluator2D template KOKKOS_FUNCTION double deriv( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { static_assert( @@ -393,7 +393,7 @@ class SplineEvaluator2D template KOKKOS_FUNCTION double deriv2( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { static_assert( @@ -429,7 +429,7 @@ class SplineEvaluator2D memory_space> const coords_eval, ddc::ChunkSpan< double const, - batched_batched_spline_domain_type, + batched_spline_domain_type, Layout3, memory_space> const spline_coef) const { @@ -474,7 +474,7 @@ class SplineEvaluator2D memory_space> const coords_eval, ddc::ChunkSpan< double const, - batched_batched_spline_domain_type, + batched_spline_domain_type, Layout3, memory_space> const spline_coef) const { @@ -519,7 +519,7 @@ class SplineEvaluator2D memory_space> const coords_eval, ddc::ChunkSpan< double const, - batched_batched_spline_domain_type, + batched_spline_domain_type, Layout3, memory_space> const spline_coef) const { @@ -554,7 +554,7 @@ class SplineEvaluator2D memory_space> const coords_eval, ddc::ChunkSpan< double const, - batched_batched_spline_domain_type, + batched_spline_domain_type, Layout3, memory_space> const spline_coef) const { @@ -592,7 +592,7 @@ class SplineEvaluator2D memory_space> const coords_eval, ddc::ChunkSpan< double const, - batched_batched_spline_domain_type, + batched_spline_domain_type, Layout3, memory_space> const spline_coef) const { @@ -620,7 +620,7 @@ class SplineEvaluator2D ddc::ChunkSpan const integrals, ddc::ChunkSpan< double const, - batched_batched_spline_domain_type, + batched_spline_domain_type, Layout2, memory_space> const spline_coef) const { @@ -645,9 +645,9 @@ class SplineEvaluator2D batch_domain, KOKKOS_LAMBDA(typename batch_domain_type::discrete_element_type const j) { integrals(j) = 0; - for (typename batched_spline_domain_type1::discrete_element_type const i1 : + for (typename spline_domain_type1::discrete_element_type const i1 : values1.domain()) { - for (typename batched_spline_domain_type2::discrete_element_type const i2 : + for (typename spline_domain_type2::discrete_element_type const i2 : values2.domain()) { integrals(j) += spline_coef(i1, i2, j) * values1(i1) * values2(i2); } @@ -678,7 +678,7 @@ class SplineEvaluator2D template KOKKOS_INLINE_FUNCTION double eval( ddc::Coordinate coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { using Dim1 = typename interpolation_mesh_type1::continuous_dimension_type; @@ -747,7 +747,7 @@ class SplineEvaluator2D template KOKKOS_INLINE_FUNCTION double eval_no_bc( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { static_assert( From 077807aa9b00ecf1f57c8fcdb38a1c713acab599 Mon Sep 17 00:00:00 2001 From: Baptiste Legouix Date: Mon, 15 Apr 2024 17:44:09 +0200 Subject: [PATCH 04/89] Update include/ddc/kernels/splines/spline_builder.hpp --- include/ddc/kernels/splines/spline_builder.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index 72dcdda78..d5cdc6593 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -235,7 +235,7 @@ class SplineBuilder return ddc::remove_dims_of(batched_interpolation_domain(), interpolation_domain()); } - ddc::DiscreteDomain spline_domain() const noexcept // TODO : clarify name + ddc::DiscreteDomain spline_domain() const noexcept { return ddc::discrete_space().full_domain(); } From 653bab4d9e7e81a8f2e05eef18d7b10e8c78a6e9 Mon Sep 17 00:00:00 2001 From: blegouix Date: Mon, 15 Apr 2024 17:49:47 +0200 Subject: [PATCH 05/89] clang-format --- .../ddc/kernels/splines/spline_evaluator.hpp | 21 +++----- .../kernels/splines/spline_evaluator_2d.hpp | 49 ++++++------------- vendor/kokkos | 2 +- 3 files changed, 21 insertions(+), 51 deletions(-) diff --git a/include/ddc/kernels/splines/spline_evaluator.hpp b/include/ddc/kernels/splines/spline_evaluator.hpp index 8c56accee..70c578583 100644 --- a/include/ddc/kernels/splines/spline_evaluator.hpp +++ b/include/ddc/kernels/splines/spline_evaluator.hpp @@ -153,11 +153,8 @@ class SplineEvaluator batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan< - double const, - batched_spline_domain_type, - Layout3, - memory_space> const spline_coef) const + ddc::ChunkSpan const + spline_coef) const { interpolation_domain_type const interpolation_domain(spline_eval.domain()); batch_domain_type const batch_domain(spline_eval.domain()); @@ -193,11 +190,8 @@ class SplineEvaluator batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan< - double const, - batched_spline_domain_type, - Layout3, - memory_space> const spline_coef) const + ddc::ChunkSpan const + spline_coef) const { interpolation_domain_type const interpolation_domain(spline_eval.domain()); batch_domain_type const batch_domain(spline_eval.domain()); @@ -219,11 +213,8 @@ class SplineEvaluator template void integrate( ddc::ChunkSpan const integrals, - ddc::ChunkSpan< - double const, - batched_spline_domain_type, - Layout2, - memory_space> const spline_coef) const + ddc::ChunkSpan const + spline_coef) const { batch_domain_type const batch_domain(integrals.domain()); ddc::Chunk values_alloc( diff --git a/include/ddc/kernels/splines/spline_evaluator_2d.hpp b/include/ddc/kernels/splines/spline_evaluator_2d.hpp index 69457e190..a8aac5c35 100644 --- a/include/ddc/kernels/splines/spline_evaluator_2d.hpp +++ b/include/ddc/kernels/splines/spline_evaluator_2d.hpp @@ -286,11 +286,8 @@ class SplineEvaluator2D batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan< - double const, - batched_spline_domain_type, - Layout3, - memory_space> const spline_coef) const + ddc::ChunkSpan const + spline_coef) const { batch_domain_type batch_domain(coords_eval.domain()); interpolation_domain_type1 const interpolation_domain1(spline_eval.domain()); @@ -427,11 +424,8 @@ class SplineEvaluator2D batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan< - double const, - batched_spline_domain_type, - Layout3, - memory_space> const spline_coef) const + ddc::ChunkSpan const + spline_coef) const { batch_domain_type batch_domain(coords_eval.domain()); interpolation_domain_type1 const interpolation_domain1(spline_eval.domain()); @@ -472,11 +466,8 @@ class SplineEvaluator2D batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan< - double const, - batched_spline_domain_type, - Layout3, - memory_space> const spline_coef) const + ddc::ChunkSpan const + spline_coef) const { batch_domain_type batch_domain(coords_eval.domain()); interpolation_domain_type1 const interpolation_domain1(spline_eval.domain()); @@ -517,11 +508,8 @@ class SplineEvaluator2D batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan< - double const, - batched_spline_domain_type, - Layout3, - memory_space> const spline_coef) const + ddc::ChunkSpan const + spline_coef) const { batch_domain_type batch_domain(coords_eval.domain()); interpolation_domain_type1 const interpolation_domain1(spline_eval.domain()); @@ -552,11 +540,8 @@ class SplineEvaluator2D batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan< - double const, - batched_spline_domain_type, - Layout3, - memory_space> const spline_coef) const + ddc::ChunkSpan const + spline_coef) const { static_assert( std::is_same_v< @@ -590,11 +575,8 @@ class SplineEvaluator2D batched_interpolation_domain_type, Layout2, memory_space> const coords_eval, - ddc::ChunkSpan< - double const, - batched_spline_domain_type, - Layout3, - memory_space> const spline_coef) const + ddc::ChunkSpan const + spline_coef) const { static_assert( (std::is_same_v< @@ -618,11 +600,8 @@ class SplineEvaluator2D template void integrate( ddc::ChunkSpan const integrals, - ddc::ChunkSpan< - double const, - batched_spline_domain_type, - Layout2, - memory_space> const spline_coef) const + ddc::ChunkSpan const + spline_coef) const { batch_domain_type batch_domain(integrals.domain()); ddc::Chunk values1_alloc( diff --git a/vendor/kokkos b/vendor/kokkos index 486cc745c..71a9bcae5 160000 --- a/vendor/kokkos +++ b/vendor/kokkos @@ -1 +1 @@ -Subproject commit 486cc745cb9a287f3915061455105a3ee588c616 +Subproject commit 71a9bcae52543bd065522bf3e41b5bfa467d8015 From 889b9f94f366433ac12bf73fcdaa90ea3bbb1905 Mon Sep 17 00:00:00 2001 From: blegouix Date: Tue, 16 Apr 2024 09:24:32 +0200 Subject: [PATCH 06/89] fix kokkos version change --- vendor/kokkos | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/kokkos b/vendor/kokkos index 71a9bcae5..486cc745c 160000 --- a/vendor/kokkos +++ b/vendor/kokkos @@ -1 +1 @@ -Subproject commit 71a9bcae52543bd065522bf3e41b5bfa467d8015 +Subproject commit 486cc745cb9a287f3915061455105a3ee588c616 From 6238ca3aa423359aedc9353617053dee7b1916c0 Mon Sep 17 00:00:00 2001 From: blegouix Date: Tue, 16 Apr 2024 15:40:24 +0200 Subject: [PATCH 07/89] wip --- .../ddc/kernels/splines/bsplines_uniform.hpp | 6 +++ .../splines/greville_interpolation_points.hpp | 2 +- .../splines/null_extrapolation_rule.hpp | 3 ++ .../ddc/kernels/splines/spline_builder.hpp | 48 +++++++++++++++++-- .../ddc/kernels/splines/spline_builder_2d.hpp | 7 +++ 5 files changed, 62 insertions(+), 4 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index 2a0b7d1c7..c9b2f1863 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -24,6 +24,12 @@ struct UniformBSplinesBase { }; +/** + * The type of a uniform BSplines 1D basis. + * + * @tparam Tag The tag identifying the continuous dimension which supports the building of the BSplines. + * @tparam D The degree of the BSplines. + */ template class UniformBSplines : UniformBSplinesBase { diff --git a/include/ddc/kernels/splines/greville_interpolation_points.hpp b/include/ddc/kernels/splines/greville_interpolation_points.hpp index 71443c6b9..93afe9580 100644 --- a/include/ddc/kernels/splines/greville_interpolation_points.hpp +++ b/include/ddc/kernels/splines/greville_interpolation_points.hpp @@ -15,7 +15,7 @@ namespace ddc { /** - * A class which provides helper functions to initialise the Greville points from a B-Spline definition. + * A class which provides helper functions to initialize the Greville points from a B-Spline definition. * * @tparam BSplines The bspline class relative to which the Greville points will be calculated. * @tparam BcXmin The (left) boundary condition that will be used to build the splines. diff --git a/include/ddc/kernels/splines/null_extrapolation_rule.hpp b/include/ddc/kernels/splines/null_extrapolation_rule.hpp index a81930da6..b79fd5850 100644 --- a/include/ddc/kernels/splines/null_extrapolation_rule.hpp +++ b/include/ddc/kernels/splines/null_extrapolation_rule.hpp @@ -6,6 +6,9 @@ namespace ddc { +/** + * @brief A functor for describing a spline boundary value by a null extrapolation for 1D evaluator. + */ struct NullExtrapolationRule { template diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index d5cdc6593..e956ad99d 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -10,10 +10,26 @@ #include "deriv.hpp" namespace ddc { + +/** + * @brief An enum determining the backend solver of a SplineBuilder or SplineBuilder2d. + * + * An enum determining the backend solver of a SplineBuilder or SplineBuilder2d. Only GINKGO available at the moment, + * other solvers will be implemented in the futur. + */ enum class SplineSolver { GINKGO -}; // Only GINKGO available atm, other solvers will be implemented in the futur +}; +/** + * @brief An helper giving the uniform/non_uniform status of a spline interpolation mesh according to its attributes. + * + * An helper giving the uniform/non_uniform status of a spline interpolation mesh according to its attributes. + * @param is_uniform A boolean giving the presumed status before considering boundary conditions. + * @param BcXmin The Xmin boundary condition. + * @param BcXmax The Xmax boundary condition. + * @param int The degree of the spline. + */ constexpr bool is_spline_interpolation_mesh_uniform( bool const is_uniform, ddc::BoundCond const BcXmin, @@ -34,6 +50,14 @@ constexpr bool is_spline_interpolation_mesh_uniform( * 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. + * @tparam ExecSpace The Kokkos execution space on which the spline transform is performed. + * @tparam MemorySpace The Kokkos memory space on which the data (interpolation function and splines coefficients) are stored. + * @tparam BSplines The BSplines dimension. + * @tparam InterpolationMesh The discrete dimension supporting the interpolation points. + * @tparam BcXmin The Xmin boundary condition. + * @tparam BcXmax The Xmax boundary condition. + * @tparam Solver The SplineSolver giving the backend used to perform the spline transform. + * @tparam IDimX A variadic template of all the discrete dimensions forming the full space (InterpolationMesh + batched dimensions). */ template < class ExecSpace, @@ -57,20 +81,29 @@ class SplineBuilder using tag_type = typename InterpolationMesh::continuous_dimension_type; public: + /** + * @brief The type of the Kokkos execution space used by this class. + */ using exec_space = ExecSpace; + /** + * @brief The type of the Kokkos memory space used by this class. + */ using memory_space = MemorySpace; /** - * @brief The type of the interpolation mesh used by this class. + * @brief The type of the interpolation mesh (discrete dimension of interest) used by this class. */ using interpolation_mesh_type = InterpolationMesh; /** - * @brief The type of the BSplines which are compatible with this class. + * @brief The BSplines dimension. */ using bsplines_type = BSplines; + /** + * @brief The deriv dimension at the boundaries. + */ using deriv_type = ddc::Deriv; /** @@ -78,13 +111,22 @@ class SplineBuilder */ using interpolation_domain_type = ddc::DiscreteDomain; + /** + * @brief The type of the whole domain representing interpolation points. + */ using batched_interpolation_domain_type = ddc::DiscreteDomain; + /** + * @brief The type of the batch domain (obtained by removing dimension of interest from whole space). + */ using batch_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq>>; + /** + * @brief The dimension WIP. + */ template using spline_dim_type = std::conditional_t, bsplines_type, Tag>; diff --git a/include/ddc/kernels/splines/spline_builder_2d.hpp b/include/ddc/kernels/splines/spline_builder_2d.hpp index eebaf1f98..1d0d2d767 100644 --- a/include/ddc/kernels/splines/spline_builder_2d.hpp +++ b/include/ddc/kernels/splines/spline_builder_2d.hpp @@ -87,7 +87,14 @@ class SplineBuilder2D */ using bsplines_type2 = typename builder_type2::bsplines_type; + /** + * @brief The type of the derivatives on boundaries in the first dimension which are compatible with this class. + */ using deriv_type1 = typename builder_type1::deriv_type; + + /** + * @brief The type of the derivatives on boundaries in the second dimension which are compatible with this class. + */ using deriv_type2 = typename builder_type2::deriv_type; /** From 6ab4a97a4908a03909a5a1b42a58d6608d885ab8 Mon Sep 17 00:00:00 2001 From: blegouix Date: Tue, 16 Apr 2024 16:13:50 +0200 Subject: [PATCH 08/89] improve consistency --- include/ddc/kernels/splines/spline_builder.hpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index 69717fb52..acb6a5a81 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -255,12 +255,12 @@ class SplineBuilder bsplines_type>(batched_interpolation_domain(), spline_domain()); } - batched_spline_tr_domain_type spline_tr_domain() const noexcept + batched_spline_tr_domain_type batched_spline_tr_domain() const noexcept { return batched_spline_tr_domain_type(spline_domain(), batch_domain()); } - batched_derivs_domain_type derivs_xmin_domain() const noexcept + batched_derivs_domain_type batched_derivs_xmin_domain() const noexcept { return ddc::replace_dim_of( batched_interpolation_domain(), @@ -269,7 +269,7 @@ class SplineBuilder ddc::DiscreteVector(s_nbc_xmin))); } - batched_derivs_domain_type derivs_xmax_domain() const noexcept + batched_derivs_domain_type batched_derivs_xmax_domain() const noexcept { return ddc::replace_dim_of( batched_interpolation_domain(), @@ -729,7 +729,9 @@ operator()( // TODO : Consider optimizing // Allocate and fill a transposed version of spline in order to get dimension of interest as last dimension (optimal for GPU, necessary for Ginkgo) - ddc::Chunk spline_tr_alloc(spline_tr_domain(), ddc::KokkosAllocator()); + ddc::Chunk spline_tr_alloc( + batched_spline_tr_domain(), + ddc::KokkosAllocator()); ddc::ChunkSpan spline_tr = spline_tr_alloc.span_view(); ddc::parallel_for_each( exec_space(), From 66ea1642953585804f2cab9eeb723a2c3ba3967f Mon Sep 17 00:00:00 2001 From: blegouix Date: Wed, 17 Apr 2024 11:41:02 +0200 Subject: [PATCH 09/89] wip --- include/ddc/kernels/splines/spline_builder.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index e956ad99d..3b7b5c941 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -52,7 +52,7 @@ constexpr bool is_spline_interpolation_mesh_uniform( * associated with interpolation_mesh_type. * @tparam ExecSpace The Kokkos execution space on which the spline transform is performed. * @tparam MemorySpace The Kokkos memory space on which the data (interpolation function and splines coefficients) are stored. - * @tparam BSplines The BSplines dimension. + * @tparam BSplines The discrete dimension representing the BSplines. * @tparam InterpolationMesh The discrete dimension supporting the interpolation points. * @tparam BcXmin The Xmin boundary condition. * @tparam BcXmax The Xmax boundary condition. @@ -97,7 +97,7 @@ class SplineBuilder using interpolation_mesh_type = InterpolationMesh; /** - * @brief The BSplines dimension. + * @brief The discrete dimension representing the BSplines. */ using bsplines_type = BSplines; From 2fdb975d257cbc5a0c0e3bfde62463d816d17e0b Mon Sep 17 00:00:00 2001 From: blegouix Date: Wed, 17 Apr 2024 12:16:54 +0200 Subject: [PATCH 10/89] wip --- .../ddc/kernels/splines/spline_builder.hpp | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index 3b7b5c941..3bca54c9c 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -26,8 +26,8 @@ enum class SplineSolver { * * An helper giving the uniform/non_uniform status of a spline interpolation mesh according to its attributes. * @param is_uniform A boolean giving the presumed status before considering boundary conditions. - * @param BcXmin The Xmin boundary condition. - * @param BcXmax The Xmax boundary condition. + * @param BcXmin The lower boundary condition. + * @param BcXmax The upper boundary condition. * @param int The degree of the spline. */ constexpr bool is_spline_interpolation_mesh_uniform( @@ -54,8 +54,8 @@ constexpr bool is_spline_interpolation_mesh_uniform( * @tparam MemorySpace The Kokkos memory space on which the data (interpolation function and splines coefficients) are stored. * @tparam BSplines The discrete dimension representing the BSplines. * @tparam InterpolationMesh The discrete dimension supporting the interpolation points. - * @tparam BcXmin The Xmin boundary condition. - * @tparam BcXmax The Xmax boundary condition. + * @tparam BcXmin The lower boundary condition. + * @tparam BcXmax The upper boundary condition. * @tparam Solver The SplineSolver giving the backend used to perform the spline transform. * @tparam IDimX A variadic template of all the discrete dimensions forming the full space (InterpolationMesh + batched dimensions). */ @@ -125,18 +125,24 @@ class SplineBuilder ddc::detail::TypeSeq>>; /** - * @brief The dimension WIP. + * @brief Helper to get the dimension of batched_spline_domain_type associated to a dimension of batched_interpolation_domain_type. */ template using spline_dim_type = std::conditional_t, bsplines_type, Tag>; + /** + * @brief The type of the whole spline domain (cartesian product of 1D spline domain and batch domain) preserving the underlying memory layout (order of dimensions). + */ using batched_spline_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, ddc::detail::TypeSeq>>; + /** + * @brief The type of the whole spline domain (cartesian product of 1D spline domain and batch domain) with 1D spline domain being contiguous . + */ using batched_spline_tr_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, @@ -144,6 +150,9 @@ class SplineBuilder ddc::detail::TypeSeq, ddc::detail::TypeSeq>>>; + /** + * @brief The type of the whole derivs domain (cartesian product of 1D deriv domain and batch domain) preserving the underlying memory layout (order of dimensions). + */ using batched_derivs_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, @@ -156,12 +165,12 @@ class SplineBuilder static constexpr bool s_odd = BSplines::degree() % 2; /** - * @brief The number of equations which define the boundary conditions at the lower bound. + * @brief The number of equations defining the boundary conditions at the lower bound. */ static constexpr int s_nbe_xmin = n_boundary_equations(BcXmin, BSplines::degree()); /** - * @brief The number of equations which define the boundary conditions at the upper bound. + * @brief The number of equations defining the boundary conditions at the upper bound. */ static constexpr int s_nbe_xmax = n_boundary_equations(BcXmax, BSplines::degree()); From 93ec4a0db9a0e7a994e97f6dbe34c41e07d991cc Mon Sep 17 00:00:00 2001 From: blegouix Date: Wed, 17 Apr 2024 15:21:20 +0200 Subject: [PATCH 11/89] spline_builder --- .../ddc/kernels/splines/spline_builder.hpp | 84 +++++++++++++++---- 1 file changed, 70 insertions(+), 14 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index 3bca54c9c..dc692d327 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -107,7 +107,7 @@ class SplineBuilder using deriv_type = ddc::Deriv; /** - * @brief The type of the domain for the interpolation mesh used by this class. + * @brief The type of the domain for the 1D interpolation mesh used by this class. */ using interpolation_domain_type = ddc::DiscreteDomain; @@ -213,8 +213,17 @@ class SplineBuilder std::unique_ptr matrix; public: + /** + * @brief An helper to compute the offset. + */ int compute_offset(interpolation_domain_type const& interpolation_domain); + /** + * @brief Build a SplineBuilder acting on batched_interpolation_domain. + * + * @param batched_interpolation_domain The domain on which are defined the interpolation points. + * @param cols_per_chunk An hyperparameter used by the slicer (internal to the solver) to define the size of a chunk of right-and-sides of the linear problem to be computed in parallel. + */ explicit SplineBuilder( batched_interpolation_domain_type const& batched_interpolation_domain, std::optional cols_per_chunk = std::nullopt, @@ -261,43 +270,63 @@ class SplineBuilder * @param x The SplineBuilder being copied. * @returns A reference to this object. */ - SplineBuilder& operator=(SplineBuilder&& x) = default; + SplineBuilder& operator=(SplineBuilder&& x) = default; - batched_interpolation_domain_type batched_interpolation_domain() const noexcept + /** + * @brief Get the domain for the 1D interpolation mesh used by this class. + * + * Get the 1D interpolation domain associated to dimension of interest. + * + * @return The 1D domain for the grid points. + */ + interpolation_domain_type interpolation_domain() const noexcept { - return m_batched_interpolation_domain; + return interpolation_domain_type(m_batched_interpolation_domain); } /** - * @brief Get the domain from which the approximation is defined. + * @brief Get the whole domain representing interpolation points. * * Get the domain on which values of the function must be provided in order - * to build a spline approximation of the function. + * to build a spline transform of the function. * * @return The domain for the grid points. */ - interpolation_domain_type interpolation_domain() const noexcept + batched_interpolation_domain_type batched_interpolation_domain() const noexcept { - return interpolation_domain_type(batched_interpolation_domain()); + return m_batched_interpolation_domain; } + /** + * @brief Get the batch domain. + * + * Get the batch domain (obtained by removing dimension of interest from whole interpolation domain). + * + * @return The batch domain. + */ batch_domain_type batch_domain() const noexcept { return ddc::remove_dims_of(batched_interpolation_domain(), interpolation_domain()); } + /** + * @brief Get the 1D domain on which spline coefficients are defined. + * + * Get the 1D spline domain corresponding to dimension of interest. + * + * @return The 1D domain for the spline coefficients. + */ ddc::DiscreteDomain spline_domain() const noexcept { return ddc::discrete_space().full_domain(); } /** - * @brief Get the domain on which the approximation is defined. + * @brief Get the whole domain on which spline coefficients are defined, preserving memory layout. * - * Get the domain of the basis-splines for which the coefficients of the spline - * approximation must be calculated. + * Get the whole domain on which spline coefficients will be computed, preserving memory layout (order of dimensions). * - * @return The domain for the splines. + * @return The domain for the spline coefficients. */ batched_spline_domain_type batched_spline_domain() const noexcept { @@ -306,11 +335,25 @@ class SplineBuilder bsplines_type>(batched_interpolation_domain(), spline_domain()); } + /** + * @brief Get the whole domain on which spline coefficients are defined, with dimension of interest contiguous. + * + * Get the (transposed) whole domain on which spline coefficients will be computed, with dimension of interest contiguous. + * + * @return The (transposed) domain for the spline coefficients. + */ batched_spline_tr_domain_type spline_tr_domain() const noexcept { return batched_spline_tr_domain_type(spline_domain(), batch_domain()); } + /** + * @brief Get the whole domain on which derivatives on lower boundary are defined. + * + * Get the whole domain on which derivatives on lower boundary are defined. This is used only with HERMITE boundary conditions. + * + * @return The domain for the derivs values. + */ batched_derivs_domain_type derivs_xmin_domain() const noexcept { return ddc::replace_dim_of( @@ -320,6 +363,13 @@ class SplineBuilder ddc::DiscreteVector(s_nbc_xmin))); } + /** + * @brief Get the whole domain on which derivatives on upper boundary are defined. + * + * Get the whole domain on which derivatives on upper boundary are defined. This is used only with HERMITE boundary conditions. + * + * @return The domain for the derivs values. + */ batched_derivs_domain_type derivs_xmax_domain() const noexcept { return ddc::replace_dim_of( @@ -334,6 +384,10 @@ class SplineBuilder * * Get the interpolation matrix. This can be useful for debugging (as it allows * one to print the matrix) or for more complex quadrature schemes. + * + * Warning: the returned ddc::detail::Matrix class is not supposed to be exposed + * to user, which means its usage is not tested out of the scope of DDC splines transforms. + * Use at your own risk. * * @return A reference to the interpolation matrix. */ @@ -355,8 +409,10 @@ class SplineBuilder * * @param[out] spline The coefficients of the spline calculated by the function. * @param[in] vals The values of the function at the grid points. - * @param[in] derivs_xmin The values of the derivatives at the lower boundary. - * @param[in] derivs_xmax The values of the derivatives at the upper boundary. + * @param[in] derivs_xmin The values of the derivatives at the lower boundary + * (used only with HERMITE lower boundary condition). + * @param[in] derivs_xmax The values of the derivatives at the upper boundary + * (used only with HERMITE upper boundary condition). */ template void operator()( From 29367d7301107a93dcc5d7932f9272a39fb90222 Mon Sep 17 00:00:00 2001 From: blegouix Date: Wed, 17 Apr 2024 15:47:16 +0200 Subject: [PATCH 12/89] changes from Emiliy's reviw --- include/ddc/kernels/splines/spline_builder.hpp | 10 +++++----- include/ddc/kernels/splines/spline_builder_2d.hpp | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index dc692d327..ef6ba4a72 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -92,7 +92,7 @@ class SplineBuilder using memory_space = MemorySpace; /** - * @brief The type of the interpolation mesh (discrete dimension of interest) used by this class. + * @brief The type of the interpolation discrete dimension (discrete dimension of interest) used by this class. */ using interpolation_mesh_type = InterpolationMesh; @@ -102,7 +102,7 @@ class SplineBuilder using bsplines_type = BSplines; /** - * @brief The deriv dimension at the boundaries. + * @brief The Deriv dimension at the boundaries. */ using deriv_type = ddc::Deriv; @@ -151,7 +151,7 @@ class SplineBuilder ddc::detail::TypeSeq>>>; /** - * @brief The type of the whole derivs domain (cartesian product of 1D deriv domain and batch domain) preserving the underlying memory layout (order of dimensions). + * @brief The type of the whole Derivs domain (cartesian product of 1D Deriv domain and batch domain) preserving the underlying memory layout (order of dimensions). */ using batched_derivs_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain Date: Wed, 17 Apr 2024 15:52:28 +0200 Subject: [PATCH 13/89] format --- include/ddc/kernels/splines/spline_builder.hpp | 12 ++++++------ include/ddc/kernels/splines/spline_builder_2d.hpp | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index ef6ba4a72..b9ea5a3af 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -101,7 +101,7 @@ class SplineBuilder */ using bsplines_type = BSplines; - /** + /** * @brief The Deriv dimension at the boundaries. */ using deriv_type = ddc::Deriv; @@ -124,7 +124,7 @@ class SplineBuilder ddc::detail::TypeSeq, ddc::detail::TypeSeq>>; - /** + /** * @brief Helper to get the dimension of batched_spline_domain_type associated to a dimension of batched_interpolation_domain_type. */ template @@ -140,7 +140,7 @@ class SplineBuilder ddc::detail::TypeSeq, ddc::detail::TypeSeq>>; - /** + /** * @brief The type of the whole spline domain (cartesian product of 1D spline domain and batch domain) with 1D spline domain being contiguous . */ using batched_spline_tr_domain_type = @@ -270,7 +270,7 @@ class SplineBuilder * @param x The SplineBuilder being copied. * @returns A reference to this object. */ - SplineBuilder& operator=(SplineBuilder&& x) = default; + SplineBuilder& operator=(SplineBuilder&& x) = default; /** * @brief Get the domain for the 1D interpolation mesh used by this class. @@ -309,7 +309,7 @@ class SplineBuilder return ddc::remove_dims_of(batched_interpolation_domain(), interpolation_domain()); } - /** + /** * @brief Get the 1D domain on which spline coefficients are defined. * * Get the 1D spline domain corresponding to dimension of interest. @@ -363,7 +363,7 @@ class SplineBuilder ddc::DiscreteVector(s_nbc_xmin))); } - /** + /** * @brief Get the whole domain on which derivatives on upper boundary are defined. * * Get the whole domain on which derivatives on upper boundary are defined. This is used only with HERMITE boundary conditions. diff --git a/include/ddc/kernels/splines/spline_builder_2d.hpp b/include/ddc/kernels/splines/spline_builder_2d.hpp index f2072ddc6..872bf2956 100644 --- a/include/ddc/kernels/splines/spline_builder_2d.hpp +++ b/include/ddc/kernels/splines/spline_builder_2d.hpp @@ -87,12 +87,12 @@ class SplineBuilder2D */ using bsplines_type2 = typename builder_type2::bsplines_type; - /** + /** * @brief The type of the Deriv domain on boundaries in the first dimension which are compatible with this class. */ using deriv_type1 = typename builder_type1::deriv_type; - /** + /** * @brief The type of the Deriv domain on boundaries in the second dimension which are compatible with this class. */ using deriv_type2 = typename builder_type2::deriv_type; From 84e76df62c3832ea8f4e55fb4c57b083e53406ce Mon Sep 17 00:00:00 2001 From: blegouix Date: Wed, 17 Apr 2024 16:30:31 +0200 Subject: [PATCH 14/89] minor --- include/ddc/kernels/splines/greville_interpolation_points.hpp | 2 +- include/ddc/kernels/splines/spline_builder.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/ddc/kernels/splines/greville_interpolation_points.hpp b/include/ddc/kernels/splines/greville_interpolation_points.hpp index 93afe9580..71443c6b9 100644 --- a/include/ddc/kernels/splines/greville_interpolation_points.hpp +++ b/include/ddc/kernels/splines/greville_interpolation_points.hpp @@ -15,7 +15,7 @@ namespace ddc { /** - * A class which provides helper functions to initialize the Greville points from a B-Spline definition. + * A class which provides helper functions to initialise the Greville points from a B-Spline definition. * * @tparam BSplines The bspline class relative to which the Greville points will be calculated. * @tparam BcXmin The (left) boundary condition that will be used to build the splines. diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index b9ea5a3af..722987513 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -220,7 +220,7 @@ class SplineBuilder /** * @brief Build a SplineBuilder acting on batched_interpolation_domain. - * + * * @param batched_interpolation_domain The domain on which are defined the interpolation points. * @param cols_per_chunk An hyperparameter used by the slicer (internal to the solver) to define the size of a chunk of right-and-sides of the linear problem to be computed in parallel. */ From aa7b594ccc4219c1845b2b6b52b6e6118d5a15a3 Mon Sep 17 00:00:00 2001 From: blegouix Date: Wed, 17 Apr 2024 16:43:23 +0200 Subject: [PATCH 15/89] wip --- include/ddc/kernels/splines/bsplines_non_uniform.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index 4a52c5d32..60d4dc400 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -24,7 +24,12 @@ struct NonUniformBSplinesBase { }; -/// NonUniformPointSampling specialization of BSplines +/** + * The type of a non-uniform BSplines 1D basis. + * + * @tparam Tag The tag identifying the continuous dimension which supports the building of the BSplines. + * @tparam D The degree of the BSplines. + */ template class NonUniformBSplines : NonUniformBSplinesBase { From ffef0b2a8f861fc806c92dfaca595579c3d14f5c Mon Sep 17 00:00:00 2001 From: blegouix Date: Thu, 18 Apr 2024 11:30:48 +0200 Subject: [PATCH 16/89] wip --- include/ddc/kernels/splines/bsplines_uniform.hpp | 13 +++++++++++-- include/ddc/kernels/splines/spline_builder.hpp | 4 +--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index e6dd39963..f9571df4a 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -36,22 +36,25 @@ class UniformBSplines : UniformBSplinesBase static_assert(D > 0, "Parameter `D` must be positive"); public: + /// @brief The tag identifying the continuous dimension which supports the building of the BSplines. using tag_type = Tag; - + /// @brief The discrete dimension corresponding to BSplines. using discrete_dimension_type = UniformBSplines; -public: + /// @brief The rank. static constexpr std::size_t rank() { return 1; } + /// @brief The degree of BSplines. static constexpr std::size_t degree() noexcept { return D; } + /// @brief Indicates if the BSplines are periodic or not. static constexpr bool is_periodic() noexcept { return Tag::PERIODIC; @@ -67,6 +70,7 @@ class UniformBSplines : UniformBSplinesBase return true; } + /// @brief Impl template class Impl { @@ -221,6 +225,11 @@ struct is_uniform_bsplines : public std::is_base_of { }; +/** + * @brief Indicates if a dimension representing BSplines corresponds to uniform BSplines of not. + * + * @tparam The discrete dimension associated to BSplines + */ template constexpr bool is_uniform_bsplines_v = is_uniform_bsplines::value; diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index 7423b2aa8..1a150ea6f 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -17,9 +17,7 @@ namespace ddc { * An enum determining the backend solver of a SplineBuilder or SplineBuilder2d. Only GINKGO available at the moment, * other solvers will be implemented in the futur. */ -enum class SplineSolver { - GINKGO -}; +enum class SplineSolver { GINKGO }; /** * @brief An helper giving the uniform/non_uniform status of a spline interpolation mesh according to its attributes. From 2a050b073040b77b9c3ee4b8b5d19552846d283f Mon Sep 17 00:00:00 2001 From: blegouix Date: Thu, 18 Apr 2024 14:39:26 +0200 Subject: [PATCH 17/89] wip --- .../ddc/kernels/splines/bsplines_uniform.hpp | 96 +++++++++++++++++-- .../ddc/kernels/splines/spline_builder.hpp | 16 +--- 2 files changed, 94 insertions(+), 18 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index f9571df4a..e12adf956 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -60,11 +60,13 @@ class UniformBSplines : UniformBSplinesBase return Tag::PERIODIC; } + /// @brief Indicates if the BSplines are radial or not (should be deprecated soon because this concept is not in the scope of DDC). static constexpr bool is_radial() noexcept { return false; } + /// @brief Indicates if the BSplines are uniform or not (this is obviously the case here). static constexpr bool is_uniform() noexcept { return true; @@ -84,20 +86,19 @@ class UniformBSplines : UniformBSplinesBase ddc::DiscreteDomain m_domain; public: + /// @brief The type of discrete dimension associated to BSplines. using discrete_dimension_type = UniformBSplines; + /// @brief The type of discrete domain indexing the BSplines. using discrete_domain_type = DiscreteDomain; + /// @brief The type of discrete element indexing a BSpline. using discrete_element_type = DiscreteElement; + /// @brief The type of discrete vector representing an "indexes displacement" between two BSplines. using discrete_vector_type = DiscreteVector; - Impl() = default; - - template - explicit Impl(Impl const& impl) : m_domain(impl.m_domain) - { - } + Impl() = default; /** Constructs a BSpline basis with n equidistant knots over \f$[a, b]\f$ * @@ -117,16 +118,33 @@ class UniformBSplines : UniformBSplinesBase mesh_type>(rmin, rmax, ddc::DiscreteVector(ncells + 1))); } + /// @brief Copy-constructs from another impl with different Kokkos memory space + template + explicit Impl(Impl const& impl) : m_domain(impl.m_domain) + { + } + + /// @brief Copy-constructs Impl(Impl const& x) = default; + /// @brief Move-constructs Impl(Impl&& x) = default; + /// @brief Destructs ~Impl() = default; + /// @brief Copy-assigns Impl& operator=(Impl const& x) = default; + /// @brief Move-assigns Impl& operator=(Impl&& x) = default; + /** @brief Evaluates BSplines at a given coordinate + * + * The values are computed for every BSplines at the given coordinate x. A spline approximation at coordinate x is a linear combination of those BSplines evaluations weigthed with splines coefficients of the spline-transformed initial discrete function. + * @param[out] values The values of the BSplines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. + * @param[in] x The coordinates where BSplines are evaluated. + */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis(DSpan1D values, ddc::Coordinate const& x) const { @@ -134,71 +152,135 @@ class UniformBSplines : UniformBSplinesBase return eval_basis(values, x, degree()); } + /** @brief Evaluates BSplines derivatives at a given coordinate + * + * The derivatives are computed for every BSplines at the given coordinate x. A spline approximation of a derivative at coordinate x is a linear combination of those BSplines derivatives weigthed with splines coefficients of the spline-transformed initial discrete function. + * @param[out] derivs The derivatives of the BSplines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. + * @param[in] x The coordinates where BSplines derivatives are evaluated. + */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_deriv(DSpan1D derivs, ddc::Coordinate const& x) const; + /** @brief Evaluates BSplines values and n derivatives at a given coordinate + * + * The values and derivatives are computed for every BSplines at the given coordinate x. + * @param[out] derivs The values and n derivatives of the BSplines evaluated at coordinate x. It has to be a (1+degree)*(1+n) 2D mdspan. + * @param[in] x The coordinates where BSplines derivatives are evaluated. + * @param[in] n The number of derivatives to evaluate (in addition to the BSplines values themselves). + */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis_and_n_derivs( ddc::DSpan2D derivs, ddc::Coordinate const& x, std::size_t n) const; + /** @brief Compute the integrals of the bsplines + * + * @param[out] int_vals The values of the integrals. It has to be a (1+nbasis) 1D mdspan. + */ template KOKKOS_INLINE_FUNCTION ddc::ChunkSpan integrals( ddc::ChunkSpan int_vals) const; + /** @brief Returns the coordinate of the knot corresponding to the given index for a BSpline. + * + * @param[in] idx Integer identifying index of the knot. + * @return Coordinate of the knot. + */ KOKKOS_INLINE_FUNCTION ddc::Coordinate get_knot(int idx) const noexcept { return ddc::Coordinate(rmin() + idx * ddc::step()); } + /** @brief Returns the first support knot associated to a discrete_element identifying a BSpline. + * + * @param[in] ix Index of the BSpline. + * @return Coordinate of the knot. + */ KOKKOS_INLINE_FUNCTION double get_first_support_knot(discrete_element_type const& ix) const { return get_knot(ix.uid() - degree()); } + /** @brief Returns the last support knot associated to a discrete_element identifying a BSpline. + * + * @param[in] ix Index of the BSpline. + * @return Coordinate of the knot. + */ KOKKOS_INLINE_FUNCTION double get_last_support_knot(discrete_element_type const& ix) const { return get_knot(ix.uid() + 1); } + /** @brief Returns the n-th knot associated to a discrete_element identifying a BSpline. + * + * @param[in] ix Index of the BSpline. + * @param[in] n Integer identifying a knot in the support of the BSpline. + */ KOKKOS_INLINE_FUNCTION double get_support_knot_n(discrete_element_type const& ix, int n) const { return get_knot(ix.uid() + n - degree()); } + /** @brief Returns the coordinate of the lower boundary BSpline. + * + * @return Coordinate of the lower boundary BSpline. + */ KOKKOS_INLINE_FUNCTION ddc::Coordinate rmin() const noexcept { return ddc::coordinate(m_domain.front()); } + /** @brief Returns the coordinate of the upper boundary BSpline. + * + * @return Coordinate of the upper boundary BSpline. + */ KOKKOS_INLINE_FUNCTION ddc::Coordinate rmax() const noexcept { return ddc::coordinate(m_domain.back()); } + /** @brief TODO + * + * @return TODO. + */ KOKKOS_INLINE_FUNCTION double length() const noexcept { return rmax() - rmin(); } + /** @brief TODO + * + * @return TODO. + */ KOKKOS_INLINE_FUNCTION std::size_t size() const noexcept { return degree() + ncells(); } - /// Returns the discrete domain including ghost bsplines + /** @brief Returns the discrete domain including ghost bsplines + * + * @return The discrete domain including ghost bsplines. + */ KOKKOS_INLINE_FUNCTION discrete_domain_type full_domain() const { return discrete_domain_type(discrete_element_type(0), discrete_vector_type(size())); } + /** @brief TODO + * + * @return TODO + */ KOKKOS_INLINE_FUNCTION std::size_t nbasis() const noexcept { return ncells() + !is_periodic() * degree(); } + /** @brief TODO + * + * @return TODO + */ KOKKOS_INLINE_FUNCTION std::size_t ncells() const noexcept { return m_domain.size() - 1; diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index 1a150ea6f..7c1824d69 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -249,25 +249,19 @@ class SplineBuilder preconditionner_max_block_size); } + /// @brief Copy-constructor is deleted SplineBuilder(SplineBuilder const& x) = delete; - /** - * @brief Create a new SplineBuilder by copy - * - * @param x The SplineBuilder being copied. - */ + /// @brief Move-constructs SplineBuilder(SplineBuilder&& x) = default; + /// @brief Destructs ~SplineBuilder() = default; + /// @brief Copy-assignment is deleted SplineBuilder& operator=(SplineBuilder const& x) = delete; - /** - * @brief Copy a SplineBuilder. - * - * @param x The SplineBuilder being copied. - * @returns A reference to this object. - */ + /// @brief Move-assigns SplineBuilder& operator=(SplineBuilder&& x) = default; /** From 880353bec833c10cff706b27778353c9b82c2c06 Mon Sep 17 00:00:00 2001 From: blegouix Date: Thu, 18 Apr 2024 14:47:24 +0200 Subject: [PATCH 18/89] bsplines --- .../kernels/splines/bsplines_non_uniform.hpp | 95 ++++++++++++++++++- 1 file changed, 92 insertions(+), 3 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index 680c081ab..20e6ca2d7 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -36,37 +36,43 @@ class NonUniformBSplines : NonUniformBSplinesBase static_assert(D > 0, "Parameter `D` must be positive"); public: + /// @brief The tag identifying the continuous dimension which supports the building of the BSplines. using tag_type = Tag; - + /// @brief The discrete dimension corresponding to BSplines. using discrete_dimension_type = NonUniformBSplines; -public: + /// @brief The rank. static constexpr std::size_t rank() { return 1; } + /// @brief The degree of BSplines. static constexpr std::size_t degree() noexcept { return D; } + /// @brief Indicates if the BSplines are periodic or not. static constexpr bool is_periodic() noexcept { return Tag::PERIODIC; } + /// @brief Indicates if the BSplines are radial or not (should be deprecated soon because this concept is not in the scope of DDC). static constexpr bool is_radial() noexcept { return false; } + /// @brief Indicates if the BSplines are uniform or not (this is obviously the case here). static constexpr bool is_uniform() noexcept { return false; } + /// @brief Impl template class Impl { @@ -81,12 +87,16 @@ class NonUniformBSplines : NonUniformBSplinesBase int m_nknots; public: + /// @brief The type of discrete dimension associated to BSplines. using discrete_dimension_type = NonUniformBSplines; + /// @brief The type of discrete domain indexing the BSplines. using discrete_domain_type = DiscreteDomain; + /// @brief The type of discrete element indexing a BSpline. using discrete_element_type = DiscreteElement; + /// @brief The type of discrete vector representing an "indexes displacement" between two BSplines. using discrete_vector_type = DiscreteVector; Impl() = default; @@ -114,49 +124,97 @@ class NonUniformBSplines : NonUniformBSplinesBase template Impl(RandomIt breaks_begin, RandomIt breaks_end); + /// @brief Copy-constructs Impl(Impl const& x) = default; + /// @brief Move-constructs Impl(Impl&& x) = default; + /// @brief Destructs ~Impl() = default; + /// @brief Copy-assigns Impl& operator=(Impl const& x) = default; + /// @brief Move-assigns Impl& operator=(Impl&& x) = default; + /** @brief Evaluates BSplines at a given coordinate + * + * The values are computed for every BSplines at the given coordinate x. A spline approximation at coordinate x is a linear combination of those BSplines evaluations weigthed with splines coefficients of the spline-transformed initial discrete function. + * @param[out] values The values of the BSplines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. + * @param[in] x The coordinates where BSplines are evaluated. + */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis(DSpan1D values, ddc::Coordinate const& x) const; + /** @brief Evaluates BSplines derivatives at a given coordinate + * + * The derivatives are computed for every BSplines at the given coordinate x. A spline approximation of a derivative at coordinate x is a linear combination of those BSplines derivatives weigthed with splines coefficients of the spline-transformed initial discrete function. + * @param[out] derivs The derivatives of the BSplines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. + * @param[in] x The coordinates where BSplines derivatives are evaluated. + */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_deriv(DSpan1D derivs, ddc::Coordinate const& x) const; + /** @brief Evaluates BSplines values and n derivatives at a given coordinate + * + * The values and derivatives are computed for every BSplines at the given coordinate x. + * @param[out] derivs The values and n derivatives of the BSplines evaluated at coordinate x. It has to be a (1+degree)*(1+n) 2D mdspan. + * @param[in] x The coordinates where BSplines derivatives are evaluated. + * @param[in] n The number of derivatives to evaluate (in addition to the BSplines values themselves). + */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis_and_n_derivs( ddc::DSpan2D derivs, ddc::Coordinate const& x, std::size_t n) const; + /** @brief Compute the integrals of the bsplines + * + * @param[out] int_vals The values of the integrals. It has to be a (1+nbasis) 1D mdspan. + */ template KOKKOS_INLINE_FUNCTION ddc::ChunkSpan integrals( ddc::ChunkSpan int_vals) const; + /** @brief Returns the coordinate of the knot corresponding to the given index for a BSpline. + * + * @param[in] idx Integer identifying index of the knot. + * @return Coordinate of the knot. + */ KOKKOS_INLINE_FUNCTION ddc::Coordinate get_knot(int knot_idx) const noexcept { return ddc::coordinate(ddc::DiscreteElement(knot_idx + degree())); } + /** @brief Returns the first support knot associated to a discrete_element identifying a BSpline. + * + * @param[in] ix Index of the BSpline. + * @return Coordinate of the knot. + */ KOKKOS_INLINE_FUNCTION ddc::Coordinate get_first_support_knot( discrete_element_type const& ix) const { return ddc::coordinate(ddc::DiscreteElement(ix.uid())); } + /** @brief Returns the last support knot associated to a discrete_element identifying a BSpline. + * + * @param[in] ix Index of the BSpline. + * @return Coordinate of the knot. + */ KOKKOS_INLINE_FUNCTION ddc::Coordinate get_last_support_knot( discrete_element_type const& ix) const { return ddc::coordinate(ddc::DiscreteElement(ix.uid() + degree() + 1)); } + /** @brief Returns the n-th knot associated to a discrete_element identifying a BSpline. + * + * @param[in] ix Index of the BSpline. + * @param[in] n Integer identifying a knot in the support of the BSpline. + */ KOKKOS_INLINE_FUNCTION ddc::Coordinate get_support_knot_n( discrete_element_type const& ix, int n) const @@ -164,42 +222,73 @@ class NonUniformBSplines : NonUniformBSplinesBase return ddc::coordinate(ddc::DiscreteElement(ix.uid() + n)); } + /** @brief Returns the coordinate of the lower boundary BSpline. + * + * @return Coordinate of the lower boundary BSpline. + */ KOKKOS_INLINE_FUNCTION ddc::Coordinate rmin() const noexcept { return get_knot(0); } + /** @brief Returns the coordinate of the upper boundary BSpline. + * + * @return Coordinate of the upper boundary BSpline. + */ KOKKOS_INLINE_FUNCTION ddc::Coordinate rmax() const noexcept { return get_knot(ncells()); } + /** @brief TODO + * + * @return TODO. + */ KOKKOS_INLINE_FUNCTION double length() const noexcept { return rmax() - rmin(); } + /** @brief TODO + * + * @return TODO. + */ KOKKOS_INLINE_FUNCTION std::size_t size() const noexcept { return degree() + ncells(); } - /// Returns the discrete domain including ghost bsplines + /** @brief Returns the discrete domain including ghost bsplines + * + * @return The discrete domain including ghost bsplines. + */ KOKKOS_INLINE_FUNCTION discrete_domain_type full_domain() const { return discrete_domain_type(discrete_element_type(0), discrete_vector_type(size())); } + /** @brief TODO + * + * @return TODO + */ KOKKOS_INLINE_FUNCTION std::size_t npoints() const noexcept { return m_nknots - 2 * degree(); } + /** @brief TODO + * + * @return TODO + */ KOKKOS_INLINE_FUNCTION std::size_t nbasis() const noexcept { return ncells() + !is_periodic() * degree(); } + /** @brief TODO + * + * @return TODO + */ KOKKOS_INLINE_FUNCTION std::size_t ncells() const noexcept { return npoints() - 1; From 39f2d7092f3fbe53612fe9b0b1cae447a8325060 Mon Sep 17 00:00:00 2001 From: blegouix Date: Thu, 18 Apr 2024 14:49:22 +0200 Subject: [PATCH 19/89] init --- .../ddc/kernels/splines/spline_builder.hpp | 236 +++++++++++++----- .../ddc/kernels/splines/spline_builder_2d.hpp | 179 ++++++++----- 2 files changed, 289 insertions(+), 126 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index e30e87b23..7c1824d69 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -10,10 +10,24 @@ #include "deriv.hpp" namespace ddc { -enum class SplineSolver { - GINKGO -}; // Only GINKGO available atm, other solvers will be implemented in the futur +/** + * @brief An enum determining the backend solver of a SplineBuilder or SplineBuilder2d. + * + * An enum determining the backend solver of a SplineBuilder or SplineBuilder2d. Only GINKGO available at the moment, + * other solvers will be implemented in the futur. + */ +enum class SplineSolver { GINKGO }; + +/** + * @brief An helper giving the uniform/non_uniform status of a spline interpolation mesh according to its attributes. + * + * An helper giving the uniform/non_uniform status of a spline interpolation mesh according to its attributes. + * @param is_uniform A boolean giving the presumed status before considering boundary conditions. + * @param BcXmin The lower boundary condition. + * @param BcXmax The upper boundary condition. + * @param int The degree of the spline. + */ constexpr bool is_spline_interpolation_mesh_uniform( bool const is_uniform, ddc::BoundCond const BcXmin, @@ -34,6 +48,14 @@ constexpr bool is_spline_interpolation_mesh_uniform( * 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. + * @tparam ExecSpace The Kokkos execution space on which the spline transform is performed. + * @tparam MemorySpace The Kokkos memory space on which the data (interpolation function and splines coefficients) are stored. + * @tparam BSplines The discrete dimension representing the BSplines. + * @tparam InterpolationMesh The discrete dimension supporting the interpolation points. + * @tparam BcXmin The lower boundary condition. + * @tparam BcXmax The upper boundary condition. + * @tparam Solver The SplineSolver giving the backend used to perform the spline transform. + * @tparam IDimX A variadic template of all the discrete dimensions forming the full space (InterpolationMesh + batched dimensions). */ template < class ExecSpace, @@ -57,52 +79,79 @@ class SplineBuilder using tag_type = typename InterpolationMesh::continuous_dimension_type; public: + /** + * @brief The type of the Kokkos execution space used by this class. + */ using exec_space = ExecSpace; + /** + * @brief The type of the Kokkos memory space used by this class. + */ using memory_space = MemorySpace; /** - * @brief The type of the interpolation mesh used by this class. + * @brief The type of the interpolation discrete dimension (discrete dimension of interest) used by this class. */ using interpolation_mesh_type = InterpolationMesh; /** - * @brief The type of the BSplines which are compatible with this class. + * @brief The discrete dimension representing the BSplines. */ using bsplines_type = BSplines; + /** + * @brief The Deriv dimension at the boundaries. + */ using deriv_type = ddc::Deriv; /** - * @brief The type of the domain for the interpolation mesh used by this class. + * @brief The type of the domain for the 1D interpolation mesh used by this class. */ using interpolation_domain_type = ddc::DiscreteDomain; - using vals_domain_type = ddc::DiscreteDomain; + /** + * @brief The type of the whole domain representing interpolation points. + */ + using batched_interpolation_domain_type = ddc::DiscreteDomain; + /** + * @brief The type of the batch domain (obtained by removing dimension of interest from whole space). + */ using batch_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq>>; + /** + * @brief Helper to get the dimension of batched_spline_domain_type associated to a dimension of batched_interpolation_domain_type. + */ template using spline_dim_type = std::conditional_t, bsplines_type, Tag>; - using spline_domain_type = + /** + * @brief The type of the whole spline domain (cartesian product of 1D spline domain and batch domain) preserving the underlying memory layout (order of dimensions). + */ + using batched_spline_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, ddc::detail::TypeSeq>>; - using spline_tr_domain_type = + /** + * @brief The type of the whole spline domain (cartesian product of 1D spline domain and batch domain) with 1D spline domain being contiguous . + */ + using batched_spline_tr_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::type_seq_remove_t< ddc::detail::TypeSeq, ddc::detail::TypeSeq>>>; - using derivs_domain_type = + /** + * @brief The type of the whole Derivs domain (cartesian product of 1D Deriv domain and batch domain) preserving the underlying memory layout (order of dimensions). + */ + using batched_derivs_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, @@ -114,12 +163,12 @@ class SplineBuilder static constexpr bool s_odd = BSplines::degree() % 2; /** - * @brief The number of equations which define the boundary conditions at the lower bound. + * @brief The number of equations defining the boundary conditions at the lower bound. */ static constexpr int s_nbe_xmin = n_boundary_equations(BcXmin, BSplines::degree()); /** - * @brief The number of equations which define the boundary conditions at the upper bound. + * @brief The number of equations defining the boundary conditions at the upper bound. */ static constexpr int s_nbe_xmax = n_boundary_equations(BcXmax, BSplines::degree()); @@ -152,7 +201,7 @@ class SplineBuilder static constexpr ddc::BoundCond s_bc_xmax = BcXmax; private: - vals_domain_type m_vals_domain; + batched_interpolation_domain_type m_batched_interpolation_domain; int m_offset; @@ -162,13 +211,22 @@ class SplineBuilder std::unique_ptr matrix; public: + /** + * @brief An helper to compute the offset. + */ int compute_offset(interpolation_domain_type const& interpolation_domain); + /** + * @brief Build a SplineBuilder acting on batched_interpolation_domain. + * + * @param batched_interpolation_domain The domain on which are defined the interpolation points. + * @param cols_per_chunk An hyperparameter used by the slicer (internal to the solver) to define the size of a chunk of right-and-sides of the linear problem to be computed in parallel. + */ explicit SplineBuilder( - vals_domain_type const& vals_domain, + batched_interpolation_domain_type const& batched_interpolation_domain, std::optional cols_per_chunk = std::nullopt, std::optional preconditionner_max_block_size = std::nullopt) - : m_vals_domain(vals_domain) + : m_batched_interpolation_domain(batched_interpolation_domain) , m_offset(compute_offset(interpolation_domain())) , m_dx((ddc::discrete_space().rmax() - ddc::discrete_space().rmin()) / ddc::discrete_space().ncells()) @@ -191,88 +249,123 @@ class SplineBuilder preconditionner_max_block_size); } + /// @brief Copy-constructor is deleted SplineBuilder(SplineBuilder const& x) = delete; - /** - * @brief Create a new SplineBuilder by copy - * - * @param x The SplineBuilder being copied. - */ + /// @brief Move-constructs SplineBuilder(SplineBuilder&& x) = default; + /// @brief Destructs ~SplineBuilder() = default; + /// @brief Copy-assignment is deleted SplineBuilder& operator=(SplineBuilder const& x) = delete; + /// @brief Move-assigns + SplineBuilder& operator=(SplineBuilder&& x) = default; + /** - * @brief Copy a SplineBuilder. + * @brief Get the domain for the 1D interpolation mesh used by this class. * - * @param x The SplineBuilder being copied. - * @returns A reference to this object. + * Get the 1D interpolation domain associated to dimension of interest. + * + * @return The 1D domain for the grid points. */ - SplineBuilder& operator=(SplineBuilder&& x) = default; - - vals_domain_type vals_domain() const noexcept + interpolation_domain_type interpolation_domain() const noexcept { - return m_vals_domain; + return interpolation_domain_type(m_batched_interpolation_domain); } /** - * @brief Get the domain from which the approximation is defined. + * @brief Get the whole domain representing interpolation points. * * Get the domain on which values of the function must be provided in order - * to build a spline approximation of the function. + * to build a spline transform of the function. * * @return The domain for the grid points. */ - interpolation_domain_type interpolation_domain() const noexcept + batched_interpolation_domain_type batched_interpolation_domain() const noexcept { - return interpolation_domain_type(vals_domain()); + return m_batched_interpolation_domain; } + /** + * @brief Get the batch domain. + * + * Get the batch domain (obtained by removing dimension of interest from whole interpolation domain). + * + * @return The batch domain. + */ batch_domain_type batch_domain() const noexcept { - return ddc::remove_dims_of(vals_domain(), interpolation_domain()); + return ddc::remove_dims_of(batched_interpolation_domain(), interpolation_domain()); } - ddc::DiscreteDomain bsplines_domain() const noexcept // TODO : clarify name + /** + * @brief Get the 1D domain on which spline coefficients are defined. + * + * Get the 1D spline domain corresponding to dimension of interest. + * + * @return The 1D domain for the spline coefficients. + */ + ddc::DiscreteDomain spline_domain() const noexcept { return ddc::discrete_space().full_domain(); } /** - * @brief Get the domain on which the approximation is defined. + * @brief Get the whole domain on which spline coefficients are defined, preserving memory layout. * - * Get the domain of the basis-splines for which the coefficients of the spline - * approximation must be calculated. + * Get the whole domain on which spline coefficients will be computed, preserving memory layout (order of dimensions). * - * @return The domain for the splines. + * @return The domain for the spline coefficients. */ - spline_domain_type spline_domain() const noexcept + batched_spline_domain_type batched_spline_domain() const noexcept { return ddc::replace_dim_of< interpolation_mesh_type, - bsplines_type>(vals_domain(), bsplines_domain()); + bsplines_type>(batched_interpolation_domain(), spline_domain()); } - spline_tr_domain_type spline_tr_domain() const noexcept + /** + * @brief Get the whole domain on which spline coefficients are defined, with dimension of interest contiguous. + * + * Get the (transposed) whole domain on which spline coefficients will be computed, with dimension of interest contiguous. + * + * @return The (transposed) domain for the spline coefficients. + */ + batched_spline_tr_domain_type batched_spline_tr_domain() const noexcept { - return spline_tr_domain_type(bsplines_domain(), batch_domain()); + return batched_spline_tr_domain_type(spline_domain(), batch_domain()); } - derivs_domain_type derivs_xmin_domain() const noexcept + /** + * @brief Get the whole domain on which derivatives on lower boundary are defined. + * + * Get the whole domain on which derivatives on lower boundary are defined. This is used only with HERMITE boundary conditions. + * + * @return The domain for the Derivs values. + */ + batched_derivs_domain_type batched_derivs_xmin_domain() const noexcept { return ddc::replace_dim_of( - vals_domain(), + batched_interpolation_domain(), ddc::DiscreteDomain( ddc::DiscreteElement(1), ddc::DiscreteVector(s_nbc_xmin))); } - derivs_domain_type derivs_xmax_domain() const noexcept + /** + * @brief Get the whole domain on which derivatives on upper boundary are defined. + * + * Get the whole domain on which derivatives on upper boundary are defined. This is used only with HERMITE boundary conditions. + * + * @return The domain for the Derivs values. + */ + batched_derivs_domain_type batched_derivs_xmax_domain() const noexcept { return ddc::replace_dim_of( - vals_domain(), + batched_interpolation_domain(), ddc::DiscreteDomain( ddc::DiscreteElement(1), ddc::DiscreteVector(s_nbc_xmax))); @@ -283,6 +376,10 @@ class SplineBuilder * * Get the interpolation matrix. This can be useful for debugging (as it allows * one to print the matrix) or for more complex quadrature schemes. + * + * Warning: the returned ddc::detail::Matrix class is not supposed to be exposed + * to user, which means its usage is not tested out of the scope of DDC splines transforms. + * Use at your own risk. * * @return A reference to the interpolation matrix. */ @@ -304,20 +401,27 @@ class SplineBuilder * * @param[out] spline The coefficients of the spline calculated by the function. * @param[in] vals The values of the function at the grid points. - * @param[in] derivs_xmin The values of the derivatives at the lower boundary. - * @param[in] derivs_xmax The values of the derivatives at the upper boundary. + * @param[in] derivs_xmin The values of the derivatives at the lower boundary + * (used only with HERMITE lower boundary condition). + * @param[in] derivs_xmax The values of the derivatives at the upper boundary + * (used only with HERMITE upper boundary condition). */ template void operator()( - ddc::ChunkSpan spline, - ddc::ChunkSpan vals, - std::optional< - ddc::ChunkSpan> const - derivs_xmin + ddc::ChunkSpan spline, + ddc::ChunkSpan + vals, + std::optional> const derivs_xmin = std::nullopt, - std::optional< - ddc::ChunkSpan> const - derivs_xmax + std::optional> const derivs_xmax = std::nullopt) const; private: @@ -638,12 +742,18 @@ void SplineBuilder< Solver, IDimX...>:: operator()( - ddc::ChunkSpan spline, - ddc::ChunkSpan vals, - std::optional> const - derivs_xmin, - std::optional> const - derivs_xmax) const + ddc::ChunkSpan spline, + ddc::ChunkSpan vals, + std::optional> const derivs_xmin, + std::optional> const derivs_xmax) const { assert(vals.template extent() == ddc::discrete_space().nbasis() - s_nbe_xmin - s_nbe_xmax); @@ -718,7 +828,9 @@ operator()( // TODO : Consider optimizing // Allocate and fill a transposed version of spline in order to get dimension of interest as last dimension (optimal for GPU, necessary for Ginkgo) - ddc::Chunk spline_tr_alloc(spline_tr_domain(), ddc::KokkosAllocator()); + ddc::Chunk spline_tr_alloc( + batched_spline_tr_domain(), + ddc::KokkosAllocator()); ddc::ChunkSpan spline_tr = spline_tr_alloc.span_view(); ddc::parallel_for_each( exec_space(), diff --git a/include/ddc/kernels/splines/spline_builder_2d.hpp b/include/ddc/kernels/splines/spline_builder_2d.hpp index 372954e96..872bf2956 100644 --- a/include/ddc/kernels/splines/spline_builder_2d.hpp +++ b/include/ddc/kernels/splines/spline_builder_2d.hpp @@ -87,7 +87,14 @@ class SplineBuilder2D */ using bsplines_type2 = typename builder_type2::bsplines_type; + /** + * @brief The type of the Deriv domain on boundaries in the first dimension which are compatible with this class. + */ using deriv_type1 = typename builder_type1::deriv_type; + + /** + * @brief The type of the Deriv domain on boundaries in the second dimension which are compatible with this class. + */ using deriv_type2 = typename builder_type2::deriv_type; /** @@ -113,26 +120,26 @@ class SplineBuilder2D using interpolation_domain_type = ddc::DiscreteDomain; - using vals_domain_type = ddc::DiscreteDomain; + using batched_interpolation_domain_type = ddc::DiscreteDomain; using batch_domain_type = ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq>>; - using spline_domain_type + using batched_spline_domain_type = ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, ddc::detail::TypeSeq>>; - using derivs_domain_type1 = typename builder_type1::derivs_domain_type; - using derivs_domain_type2 + using batched_derivs_domain_type1 = typename builder_type1::batched_derivs_domain_type; + using batched_derivs_domain_type2 = ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, ddc::detail::TypeSeq>>; - using derivs_domain_type + using batched_derivs_domain_type = ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, @@ -147,24 +154,27 @@ class SplineBuilder2D /** * @brief Create a new SplineBuilder2D. * - * @param vals_domain + * @param batched_interpolation_domain * The 2D domain on which points will be provided in order to * create the 2D spline approximation. * @param cols_per_chunk The number of columns in the rhs passed to the underlying linear solver. * @param preconditionner_max_block_size The block size of in the block Jacobi preconditioner. */ explicit SplineBuilder2D( - vals_domain_type const& vals_domain, + batched_interpolation_domain_type const& batched_interpolation_domain, std::optional cols_per_chunk = std::nullopt, std::optional preconditionner_max_block_size = std::nullopt) - : m_spline_builder1(vals_domain, cols_per_chunk, preconditionner_max_block_size) + : m_spline_builder1( + batched_interpolation_domain, + cols_per_chunk, + preconditionner_max_block_size) , m_spline_builder_deriv1(ddc::replace_dim_of( - m_spline_builder1.vals_domain(), + m_spline_builder1.batched_interpolation_domain(), ddc::DiscreteDomain( ddc::DiscreteElement(1), ddc::DiscreteVector(bsplines_type2::degree() / 2)))) , m_spline_builder2( - m_spline_builder1.spline_domain(), + m_spline_builder1.batched_spline_domain(), cols_per_chunk, preconditionner_max_block_size) { @@ -200,9 +210,9 @@ class SplineBuilder2D */ SplineBuilder2D& operator=(SplineBuilder2D&& x) = default; - vals_domain_type vals_domain() const noexcept + batched_interpolation_domain_type batched_interpolation_domain() const noexcept { - return m_spline_builder1.vals_domain(); + return m_spline_builder1.batched_interpolation_domain(); } /** @@ -222,7 +232,7 @@ class SplineBuilder2D batch_domain_type batch_domain() const noexcept { - return ddc::remove_dims_of(vals_domain(), interpolation_domain()); + return ddc::remove_dims_of(batched_interpolation_domain(), interpolation_domain()); } /** @@ -233,7 +243,7 @@ class SplineBuilder2D * * @return The 2D domain for the splines. */ - ddc::DiscreteDomain bsplines_domain() + ddc::DiscreteDomain spline_domain() const noexcept // TODO : clarify name { return ddc::DiscreteDomain( @@ -241,13 +251,13 @@ class SplineBuilder2D ddc::discrete_space().full_domain()); } - spline_domain_type spline_domain() const noexcept + batched_spline_domain_type batched_spline_domain() const noexcept { return ddc::replace_dim_of( ddc::replace_dim_of< interpolation_mesh_type2, - bsplines_type2>(vals_domain(), bsplines_domain()), - bsplines_domain()); + bsplines_type2>(batched_interpolation_domain(), spline_domain()), + spline_domain()); } /** @@ -288,39 +298,56 @@ class SplineBuilder2D */ template void operator()( - ddc::ChunkSpan spline, - ddc::ChunkSpan vals, - std::optional< - ddc::ChunkSpan> const - derivs_min1 + ddc::ChunkSpan spline, + ddc::ChunkSpan + vals, + std::optional> const derivs_min1 = std::nullopt, - std::optional< - ddc::ChunkSpan> const - derivs_max1 + std::optional> const derivs_max1 = std::nullopt, - std::optional< - ddc::ChunkSpan> const - derivs_min2 + std::optional> const derivs_min2 = std::nullopt, - std::optional< - ddc::ChunkSpan> const - derivs_max2 + std::optional> const derivs_max2 = std::nullopt, - std::optional< - ddc::ChunkSpan> const - mixed_derivs_min1_min2 + std::optional> const mixed_derivs_min1_min2 = std::nullopt, - std::optional< - ddc::ChunkSpan> const - mixed_derivs_max1_min2 + std::optional> const mixed_derivs_max1_min2 = std::nullopt, - std::optional< - ddc::ChunkSpan> const - mixed_derivs_min1_max2 + std::optional> const mixed_derivs_min1_max2 = std::nullopt, - std::optional< - ddc::ChunkSpan> const - mixed_derivs_max1_max2 + std::optional> const mixed_derivs_max1_max2 = std::nullopt) const; }; @@ -353,29 +380,53 @@ void SplineBuilder2D< Solver, IDimX...>:: operator()( - ddc::ChunkSpan spline, - ddc::ChunkSpan vals, - std::optional> const - derivs_min1, - std::optional> const - derivs_max1, - std::optional> const - derivs_min2, - std::optional> const - derivs_max2, - std::optional> const - mixed_derivs_min1_min2, - std::optional> const - mixed_derivs_max1_min2, - std::optional> const - mixed_derivs_min1_max2, - std::optional> const - mixed_derivs_max1_max2) const + ddc::ChunkSpan spline, + ddc::ChunkSpan vals, + std::optional> const derivs_min1, + std::optional> const derivs_max1, + std::optional> const derivs_min2, + std::optional> const derivs_max2, + std::optional> const mixed_derivs_min1_min2, + std::optional> const mixed_derivs_max1_min2, + std::optional> const mixed_derivs_min1_max2, + std::optional> const mixed_derivs_max1_max2) const { // TODO: perform computations along dimension 1 on different streams ? // Spline1-transform derivs_min2 (to spline1_deriv_min) ddc::Chunk spline1_deriv_min_alloc( - m_spline_builder_deriv1.spline_domain(), + m_spline_builder_deriv1.batched_spline_domain(), ddc::KokkosAllocator()); auto spline1_deriv_min = spline1_deriv_min_alloc.span_view(); auto spline1_deriv_min_opt = std::optional(spline1_deriv_min.span_cview()); @@ -391,7 +442,7 @@ operator()( // Spline1-transform vals (to spline1) ddc::Chunk spline1_alloc( - m_spline_builder1.spline_domain(), + m_spline_builder1.batched_spline_domain(), ddc::KokkosAllocator()); ddc::ChunkSpan spline1 = spline1_alloc.span_view(); @@ -399,7 +450,7 @@ operator()( // Spline1-transform derivs_max2 (to spline1_deriv_max) ddc::Chunk spline1_deriv_max_alloc( - m_spline_builder_deriv1.spline_domain(), + m_spline_builder_deriv1.batched_spline_domain(), ddc::KokkosAllocator()); auto spline1_deriv_max = spline1_deriv_max_alloc.span_view(); auto spline1_deriv_max_opt = std::optional(spline1_deriv_max.span_cview()); From c0ef4587d7d7510671f0d53815b0d7071bfafe89 Mon Sep 17 00:00:00 2001 From: blegouix Date: Thu, 18 Apr 2024 14:51:08 +0200 Subject: [PATCH 20/89] reinit --- .../kernels/splines/bsplines_non_uniform.hpp | 102 +++++++- .../ddc/kernels/splines/bsplines_uniform.hpp | 115 ++++++++- .../ddc/kernels/splines/spline_builder.hpp | 236 +++++------------- .../ddc/kernels/splines/spline_builder_2d.hpp | 179 +++++-------- 4 files changed, 330 insertions(+), 302 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index 0715564d7..20e6ca2d7 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -24,44 +24,55 @@ struct NonUniformBSplinesBase { }; -/// NonUniformPointSampling specialization of BSplines +/** + * The type of a non-uniform BSplines 1D basis. + * + * @tparam Tag The tag identifying the continuous dimension which supports the building of the BSplines. + * @tparam D The degree of the BSplines. + */ template class NonUniformBSplines : NonUniformBSplinesBase { static_assert(D > 0, "Parameter `D` must be positive"); public: + /// @brief The tag identifying the continuous dimension which supports the building of the BSplines. using tag_type = Tag; - + /// @brief The discrete dimension corresponding to BSplines. using discrete_dimension_type = NonUniformBSplines; -public: + /// @brief The rank. static constexpr std::size_t rank() { return 1; } + /// @brief The degree of BSplines. static constexpr std::size_t degree() noexcept { return D; } + /// @brief Indicates if the BSplines are periodic or not. static constexpr bool is_periodic() noexcept { return Tag::PERIODIC; } + /// @brief Indicates if the BSplines are radial or not (should be deprecated soon because this concept is not in the scope of DDC). static constexpr bool is_radial() noexcept { return false; } + /// @brief Indicates if the BSplines are uniform or not (this is obviously the case here). static constexpr bool is_uniform() noexcept { return false; } + /// @brief Impl template class Impl { @@ -76,12 +87,16 @@ class NonUniformBSplines : NonUniformBSplinesBase int m_nknots; public: + /// @brief The type of discrete dimension associated to BSplines. using discrete_dimension_type = NonUniformBSplines; + /// @brief The type of discrete domain indexing the BSplines. using discrete_domain_type = DiscreteDomain; + /// @brief The type of discrete element indexing a BSpline. using discrete_element_type = DiscreteElement; + /// @brief The type of discrete vector representing an "indexes displacement" between two BSplines. using discrete_vector_type = DiscreteVector; Impl() = default; @@ -109,49 +124,97 @@ class NonUniformBSplines : NonUniformBSplinesBase template Impl(RandomIt breaks_begin, RandomIt breaks_end); + /// @brief Copy-constructs Impl(Impl const& x) = default; + /// @brief Move-constructs Impl(Impl&& x) = default; + /// @brief Destructs ~Impl() = default; + /// @brief Copy-assigns Impl& operator=(Impl const& x) = default; + /// @brief Move-assigns Impl& operator=(Impl&& x) = default; + /** @brief Evaluates BSplines at a given coordinate + * + * The values are computed for every BSplines at the given coordinate x. A spline approximation at coordinate x is a linear combination of those BSplines evaluations weigthed with splines coefficients of the spline-transformed initial discrete function. + * @param[out] values The values of the BSplines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. + * @param[in] x The coordinates where BSplines are evaluated. + */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis(DSpan1D values, ddc::Coordinate const& x) const; + /** @brief Evaluates BSplines derivatives at a given coordinate + * + * The derivatives are computed for every BSplines at the given coordinate x. A spline approximation of a derivative at coordinate x is a linear combination of those BSplines derivatives weigthed with splines coefficients of the spline-transformed initial discrete function. + * @param[out] derivs The derivatives of the BSplines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. + * @param[in] x The coordinates where BSplines derivatives are evaluated. + */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_deriv(DSpan1D derivs, ddc::Coordinate const& x) const; + /** @brief Evaluates BSplines values and n derivatives at a given coordinate + * + * The values and derivatives are computed for every BSplines at the given coordinate x. + * @param[out] derivs The values and n derivatives of the BSplines evaluated at coordinate x. It has to be a (1+degree)*(1+n) 2D mdspan. + * @param[in] x The coordinates where BSplines derivatives are evaluated. + * @param[in] n The number of derivatives to evaluate (in addition to the BSplines values themselves). + */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis_and_n_derivs( ddc::DSpan2D derivs, ddc::Coordinate const& x, std::size_t n) const; + /** @brief Compute the integrals of the bsplines + * + * @param[out] int_vals The values of the integrals. It has to be a (1+nbasis) 1D mdspan. + */ template KOKKOS_INLINE_FUNCTION ddc::ChunkSpan integrals( ddc::ChunkSpan int_vals) const; + /** @brief Returns the coordinate of the knot corresponding to the given index for a BSpline. + * + * @param[in] idx Integer identifying index of the knot. + * @return Coordinate of the knot. + */ KOKKOS_INLINE_FUNCTION ddc::Coordinate get_knot(int knot_idx) const noexcept { return ddc::coordinate(ddc::DiscreteElement(knot_idx + degree())); } + /** @brief Returns the first support knot associated to a discrete_element identifying a BSpline. + * + * @param[in] ix Index of the BSpline. + * @return Coordinate of the knot. + */ KOKKOS_INLINE_FUNCTION ddc::Coordinate get_first_support_knot( discrete_element_type const& ix) const { return ddc::coordinate(ddc::DiscreteElement(ix.uid())); } + /** @brief Returns the last support knot associated to a discrete_element identifying a BSpline. + * + * @param[in] ix Index of the BSpline. + * @return Coordinate of the knot. + */ KOKKOS_INLINE_FUNCTION ddc::Coordinate get_last_support_knot( discrete_element_type const& ix) const { return ddc::coordinate(ddc::DiscreteElement(ix.uid() + degree() + 1)); } + /** @brief Returns the n-th knot associated to a discrete_element identifying a BSpline. + * + * @param[in] ix Index of the BSpline. + * @param[in] n Integer identifying a knot in the support of the BSpline. + */ KOKKOS_INLINE_FUNCTION ddc::Coordinate get_support_knot_n( discrete_element_type const& ix, int n) const @@ -159,42 +222,73 @@ class NonUniformBSplines : NonUniformBSplinesBase return ddc::coordinate(ddc::DiscreteElement(ix.uid() + n)); } + /** @brief Returns the coordinate of the lower boundary BSpline. + * + * @return Coordinate of the lower boundary BSpline. + */ KOKKOS_INLINE_FUNCTION ddc::Coordinate rmin() const noexcept { return get_knot(0); } + /** @brief Returns the coordinate of the upper boundary BSpline. + * + * @return Coordinate of the upper boundary BSpline. + */ KOKKOS_INLINE_FUNCTION ddc::Coordinate rmax() const noexcept { return get_knot(ncells()); } + /** @brief TODO + * + * @return TODO. + */ KOKKOS_INLINE_FUNCTION double length() const noexcept { return rmax() - rmin(); } + /** @brief TODO + * + * @return TODO. + */ KOKKOS_INLINE_FUNCTION std::size_t size() const noexcept { return degree() + ncells(); } - /// Returns the discrete domain including ghost bsplines + /** @brief Returns the discrete domain including ghost bsplines + * + * @return The discrete domain including ghost bsplines. + */ KOKKOS_INLINE_FUNCTION discrete_domain_type full_domain() const { return discrete_domain_type(discrete_element_type(0), discrete_vector_type(size())); } + /** @brief TODO + * + * @return TODO + */ KOKKOS_INLINE_FUNCTION std::size_t npoints() const noexcept { return m_nknots - 2 * degree(); } + /** @brief TODO + * + * @return TODO + */ KOKKOS_INLINE_FUNCTION std::size_t nbasis() const noexcept { return ncells() + !is_periodic() * degree(); } + /** @brief TODO + * + * @return TODO + */ KOKKOS_INLINE_FUNCTION std::size_t ncells() const noexcept { return npoints() - 1; diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index c654e482a..e12adf956 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -24,43 +24,55 @@ struct UniformBSplinesBase { }; +/** + * The type of a uniform BSplines 1D basis. + * + * @tparam Tag The tag identifying the continuous dimension which supports the building of the BSplines. + * @tparam D The degree of the BSplines. + */ template class UniformBSplines : UniformBSplinesBase { static_assert(D > 0, "Parameter `D` must be positive"); public: + /// @brief The tag identifying the continuous dimension which supports the building of the BSplines. using tag_type = Tag; - + /// @brief The discrete dimension corresponding to BSplines. using discrete_dimension_type = UniformBSplines; -public: + /// @brief The rank. static constexpr std::size_t rank() { return 1; } + /// @brief The degree of BSplines. static constexpr std::size_t degree() noexcept { return D; } + /// @brief Indicates if the BSplines are periodic or not. static constexpr bool is_periodic() noexcept { return Tag::PERIODIC; } + /// @brief Indicates if the BSplines are radial or not (should be deprecated soon because this concept is not in the scope of DDC). static constexpr bool is_radial() noexcept { return false; } + /// @brief Indicates if the BSplines are uniform or not (this is obviously the case here). static constexpr bool is_uniform() noexcept { return true; } + /// @brief Impl template class Impl { @@ -74,20 +86,19 @@ class UniformBSplines : UniformBSplinesBase ddc::DiscreteDomain m_domain; public: + /// @brief The type of discrete dimension associated to BSplines. using discrete_dimension_type = UniformBSplines; + /// @brief The type of discrete domain indexing the BSplines. using discrete_domain_type = DiscreteDomain; + /// @brief The type of discrete element indexing a BSpline. using discrete_element_type = DiscreteElement; + /// @brief The type of discrete vector representing an "indexes displacement" between two BSplines. using discrete_vector_type = DiscreteVector; - Impl() = default; - - template - explicit Impl(Impl const& impl) : m_domain(impl.m_domain) - { - } + Impl() = default; /** Constructs a BSpline basis with n equidistant knots over \f$[a, b]\f$ * @@ -107,16 +118,33 @@ class UniformBSplines : UniformBSplinesBase mesh_type>(rmin, rmax, ddc::DiscreteVector(ncells + 1))); } + /// @brief Copy-constructs from another impl with different Kokkos memory space + template + explicit Impl(Impl const& impl) : m_domain(impl.m_domain) + { + } + + /// @brief Copy-constructs Impl(Impl const& x) = default; + /// @brief Move-constructs Impl(Impl&& x) = default; + /// @brief Destructs ~Impl() = default; + /// @brief Copy-assigns Impl& operator=(Impl const& x) = default; + /// @brief Move-assigns Impl& operator=(Impl&& x) = default; + /** @brief Evaluates BSplines at a given coordinate + * + * The values are computed for every BSplines at the given coordinate x. A spline approximation at coordinate x is a linear combination of those BSplines evaluations weigthed with splines coefficients of the spline-transformed initial discrete function. + * @param[out] values The values of the BSplines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. + * @param[in] x The coordinates where BSplines are evaluated. + */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis(DSpan1D values, ddc::Coordinate const& x) const { @@ -124,71 +152,135 @@ class UniformBSplines : UniformBSplinesBase return eval_basis(values, x, degree()); } + /** @brief Evaluates BSplines derivatives at a given coordinate + * + * The derivatives are computed for every BSplines at the given coordinate x. A spline approximation of a derivative at coordinate x is a linear combination of those BSplines derivatives weigthed with splines coefficients of the spline-transformed initial discrete function. + * @param[out] derivs The derivatives of the BSplines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. + * @param[in] x The coordinates where BSplines derivatives are evaluated. + */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_deriv(DSpan1D derivs, ddc::Coordinate const& x) const; + /** @brief Evaluates BSplines values and n derivatives at a given coordinate + * + * The values and derivatives are computed for every BSplines at the given coordinate x. + * @param[out] derivs The values and n derivatives of the BSplines evaluated at coordinate x. It has to be a (1+degree)*(1+n) 2D mdspan. + * @param[in] x The coordinates where BSplines derivatives are evaluated. + * @param[in] n The number of derivatives to evaluate (in addition to the BSplines values themselves). + */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis_and_n_derivs( ddc::DSpan2D derivs, ddc::Coordinate const& x, std::size_t n) const; + /** @brief Compute the integrals of the bsplines + * + * @param[out] int_vals The values of the integrals. It has to be a (1+nbasis) 1D mdspan. + */ template KOKKOS_INLINE_FUNCTION ddc::ChunkSpan integrals( ddc::ChunkSpan int_vals) const; + /** @brief Returns the coordinate of the knot corresponding to the given index for a BSpline. + * + * @param[in] idx Integer identifying index of the knot. + * @return Coordinate of the knot. + */ KOKKOS_INLINE_FUNCTION ddc::Coordinate get_knot(int idx) const noexcept { return ddc::Coordinate(rmin() + idx * ddc::step()); } + /** @brief Returns the first support knot associated to a discrete_element identifying a BSpline. + * + * @param[in] ix Index of the BSpline. + * @return Coordinate of the knot. + */ KOKKOS_INLINE_FUNCTION double get_first_support_knot(discrete_element_type const& ix) const { return get_knot(ix.uid() - degree()); } + /** @brief Returns the last support knot associated to a discrete_element identifying a BSpline. + * + * @param[in] ix Index of the BSpline. + * @return Coordinate of the knot. + */ KOKKOS_INLINE_FUNCTION double get_last_support_knot(discrete_element_type const& ix) const { return get_knot(ix.uid() + 1); } + /** @brief Returns the n-th knot associated to a discrete_element identifying a BSpline. + * + * @param[in] ix Index of the BSpline. + * @param[in] n Integer identifying a knot in the support of the BSpline. + */ KOKKOS_INLINE_FUNCTION double get_support_knot_n(discrete_element_type const& ix, int n) const { return get_knot(ix.uid() + n - degree()); } + /** @brief Returns the coordinate of the lower boundary BSpline. + * + * @return Coordinate of the lower boundary BSpline. + */ KOKKOS_INLINE_FUNCTION ddc::Coordinate rmin() const noexcept { return ddc::coordinate(m_domain.front()); } + /** @brief Returns the coordinate of the upper boundary BSpline. + * + * @return Coordinate of the upper boundary BSpline. + */ KOKKOS_INLINE_FUNCTION ddc::Coordinate rmax() const noexcept { return ddc::coordinate(m_domain.back()); } + /** @brief TODO + * + * @return TODO. + */ KOKKOS_INLINE_FUNCTION double length() const noexcept { return rmax() - rmin(); } + /** @brief TODO + * + * @return TODO. + */ KOKKOS_INLINE_FUNCTION std::size_t size() const noexcept { return degree() + ncells(); } - /// Returns the discrete domain including ghost bsplines + /** @brief Returns the discrete domain including ghost bsplines + * + * @return The discrete domain including ghost bsplines. + */ KOKKOS_INLINE_FUNCTION discrete_domain_type full_domain() const { return discrete_domain_type(discrete_element_type(0), discrete_vector_type(size())); } + /** @brief TODO + * + * @return TODO + */ KOKKOS_INLINE_FUNCTION std::size_t nbasis() const noexcept { return ncells() + !is_periodic() * degree(); } + /** @brief TODO + * + * @return TODO + */ KOKKOS_INLINE_FUNCTION std::size_t ncells() const noexcept { return m_domain.size() - 1; @@ -215,6 +307,11 @@ struct is_uniform_bsplines : public std::is_base_of { }; +/** + * @brief Indicates if a dimension representing BSplines corresponds to uniform BSplines of not. + * + * @tparam The discrete dimension associated to BSplines + */ template constexpr bool is_uniform_bsplines_v = is_uniform_bsplines::value; diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index 7c1824d69..e30e87b23 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -10,24 +10,10 @@ #include "deriv.hpp" namespace ddc { +enum class SplineSolver { + GINKGO +}; // Only GINKGO available atm, other solvers will be implemented in the futur -/** - * @brief An enum determining the backend solver of a SplineBuilder or SplineBuilder2d. - * - * An enum determining the backend solver of a SplineBuilder or SplineBuilder2d. Only GINKGO available at the moment, - * other solvers will be implemented in the futur. - */ -enum class SplineSolver { GINKGO }; - -/** - * @brief An helper giving the uniform/non_uniform status of a spline interpolation mesh according to its attributes. - * - * An helper giving the uniform/non_uniform status of a spline interpolation mesh according to its attributes. - * @param is_uniform A boolean giving the presumed status before considering boundary conditions. - * @param BcXmin The lower boundary condition. - * @param BcXmax The upper boundary condition. - * @param int The degree of the spline. - */ constexpr bool is_spline_interpolation_mesh_uniform( bool const is_uniform, ddc::BoundCond const BcXmin, @@ -48,14 +34,6 @@ constexpr bool is_spline_interpolation_mesh_uniform( * 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. - * @tparam ExecSpace The Kokkos execution space on which the spline transform is performed. - * @tparam MemorySpace The Kokkos memory space on which the data (interpolation function and splines coefficients) are stored. - * @tparam BSplines The discrete dimension representing the BSplines. - * @tparam InterpolationMesh The discrete dimension supporting the interpolation points. - * @tparam BcXmin The lower boundary condition. - * @tparam BcXmax The upper boundary condition. - * @tparam Solver The SplineSolver giving the backend used to perform the spline transform. - * @tparam IDimX A variadic template of all the discrete dimensions forming the full space (InterpolationMesh + batched dimensions). */ template < class ExecSpace, @@ -79,79 +57,52 @@ class SplineBuilder using tag_type = typename InterpolationMesh::continuous_dimension_type; public: - /** - * @brief The type of the Kokkos execution space used by this class. - */ using exec_space = ExecSpace; - /** - * @brief The type of the Kokkos memory space used by this class. - */ using memory_space = MemorySpace; /** - * @brief The type of the interpolation discrete dimension (discrete dimension of interest) used by this class. + * @brief The type of the interpolation mesh used by this class. */ using interpolation_mesh_type = InterpolationMesh; /** - * @brief The discrete dimension representing the BSplines. + * @brief The type of the BSplines which are compatible with this class. */ using bsplines_type = BSplines; - /** - * @brief The Deriv dimension at the boundaries. - */ using deriv_type = ddc::Deriv; /** - * @brief The type of the domain for the 1D interpolation mesh used by this class. + * @brief The type of the domain for the interpolation mesh used by this class. */ using interpolation_domain_type = ddc::DiscreteDomain; - /** - * @brief The type of the whole domain representing interpolation points. - */ - using batched_interpolation_domain_type = ddc::DiscreteDomain; + using vals_domain_type = ddc::DiscreteDomain; - /** - * @brief The type of the batch domain (obtained by removing dimension of interest from whole space). - */ using batch_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq>>; - /** - * @brief Helper to get the dimension of batched_spline_domain_type associated to a dimension of batched_interpolation_domain_type. - */ template using spline_dim_type = std::conditional_t, bsplines_type, Tag>; - /** - * @brief The type of the whole spline domain (cartesian product of 1D spline domain and batch domain) preserving the underlying memory layout (order of dimensions). - */ - using batched_spline_domain_type = + using spline_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, ddc::detail::TypeSeq>>; - /** - * @brief The type of the whole spline domain (cartesian product of 1D spline domain and batch domain) with 1D spline domain being contiguous . - */ - using batched_spline_tr_domain_type = + using spline_tr_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::type_seq_remove_t< ddc::detail::TypeSeq, ddc::detail::TypeSeq>>>; - /** - * @brief The type of the whole Derivs domain (cartesian product of 1D Deriv domain and batch domain) preserving the underlying memory layout (order of dimensions). - */ - using batched_derivs_domain_type = + using derivs_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, @@ -163,12 +114,12 @@ class SplineBuilder static constexpr bool s_odd = BSplines::degree() % 2; /** - * @brief The number of equations defining the boundary conditions at the lower bound. + * @brief The number of equations which define the boundary conditions at the lower bound. */ static constexpr int s_nbe_xmin = n_boundary_equations(BcXmin, BSplines::degree()); /** - * @brief The number of equations defining the boundary conditions at the upper bound. + * @brief The number of equations which define the boundary conditions at the upper bound. */ static constexpr int s_nbe_xmax = n_boundary_equations(BcXmax, BSplines::degree()); @@ -201,7 +152,7 @@ class SplineBuilder static constexpr ddc::BoundCond s_bc_xmax = BcXmax; private: - batched_interpolation_domain_type m_batched_interpolation_domain; + vals_domain_type m_vals_domain; int m_offset; @@ -211,22 +162,13 @@ class SplineBuilder std::unique_ptr matrix; public: - /** - * @brief An helper to compute the offset. - */ int compute_offset(interpolation_domain_type const& interpolation_domain); - /** - * @brief Build a SplineBuilder acting on batched_interpolation_domain. - * - * @param batched_interpolation_domain The domain on which are defined the interpolation points. - * @param cols_per_chunk An hyperparameter used by the slicer (internal to the solver) to define the size of a chunk of right-and-sides of the linear problem to be computed in parallel. - */ explicit SplineBuilder( - batched_interpolation_domain_type const& batched_interpolation_domain, + vals_domain_type const& vals_domain, std::optional cols_per_chunk = std::nullopt, std::optional preconditionner_max_block_size = std::nullopt) - : m_batched_interpolation_domain(batched_interpolation_domain) + : m_vals_domain(vals_domain) , m_offset(compute_offset(interpolation_domain())) , m_dx((ddc::discrete_space().rmax() - ddc::discrete_space().rmin()) / ddc::discrete_space().ncells()) @@ -249,123 +191,88 @@ class SplineBuilder preconditionner_max_block_size); } - /// @brief Copy-constructor is deleted SplineBuilder(SplineBuilder const& x) = delete; - /// @brief Move-constructs + /** + * @brief Create a new SplineBuilder by copy + * + * @param x The SplineBuilder being copied. + */ SplineBuilder(SplineBuilder&& x) = default; - /// @brief Destructs ~SplineBuilder() = default; - /// @brief Copy-assignment is deleted SplineBuilder& operator=(SplineBuilder const& x) = delete; - /// @brief Move-assigns - SplineBuilder& operator=(SplineBuilder&& x) = default; - /** - * @brief Get the domain for the 1D interpolation mesh used by this class. + * @brief Copy a SplineBuilder. * - * Get the 1D interpolation domain associated to dimension of interest. - * - * @return The 1D domain for the grid points. + * @param x The SplineBuilder being copied. + * @returns A reference to this object. */ - interpolation_domain_type interpolation_domain() const noexcept + SplineBuilder& operator=(SplineBuilder&& x) = default; + + vals_domain_type vals_domain() const noexcept { - return interpolation_domain_type(m_batched_interpolation_domain); + return m_vals_domain; } /** - * @brief Get the whole domain representing interpolation points. + * @brief 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 transform of the function. + * to build a spline approximation of the function. * * @return The domain for the grid points. */ - batched_interpolation_domain_type batched_interpolation_domain() const noexcept + interpolation_domain_type interpolation_domain() const noexcept { - return m_batched_interpolation_domain; + return interpolation_domain_type(vals_domain()); } - /** - * @brief Get the batch domain. - * - * Get the batch domain (obtained by removing dimension of interest from whole interpolation domain). - * - * @return The batch domain. - */ batch_domain_type batch_domain() const noexcept { - return ddc::remove_dims_of(batched_interpolation_domain(), interpolation_domain()); + return ddc::remove_dims_of(vals_domain(), interpolation_domain()); } - /** - * @brief Get the 1D domain on which spline coefficients are defined. - * - * Get the 1D spline domain corresponding to dimension of interest. - * - * @return The 1D domain for the spline coefficients. - */ - ddc::DiscreteDomain spline_domain() const noexcept + ddc::DiscreteDomain bsplines_domain() const noexcept // TODO : clarify name { return ddc::discrete_space().full_domain(); } /** - * @brief Get the whole domain on which spline coefficients are defined, preserving memory layout. + * @brief Get the domain on which the approximation is defined. * - * Get the whole domain on which spline coefficients will be computed, preserving memory layout (order of dimensions). + * Get the domain of the basis-splines for which the coefficients of the spline + * approximation must be calculated. * - * @return The domain for the spline coefficients. + * @return The domain for the splines. */ - batched_spline_domain_type batched_spline_domain() const noexcept + spline_domain_type spline_domain() const noexcept { return ddc::replace_dim_of< interpolation_mesh_type, - bsplines_type>(batched_interpolation_domain(), spline_domain()); + bsplines_type>(vals_domain(), bsplines_domain()); } - /** - * @brief Get the whole domain on which spline coefficients are defined, with dimension of interest contiguous. - * - * Get the (transposed) whole domain on which spline coefficients will be computed, with dimension of interest contiguous. - * - * @return The (transposed) domain for the spline coefficients. - */ - batched_spline_tr_domain_type batched_spline_tr_domain() const noexcept + spline_tr_domain_type spline_tr_domain() const noexcept { - return batched_spline_tr_domain_type(spline_domain(), batch_domain()); + return spline_tr_domain_type(bsplines_domain(), batch_domain()); } - /** - * @brief Get the whole domain on which derivatives on lower boundary are defined. - * - * Get the whole domain on which derivatives on lower boundary are defined. This is used only with HERMITE boundary conditions. - * - * @return The domain for the Derivs values. - */ - batched_derivs_domain_type batched_derivs_xmin_domain() const noexcept + derivs_domain_type derivs_xmin_domain() const noexcept { return ddc::replace_dim_of( - batched_interpolation_domain(), + vals_domain(), ddc::DiscreteDomain( ddc::DiscreteElement(1), ddc::DiscreteVector(s_nbc_xmin))); } - /** - * @brief Get the whole domain on which derivatives on upper boundary are defined. - * - * Get the whole domain on which derivatives on upper boundary are defined. This is used only with HERMITE boundary conditions. - * - * @return The domain for the Derivs values. - */ - batched_derivs_domain_type batched_derivs_xmax_domain() const noexcept + derivs_domain_type derivs_xmax_domain() const noexcept { return ddc::replace_dim_of( - batched_interpolation_domain(), + vals_domain(), ddc::DiscreteDomain( ddc::DiscreteElement(1), ddc::DiscreteVector(s_nbc_xmax))); @@ -376,10 +283,6 @@ class SplineBuilder * * Get the interpolation matrix. This can be useful for debugging (as it allows * one to print the matrix) or for more complex quadrature schemes. - * - * Warning: the returned ddc::detail::Matrix class is not supposed to be exposed - * to user, which means its usage is not tested out of the scope of DDC splines transforms. - * Use at your own risk. * * @return A reference to the interpolation matrix. */ @@ -401,27 +304,20 @@ class SplineBuilder * * @param[out] spline The coefficients of the spline calculated by the function. * @param[in] vals The values of the function at the grid points. - * @param[in] derivs_xmin The values of the derivatives at the lower boundary - * (used only with HERMITE lower boundary condition). - * @param[in] derivs_xmax The values of the derivatives at the upper boundary - * (used only with HERMITE upper boundary condition). + * @param[in] derivs_xmin The values of the derivatives at the lower boundary. + * @param[in] derivs_xmax The values of the derivatives at the upper boundary. */ template void operator()( - ddc::ChunkSpan spline, - ddc::ChunkSpan - vals, - std::optional> const derivs_xmin + ddc::ChunkSpan spline, + ddc::ChunkSpan vals, + std::optional< + ddc::ChunkSpan> const + derivs_xmin = std::nullopt, - std::optional> const derivs_xmax + std::optional< + ddc::ChunkSpan> const + derivs_xmax = std::nullopt) const; private: @@ -742,18 +638,12 @@ void SplineBuilder< Solver, IDimX...>:: operator()( - ddc::ChunkSpan spline, - ddc::ChunkSpan vals, - std::optional> const derivs_xmin, - std::optional> const derivs_xmax) const + ddc::ChunkSpan spline, + ddc::ChunkSpan vals, + std::optional> const + derivs_xmin, + std::optional> const + derivs_xmax) const { assert(vals.template extent() == ddc::discrete_space().nbasis() - s_nbe_xmin - s_nbe_xmax); @@ -828,9 +718,7 @@ operator()( // TODO : Consider optimizing // Allocate and fill a transposed version of spline in order to get dimension of interest as last dimension (optimal for GPU, necessary for Ginkgo) - ddc::Chunk spline_tr_alloc( - batched_spline_tr_domain(), - ddc::KokkosAllocator()); + ddc::Chunk spline_tr_alloc(spline_tr_domain(), ddc::KokkosAllocator()); ddc::ChunkSpan spline_tr = spline_tr_alloc.span_view(); ddc::parallel_for_each( exec_space(), diff --git a/include/ddc/kernels/splines/spline_builder_2d.hpp b/include/ddc/kernels/splines/spline_builder_2d.hpp index 872bf2956..372954e96 100644 --- a/include/ddc/kernels/splines/spline_builder_2d.hpp +++ b/include/ddc/kernels/splines/spline_builder_2d.hpp @@ -87,14 +87,7 @@ class SplineBuilder2D */ using bsplines_type2 = typename builder_type2::bsplines_type; - /** - * @brief The type of the Deriv domain on boundaries in the first dimension which are compatible with this class. - */ using deriv_type1 = typename builder_type1::deriv_type; - - /** - * @brief The type of the Deriv domain on boundaries in the second dimension which are compatible with this class. - */ using deriv_type2 = typename builder_type2::deriv_type; /** @@ -120,26 +113,26 @@ class SplineBuilder2D using interpolation_domain_type = ddc::DiscreteDomain; - using batched_interpolation_domain_type = ddc::DiscreteDomain; + using vals_domain_type = ddc::DiscreteDomain; using batch_domain_type = ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq>>; - using batched_spline_domain_type + using spline_domain_type = ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, ddc::detail::TypeSeq>>; - using batched_derivs_domain_type1 = typename builder_type1::batched_derivs_domain_type; - using batched_derivs_domain_type2 + using derivs_domain_type1 = typename builder_type1::derivs_domain_type; + using derivs_domain_type2 = ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, ddc::detail::TypeSeq>>; - using batched_derivs_domain_type + using derivs_domain_type = ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, @@ -154,27 +147,24 @@ class SplineBuilder2D /** * @brief Create a new SplineBuilder2D. * - * @param batched_interpolation_domain + * @param vals_domain * The 2D domain on which points will be provided in order to * create the 2D spline approximation. * @param cols_per_chunk The number of columns in the rhs passed to the underlying linear solver. * @param preconditionner_max_block_size The block size of in the block Jacobi preconditioner. */ explicit SplineBuilder2D( - batched_interpolation_domain_type const& batched_interpolation_domain, + vals_domain_type const& vals_domain, std::optional cols_per_chunk = std::nullopt, std::optional preconditionner_max_block_size = std::nullopt) - : m_spline_builder1( - batched_interpolation_domain, - cols_per_chunk, - preconditionner_max_block_size) + : m_spline_builder1(vals_domain, cols_per_chunk, preconditionner_max_block_size) , m_spline_builder_deriv1(ddc::replace_dim_of( - m_spline_builder1.batched_interpolation_domain(), + m_spline_builder1.vals_domain(), ddc::DiscreteDomain( ddc::DiscreteElement(1), ddc::DiscreteVector(bsplines_type2::degree() / 2)))) , m_spline_builder2( - m_spline_builder1.batched_spline_domain(), + m_spline_builder1.spline_domain(), cols_per_chunk, preconditionner_max_block_size) { @@ -210,9 +200,9 @@ class SplineBuilder2D */ SplineBuilder2D& operator=(SplineBuilder2D&& x) = default; - batched_interpolation_domain_type batched_interpolation_domain() const noexcept + vals_domain_type vals_domain() const noexcept { - return m_spline_builder1.batched_interpolation_domain(); + return m_spline_builder1.vals_domain(); } /** @@ -232,7 +222,7 @@ class SplineBuilder2D batch_domain_type batch_domain() const noexcept { - return ddc::remove_dims_of(batched_interpolation_domain(), interpolation_domain()); + return ddc::remove_dims_of(vals_domain(), interpolation_domain()); } /** @@ -243,7 +233,7 @@ class SplineBuilder2D * * @return The 2D domain for the splines. */ - ddc::DiscreteDomain spline_domain() + ddc::DiscreteDomain bsplines_domain() const noexcept // TODO : clarify name { return ddc::DiscreteDomain( @@ -251,13 +241,13 @@ class SplineBuilder2D ddc::discrete_space().full_domain()); } - batched_spline_domain_type batched_spline_domain() const noexcept + spline_domain_type spline_domain() const noexcept { return ddc::replace_dim_of( ddc::replace_dim_of< interpolation_mesh_type2, - bsplines_type2>(batched_interpolation_domain(), spline_domain()), - spline_domain()); + bsplines_type2>(vals_domain(), bsplines_domain()), + bsplines_domain()); } /** @@ -298,56 +288,39 @@ class SplineBuilder2D */ template void operator()( - ddc::ChunkSpan spline, - ddc::ChunkSpan - vals, - std::optional> const derivs_min1 + ddc::ChunkSpan spline, + ddc::ChunkSpan vals, + std::optional< + ddc::ChunkSpan> const + derivs_min1 = std::nullopt, - std::optional> const derivs_max1 + std::optional< + ddc::ChunkSpan> const + derivs_max1 = std::nullopt, - std::optional> const derivs_min2 + std::optional< + ddc::ChunkSpan> const + derivs_min2 = std::nullopt, - std::optional> const derivs_max2 + std::optional< + ddc::ChunkSpan> const + derivs_max2 = std::nullopt, - std::optional> const mixed_derivs_min1_min2 + std::optional< + ddc::ChunkSpan> const + mixed_derivs_min1_min2 = std::nullopt, - std::optional> const mixed_derivs_max1_min2 + std::optional< + ddc::ChunkSpan> const + mixed_derivs_max1_min2 = std::nullopt, - std::optional> const mixed_derivs_min1_max2 + std::optional< + ddc::ChunkSpan> const + mixed_derivs_min1_max2 = std::nullopt, - std::optional> const mixed_derivs_max1_max2 + std::optional< + ddc::ChunkSpan> const + mixed_derivs_max1_max2 = std::nullopt) const; }; @@ -380,53 +353,29 @@ void SplineBuilder2D< Solver, IDimX...>:: operator()( - ddc::ChunkSpan spline, - ddc::ChunkSpan vals, - std::optional> const derivs_min1, - std::optional> const derivs_max1, - std::optional> const derivs_min2, - std::optional> const derivs_max2, - std::optional> const mixed_derivs_min1_min2, - std::optional> const mixed_derivs_max1_min2, - std::optional> const mixed_derivs_min1_max2, - std::optional> const mixed_derivs_max1_max2) const + ddc::ChunkSpan spline, + ddc::ChunkSpan vals, + std::optional> const + derivs_min1, + std::optional> const + derivs_max1, + std::optional> const + derivs_min2, + std::optional> const + derivs_max2, + std::optional> const + mixed_derivs_min1_min2, + std::optional> const + mixed_derivs_max1_min2, + std::optional> const + mixed_derivs_min1_max2, + std::optional> const + mixed_derivs_max1_max2) const { // TODO: perform computations along dimension 1 on different streams ? // Spline1-transform derivs_min2 (to spline1_deriv_min) ddc::Chunk spline1_deriv_min_alloc( - m_spline_builder_deriv1.batched_spline_domain(), + m_spline_builder_deriv1.spline_domain(), ddc::KokkosAllocator()); auto spline1_deriv_min = spline1_deriv_min_alloc.span_view(); auto spline1_deriv_min_opt = std::optional(spline1_deriv_min.span_cview()); @@ -442,7 +391,7 @@ operator()( // Spline1-transform vals (to spline1) ddc::Chunk spline1_alloc( - m_spline_builder1.batched_spline_domain(), + m_spline_builder1.spline_domain(), ddc::KokkosAllocator()); ddc::ChunkSpan spline1 = spline1_alloc.span_view(); @@ -450,7 +399,7 @@ operator()( // Spline1-transform derivs_max2 (to spline1_deriv_max) ddc::Chunk spline1_deriv_max_alloc( - m_spline_builder_deriv1.batched_spline_domain(), + m_spline_builder_deriv1.spline_domain(), ddc::KokkosAllocator()); auto spline1_deriv_max = spline1_deriv_max_alloc.span_view(); auto spline1_deriv_max_opt = std::optional(spline1_deriv_max.span_cview()); From 56dbf4e0986a108b8558952b7b58b127471ceeec Mon Sep 17 00:00:00 2001 From: blegouix Date: Thu, 18 Apr 2024 14:53:06 +0200 Subject: [PATCH 21/89] remove bsplines (not in the scope of this MR anymore) --- .../kernels/splines/bsplines_non_uniform.hpp | 102 +--------------- .../ddc/kernels/splines/bsplines_uniform.hpp | 115 ++---------------- 2 files changed, 13 insertions(+), 204 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index 20e6ca2d7..0715564d7 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -24,55 +24,44 @@ struct NonUniformBSplinesBase { }; -/** - * The type of a non-uniform BSplines 1D basis. - * - * @tparam Tag The tag identifying the continuous dimension which supports the building of the BSplines. - * @tparam D The degree of the BSplines. - */ +/// NonUniformPointSampling specialization of BSplines template class NonUniformBSplines : NonUniformBSplinesBase { static_assert(D > 0, "Parameter `D` must be positive"); public: - /// @brief The tag identifying the continuous dimension which supports the building of the BSplines. using tag_type = Tag; - /// @brief The discrete dimension corresponding to BSplines. + using discrete_dimension_type = NonUniformBSplines; - /// @brief The rank. +public: static constexpr std::size_t rank() { return 1; } - /// @brief The degree of BSplines. static constexpr std::size_t degree() noexcept { return D; } - /// @brief Indicates if the BSplines are periodic or not. static constexpr bool is_periodic() noexcept { return Tag::PERIODIC; } - /// @brief Indicates if the BSplines are radial or not (should be deprecated soon because this concept is not in the scope of DDC). static constexpr bool is_radial() noexcept { return false; } - /// @brief Indicates if the BSplines are uniform or not (this is obviously the case here). static constexpr bool is_uniform() noexcept { return false; } - /// @brief Impl template class Impl { @@ -87,16 +76,12 @@ class NonUniformBSplines : NonUniformBSplinesBase int m_nknots; public: - /// @brief The type of discrete dimension associated to BSplines. using discrete_dimension_type = NonUniformBSplines; - /// @brief The type of discrete domain indexing the BSplines. using discrete_domain_type = DiscreteDomain; - /// @brief The type of discrete element indexing a BSpline. using discrete_element_type = DiscreteElement; - /// @brief The type of discrete vector representing an "indexes displacement" between two BSplines. using discrete_vector_type = DiscreteVector; Impl() = default; @@ -124,97 +109,49 @@ class NonUniformBSplines : NonUniformBSplinesBase template Impl(RandomIt breaks_begin, RandomIt breaks_end); - /// @brief Copy-constructs Impl(Impl const& x) = default; - /// @brief Move-constructs Impl(Impl&& x) = default; - /// @brief Destructs ~Impl() = default; - /// @brief Copy-assigns Impl& operator=(Impl const& x) = default; - /// @brief Move-assigns Impl& operator=(Impl&& x) = default; - /** @brief Evaluates BSplines at a given coordinate - * - * The values are computed for every BSplines at the given coordinate x. A spline approximation at coordinate x is a linear combination of those BSplines evaluations weigthed with splines coefficients of the spline-transformed initial discrete function. - * @param[out] values The values of the BSplines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. - * @param[in] x The coordinates where BSplines are evaluated. - */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis(DSpan1D values, ddc::Coordinate const& x) const; - /** @brief Evaluates BSplines derivatives at a given coordinate - * - * The derivatives are computed for every BSplines at the given coordinate x. A spline approximation of a derivative at coordinate x is a linear combination of those BSplines derivatives weigthed with splines coefficients of the spline-transformed initial discrete function. - * @param[out] derivs The derivatives of the BSplines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. - * @param[in] x The coordinates where BSplines derivatives are evaluated. - */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_deriv(DSpan1D derivs, ddc::Coordinate const& x) const; - /** @brief Evaluates BSplines values and n derivatives at a given coordinate - * - * The values and derivatives are computed for every BSplines at the given coordinate x. - * @param[out] derivs The values and n derivatives of the BSplines evaluated at coordinate x. It has to be a (1+degree)*(1+n) 2D mdspan. - * @param[in] x The coordinates where BSplines derivatives are evaluated. - * @param[in] n The number of derivatives to evaluate (in addition to the BSplines values themselves). - */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis_and_n_derivs( ddc::DSpan2D derivs, ddc::Coordinate const& x, std::size_t n) const; - /** @brief Compute the integrals of the bsplines - * - * @param[out] int_vals The values of the integrals. It has to be a (1+nbasis) 1D mdspan. - */ template KOKKOS_INLINE_FUNCTION ddc::ChunkSpan integrals( ddc::ChunkSpan int_vals) const; - /** @brief Returns the coordinate of the knot corresponding to the given index for a BSpline. - * - * @param[in] idx Integer identifying index of the knot. - * @return Coordinate of the knot. - */ KOKKOS_INLINE_FUNCTION ddc::Coordinate get_knot(int knot_idx) const noexcept { return ddc::coordinate(ddc::DiscreteElement(knot_idx + degree())); } - /** @brief Returns the first support knot associated to a discrete_element identifying a BSpline. - * - * @param[in] ix Index of the BSpline. - * @return Coordinate of the knot. - */ KOKKOS_INLINE_FUNCTION ddc::Coordinate get_first_support_knot( discrete_element_type const& ix) const { return ddc::coordinate(ddc::DiscreteElement(ix.uid())); } - /** @brief Returns the last support knot associated to a discrete_element identifying a BSpline. - * - * @param[in] ix Index of the BSpline. - * @return Coordinate of the knot. - */ KOKKOS_INLINE_FUNCTION ddc::Coordinate get_last_support_knot( discrete_element_type const& ix) const { return ddc::coordinate(ddc::DiscreteElement(ix.uid() + degree() + 1)); } - /** @brief Returns the n-th knot associated to a discrete_element identifying a BSpline. - * - * @param[in] ix Index of the BSpline. - * @param[in] n Integer identifying a knot in the support of the BSpline. - */ KOKKOS_INLINE_FUNCTION ddc::Coordinate get_support_knot_n( discrete_element_type const& ix, int n) const @@ -222,73 +159,42 @@ class NonUniformBSplines : NonUniformBSplinesBase return ddc::coordinate(ddc::DiscreteElement(ix.uid() + n)); } - /** @brief Returns the coordinate of the lower boundary BSpline. - * - * @return Coordinate of the lower boundary BSpline. - */ KOKKOS_INLINE_FUNCTION ddc::Coordinate rmin() const noexcept { return get_knot(0); } - /** @brief Returns the coordinate of the upper boundary BSpline. - * - * @return Coordinate of the upper boundary BSpline. - */ KOKKOS_INLINE_FUNCTION ddc::Coordinate rmax() const noexcept { return get_knot(ncells()); } - /** @brief TODO - * - * @return TODO. - */ KOKKOS_INLINE_FUNCTION double length() const noexcept { return rmax() - rmin(); } - /** @brief TODO - * - * @return TODO. - */ KOKKOS_INLINE_FUNCTION std::size_t size() const noexcept { return degree() + ncells(); } - /** @brief Returns the discrete domain including ghost bsplines - * - * @return The discrete domain including ghost bsplines. - */ + /// Returns the discrete domain including ghost bsplines KOKKOS_INLINE_FUNCTION discrete_domain_type full_domain() const { return discrete_domain_type(discrete_element_type(0), discrete_vector_type(size())); } - /** @brief TODO - * - * @return TODO - */ KOKKOS_INLINE_FUNCTION std::size_t npoints() const noexcept { return m_nknots - 2 * degree(); } - /** @brief TODO - * - * @return TODO - */ KOKKOS_INLINE_FUNCTION std::size_t nbasis() const noexcept { return ncells() + !is_periodic() * degree(); } - /** @brief TODO - * - * @return TODO - */ KOKKOS_INLINE_FUNCTION std::size_t ncells() const noexcept { return npoints() - 1; diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index e12adf956..c654e482a 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -24,55 +24,43 @@ struct UniformBSplinesBase { }; -/** - * The type of a uniform BSplines 1D basis. - * - * @tparam Tag The tag identifying the continuous dimension which supports the building of the BSplines. - * @tparam D The degree of the BSplines. - */ template class UniformBSplines : UniformBSplinesBase { static_assert(D > 0, "Parameter `D` must be positive"); public: - /// @brief The tag identifying the continuous dimension which supports the building of the BSplines. using tag_type = Tag; - /// @brief The discrete dimension corresponding to BSplines. + using discrete_dimension_type = UniformBSplines; - /// @brief The rank. +public: static constexpr std::size_t rank() { return 1; } - /// @brief The degree of BSplines. static constexpr std::size_t degree() noexcept { return D; } - /// @brief Indicates if the BSplines are periodic or not. static constexpr bool is_periodic() noexcept { return Tag::PERIODIC; } - /// @brief Indicates if the BSplines are radial or not (should be deprecated soon because this concept is not in the scope of DDC). static constexpr bool is_radial() noexcept { return false; } - /// @brief Indicates if the BSplines are uniform or not (this is obviously the case here). static constexpr bool is_uniform() noexcept { return true; } - /// @brief Impl template class Impl { @@ -86,19 +74,20 @@ class UniformBSplines : UniformBSplinesBase ddc::DiscreteDomain m_domain; public: - /// @brief The type of discrete dimension associated to BSplines. using discrete_dimension_type = UniformBSplines; - /// @brief The type of discrete domain indexing the BSplines. using discrete_domain_type = DiscreteDomain; - /// @brief The type of discrete element indexing a BSpline. using discrete_element_type = DiscreteElement; - /// @brief The type of discrete vector representing an "indexes displacement" between two BSplines. using discrete_vector_type = DiscreteVector; - Impl() = default; + Impl() = default; + + template + explicit Impl(Impl const& impl) : m_domain(impl.m_domain) + { + } /** Constructs a BSpline basis with n equidistant knots over \f$[a, b]\f$ * @@ -118,33 +107,16 @@ class UniformBSplines : UniformBSplinesBase mesh_type>(rmin, rmax, ddc::DiscreteVector(ncells + 1))); } - /// @brief Copy-constructs from another impl with different Kokkos memory space - template - explicit Impl(Impl const& impl) : m_domain(impl.m_domain) - { - } - - /// @brief Copy-constructs Impl(Impl const& x) = default; - /// @brief Move-constructs Impl(Impl&& x) = default; - /// @brief Destructs ~Impl() = default; - /// @brief Copy-assigns Impl& operator=(Impl const& x) = default; - /// @brief Move-assigns Impl& operator=(Impl&& x) = default; - /** @brief Evaluates BSplines at a given coordinate - * - * The values are computed for every BSplines at the given coordinate x. A spline approximation at coordinate x is a linear combination of those BSplines evaluations weigthed with splines coefficients of the spline-transformed initial discrete function. - * @param[out] values The values of the BSplines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. - * @param[in] x The coordinates where BSplines are evaluated. - */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis(DSpan1D values, ddc::Coordinate const& x) const { @@ -152,135 +124,71 @@ class UniformBSplines : UniformBSplinesBase return eval_basis(values, x, degree()); } - /** @brief Evaluates BSplines derivatives at a given coordinate - * - * The derivatives are computed for every BSplines at the given coordinate x. A spline approximation of a derivative at coordinate x is a linear combination of those BSplines derivatives weigthed with splines coefficients of the spline-transformed initial discrete function. - * @param[out] derivs The derivatives of the BSplines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. - * @param[in] x The coordinates where BSplines derivatives are evaluated. - */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_deriv(DSpan1D derivs, ddc::Coordinate const& x) const; - /** @brief Evaluates BSplines values and n derivatives at a given coordinate - * - * The values and derivatives are computed for every BSplines at the given coordinate x. - * @param[out] derivs The values and n derivatives of the BSplines evaluated at coordinate x. It has to be a (1+degree)*(1+n) 2D mdspan. - * @param[in] x The coordinates where BSplines derivatives are evaluated. - * @param[in] n The number of derivatives to evaluate (in addition to the BSplines values themselves). - */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis_and_n_derivs( ddc::DSpan2D derivs, ddc::Coordinate const& x, std::size_t n) const; - /** @brief Compute the integrals of the bsplines - * - * @param[out] int_vals The values of the integrals. It has to be a (1+nbasis) 1D mdspan. - */ template KOKKOS_INLINE_FUNCTION ddc::ChunkSpan integrals( ddc::ChunkSpan int_vals) const; - /** @brief Returns the coordinate of the knot corresponding to the given index for a BSpline. - * - * @param[in] idx Integer identifying index of the knot. - * @return Coordinate of the knot. - */ KOKKOS_INLINE_FUNCTION ddc::Coordinate get_knot(int idx) const noexcept { return ddc::Coordinate(rmin() + idx * ddc::step()); } - /** @brief Returns the first support knot associated to a discrete_element identifying a BSpline. - * - * @param[in] ix Index of the BSpline. - * @return Coordinate of the knot. - */ KOKKOS_INLINE_FUNCTION double get_first_support_knot(discrete_element_type const& ix) const { return get_knot(ix.uid() - degree()); } - /** @brief Returns the last support knot associated to a discrete_element identifying a BSpline. - * - * @param[in] ix Index of the BSpline. - * @return Coordinate of the knot. - */ KOKKOS_INLINE_FUNCTION double get_last_support_knot(discrete_element_type const& ix) const { return get_knot(ix.uid() + 1); } - /** @brief Returns the n-th knot associated to a discrete_element identifying a BSpline. - * - * @param[in] ix Index of the BSpline. - * @param[in] n Integer identifying a knot in the support of the BSpline. - */ KOKKOS_INLINE_FUNCTION double get_support_knot_n(discrete_element_type const& ix, int n) const { return get_knot(ix.uid() + n - degree()); } - /** @brief Returns the coordinate of the lower boundary BSpline. - * - * @return Coordinate of the lower boundary BSpline. - */ KOKKOS_INLINE_FUNCTION ddc::Coordinate rmin() const noexcept { return ddc::coordinate(m_domain.front()); } - /** @brief Returns the coordinate of the upper boundary BSpline. - * - * @return Coordinate of the upper boundary BSpline. - */ KOKKOS_INLINE_FUNCTION ddc::Coordinate rmax() const noexcept { return ddc::coordinate(m_domain.back()); } - /** @brief TODO - * - * @return TODO. - */ KOKKOS_INLINE_FUNCTION double length() const noexcept { return rmax() - rmin(); } - /** @brief TODO - * - * @return TODO. - */ KOKKOS_INLINE_FUNCTION std::size_t size() const noexcept { return degree() + ncells(); } - /** @brief Returns the discrete domain including ghost bsplines - * - * @return The discrete domain including ghost bsplines. - */ + /// Returns the discrete domain including ghost bsplines KOKKOS_INLINE_FUNCTION discrete_domain_type full_domain() const { return discrete_domain_type(discrete_element_type(0), discrete_vector_type(size())); } - /** @brief TODO - * - * @return TODO - */ KOKKOS_INLINE_FUNCTION std::size_t nbasis() const noexcept { return ncells() + !is_periodic() * degree(); } - /** @brief TODO - * - * @return TODO - */ KOKKOS_INLINE_FUNCTION std::size_t ncells() const noexcept { return m_domain.size() - 1; @@ -307,11 +215,6 @@ struct is_uniform_bsplines : public std::is_base_of { }; -/** - * @brief Indicates if a dimension representing BSplines corresponds to uniform BSplines of not. - * - * @tparam The discrete dimension associated to BSplines - */ template constexpr bool is_uniform_bsplines_v = is_uniform_bsplines::value; From 85a2a0fdaaa7b19ff5316091a07426b826e9f4c0 Mon Sep 17 00:00:00 2001 From: blegouix Date: Thu, 18 Apr 2024 15:21:55 +0200 Subject: [PATCH 22/89] format --- .../kernels/splines/bsplines_non_uniform.hpp | 24 ++++++++-------- .../ddc/kernels/splines/bsplines_uniform.hpp | 28 +++++++++---------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index 20e6ca2d7..e371f296a 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -36,43 +36,43 @@ class NonUniformBSplines : NonUniformBSplinesBase static_assert(D > 0, "Parameter `D` must be positive"); public: - /// @brief The tag identifying the continuous dimension which supports the building of the BSplines. + /// @brief The tag identifying the continuous dimension which supports the building of the BSplines. using tag_type = Tag; - /// @brief The discrete dimension corresponding to BSplines. + /// @brief The discrete dimension corresponding to BSplines. using discrete_dimension_type = NonUniformBSplines; - /// @brief The rank. + /// @brief The rank. static constexpr std::size_t rank() { return 1; } - /// @brief The degree of BSplines. + /// @brief The degree of BSplines. static constexpr std::size_t degree() noexcept { return D; } - /// @brief Indicates if the BSplines are periodic or not. + /// @brief Indicates if the BSplines are periodic or not. static constexpr bool is_periodic() noexcept { return Tag::PERIODIC; } - /// @brief Indicates if the BSplines are radial or not (should be deprecated soon because this concept is not in the scope of DDC). + /// @brief Indicates if the BSplines are radial or not (should be deprecated soon because this concept is not in the scope of DDC). static constexpr bool is_radial() noexcept { return false; } - /// @brief Indicates if the BSplines are uniform or not (this is obviously the case here). + /// @brief Indicates if the BSplines are uniform or not (this is obviously the case here). static constexpr bool is_uniform() noexcept { return false; } - /// @brief Impl + /// @brief Impl template class Impl { @@ -87,16 +87,16 @@ class NonUniformBSplines : NonUniformBSplinesBase int m_nknots; public: - /// @brief The type of discrete dimension associated to BSplines. + /// @brief The type of discrete dimension associated to BSplines. using discrete_dimension_type = NonUniformBSplines; - /// @brief The type of discrete domain indexing the BSplines. + /// @brief The type of discrete domain indexing the BSplines. using discrete_domain_type = DiscreteDomain; - /// @brief The type of discrete element indexing a BSpline. + /// @brief The type of discrete element indexing a BSpline. using discrete_element_type = DiscreteElement; - /// @brief The type of discrete vector representing an "indexes displacement" between two BSplines. + /// @brief The type of discrete vector representing an "indexes displacement" between two BSplines. using discrete_vector_type = DiscreteVector; Impl() = default; diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index e12adf956..afabf9b58 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -36,43 +36,43 @@ class UniformBSplines : UniformBSplinesBase static_assert(D > 0, "Parameter `D` must be positive"); public: - /// @brief The tag identifying the continuous dimension which supports the building of the BSplines. + /// @brief The tag identifying the continuous dimension which supports the building of the BSplines. using tag_type = Tag; - /// @brief The discrete dimension corresponding to BSplines. + /// @brief The discrete dimension corresponding to BSplines. using discrete_dimension_type = UniformBSplines; - /// @brief The rank. + /// @brief The rank. static constexpr std::size_t rank() { return 1; } - /// @brief The degree of BSplines. + /// @brief The degree of BSplines. static constexpr std::size_t degree() noexcept { return D; } - /// @brief Indicates if the BSplines are periodic or not. + /// @brief Indicates if the BSplines are periodic or not. static constexpr bool is_periodic() noexcept { return Tag::PERIODIC; } - /// @brief Indicates if the BSplines are radial or not (should be deprecated soon because this concept is not in the scope of DDC). + /// @brief Indicates if the BSplines are radial or not (should be deprecated soon because this concept is not in the scope of DDC). static constexpr bool is_radial() noexcept { return false; } - /// @brief Indicates if the BSplines are uniform or not (this is obviously the case here). + /// @brief Indicates if the BSplines are uniform or not (this is obviously the case here). static constexpr bool is_uniform() noexcept { return true; } - /// @brief Impl + /// @brief Impl template class Impl { @@ -86,19 +86,19 @@ class UniformBSplines : UniformBSplinesBase ddc::DiscreteDomain m_domain; public: - /// @brief The type of discrete dimension associated to BSplines. + /// @brief The type of discrete dimension associated to BSplines. using discrete_dimension_type = UniformBSplines; - /// @brief The type of discrete domain indexing the BSplines. + /// @brief The type of discrete domain indexing the BSplines. using discrete_domain_type = DiscreteDomain; - /// @brief The type of discrete element indexing a BSpline. + /// @brief The type of discrete element indexing a BSpline. using discrete_element_type = DiscreteElement; - /// @brief The type of discrete vector representing an "indexes displacement" between two BSplines. + /// @brief The type of discrete vector representing an "indexes displacement" between two BSplines. using discrete_vector_type = DiscreteVector; - Impl() = default; + Impl() = default; /** Constructs a BSpline basis with n equidistant knots over \f$[a, b]\f$ * @@ -182,7 +182,7 @@ class UniformBSplines : UniformBSplinesBase integrals( ddc::ChunkSpan int_vals) const; - /** @brief Returns the coordinate of the knot corresponding to the given index for a BSpline. + /** @brief Returns the coordinate of the knot corresponding to the given index for a BSpline. * * @param[in] idx Integer identifying index of the knot. * @return Coordinate of the knot. From 17bb0ba81db4b9ed703793d4fbf9c82fc757f5ab Mon Sep 17 00:00:00 2001 From: blegouix Date: Thu, 18 Apr 2024 19:23:05 +0200 Subject: [PATCH 23/89] autoreview --- .../kernels/splines/bsplines_non_uniform.hpp | 29 ++++++++------- .../ddc/kernels/splines/bsplines_uniform.hpp | 36 +++++++++---------- 2 files changed, 35 insertions(+), 30 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index e371f296a..f2a027642 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -39,7 +39,7 @@ class NonUniformBSplines : NonUniformBSplinesBase /// @brief The tag identifying the continuous dimension which supports the building of the BSplines. using tag_type = Tag; - /// @brief The discrete dimension corresponding to BSplines. + /// @brief The discrete dimension identifying BSplines. using discrete_dimension_type = NonUniformBSplines; /// @brief The rank. @@ -66,7 +66,7 @@ class NonUniformBSplines : NonUniformBSplinesBase return false; } - /// @brief Indicates if the BSplines are uniform or not (this is obviously the case here). + /// @brief Indicates if the BSplines are uniform or not (this is not the case here). static constexpr bool is_uniform() noexcept { return false; @@ -87,7 +87,7 @@ class NonUniformBSplines : NonUniformBSplinesBase int m_nknots; public: - /// @brief The type of discrete dimension associated to BSplines. + /// @brief The type of discrete dimension identifying BSplines. using discrete_dimension_type = NonUniformBSplines; /// @brief The type of discrete domain indexing the BSplines. @@ -143,7 +143,7 @@ class NonUniformBSplines : NonUniformBSplinesBase * * The values are computed for every BSplines at the given coordinate x. A spline approximation at coordinate x is a linear combination of those BSplines evaluations weigthed with splines coefficients of the spline-transformed initial discrete function. * @param[out] values The values of the BSplines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. - * @param[in] x The coordinates where BSplines are evaluated. + * @param[in] x The coordinate where BSplines are evaluated. */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis(DSpan1D values, ddc::Coordinate const& x) const; @@ -152,7 +152,7 @@ class NonUniformBSplines : NonUniformBSplinesBase * * The derivatives are computed for every BSplines at the given coordinate x. A spline approximation of a derivative at coordinate x is a linear combination of those BSplines derivatives weigthed with splines coefficients of the spline-transformed initial discrete function. * @param[out] derivs The derivatives of the BSplines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. - * @param[in] x The coordinates where BSplines derivatives are evaluated. + * @param[in] x The coordinate where BSplines derivatives are evaluated. */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_deriv(DSpan1D derivs, ddc::Coordinate const& x) const; @@ -169,7 +169,7 @@ class NonUniformBSplines : NonUniformBSplinesBase ddc::Coordinate const& x, std::size_t n) const; - /** @brief Compute the integrals of the bsplines + /** @brief Compute the integrals of the BSplines. * * @param[out] int_vals The values of the integrals. It has to be a (1+nbasis) 1D mdspan. */ @@ -180,7 +180,7 @@ class NonUniformBSplines : NonUniformBSplinesBase /** @brief Returns the coordinate of the knot corresponding to the given index for a BSpline. * - * @param[in] idx Integer identifying index of the knot. + * @param[in] knot_idx Integer identifying index of the knot. * @return Coordinate of the knot. */ KOKKOS_INLINE_FUNCTION ddc::Coordinate get_knot(int knot_idx) const noexcept @@ -190,7 +190,7 @@ class NonUniformBSplines : NonUniformBSplinesBase /** @brief Returns the first support knot associated to a discrete_element identifying a BSpline. * - * @param[in] ix Index of the BSpline. + * @param[in] ix DiscreteElement identifying the BSpline. * @return Coordinate of the knot. */ KOKKOS_INLINE_FUNCTION ddc::Coordinate get_first_support_knot( @@ -201,7 +201,7 @@ class NonUniformBSplines : NonUniformBSplinesBase /** @brief Returns the last support knot associated to a discrete_element identifying a BSpline. * - * @param[in] ix Index of the BSpline. + * @param[in] ix DiscreteElement identifying the BSpline. * @return Coordinate of the knot. */ KOKKOS_INLINE_FUNCTION ddc::Coordinate get_last_support_knot( @@ -210,10 +210,10 @@ class NonUniformBSplines : NonUniformBSplinesBase return ddc::coordinate(ddc::DiscreteElement(ix.uid() + degree() + 1)); } - /** @brief Returns the n-th knot associated to a discrete_element identifying a BSpline. + /** @brief Returns the \f$n\f$-th knot associated to a discrete_element identifying a BSpline. * - * @param[in] ix Index of the BSpline. - * @param[in] n Integer identifying a knot in the support of the BSpline. + * @param[in] ix DiscreteElement identifying the BSpline. + * @param[in] n Integer indexing a knot in the support of the BSpline. */ KOKKOS_INLINE_FUNCTION ddc::Coordinate get_support_knot_n( discrete_element_type const& ix, @@ -304,6 +304,11 @@ struct is_non_uniform_bsplines : public std::is_base_of constexpr bool is_non_uniform_bsplines_v = is_non_uniform_bsplines::value; diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index afabf9b58..6e3106610 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -39,7 +39,7 @@ class UniformBSplines : UniformBSplinesBase /// @brief The tag identifying the continuous dimension which supports the building of the BSplines. using tag_type = Tag; - /// @brief The discrete dimension corresponding to BSplines. + /// @brief The discrete dimension representing BSplines. using discrete_dimension_type = UniformBSplines; /// @brief The rank. @@ -66,7 +66,7 @@ class UniformBSplines : UniformBSplinesBase return false; } - /// @brief Indicates if the BSplines are uniform or not (this is obviously the case here). + /// @brief Indicates if the BSplines are uniform or not (this is the case here). static constexpr bool is_uniform() noexcept { return true; @@ -86,7 +86,7 @@ class UniformBSplines : UniformBSplinesBase ddc::DiscreteDomain m_domain; public: - /// @brief The type of discrete dimension associated to BSplines. + /// @brief The type of discrete dimension identifying BSplines. using discrete_dimension_type = UniformBSplines; /// @brief The type of discrete domain indexing the BSplines. @@ -100,7 +100,7 @@ class UniformBSplines : UniformBSplinesBase Impl() = default; - /** Constructs a BSpline basis with n equidistant knots over \f$[a, b]\f$ + /** Constructs a BSplines basis with n equidistant knots over \f$[a, b]\f$ * * @param rmin the real ddc::coordinate of the first knot * @param rmax the real ddc::coordinate of the last knot @@ -118,7 +118,7 @@ class UniformBSplines : UniformBSplinesBase mesh_type>(rmin, rmax, ddc::DiscreteVector(ncells + 1))); } - /// @brief Copy-constructs from another impl with different Kokkos memory space + /// @brief Copy-constructs from another Impl with different Kokkos memory space template explicit Impl(Impl const& impl) : m_domain(impl.m_domain) { @@ -143,7 +143,7 @@ class UniformBSplines : UniformBSplinesBase * * The values are computed for every BSplines at the given coordinate x. A spline approximation at coordinate x is a linear combination of those BSplines evaluations weigthed with splines coefficients of the spline-transformed initial discrete function. * @param[out] values The values of the BSplines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. - * @param[in] x The coordinates where BSplines are evaluated. + * @param[in] x The coordinate where BSplines are evaluated. */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis(DSpan1D values, ddc::Coordinate const& x) const @@ -156,12 +156,12 @@ class UniformBSplines : UniformBSplinesBase * * The derivatives are computed for every BSplines at the given coordinate x. A spline approximation of a derivative at coordinate x is a linear combination of those BSplines derivatives weigthed with splines coefficients of the spline-transformed initial discrete function. * @param[out] derivs The derivatives of the BSplines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. - * @param[in] x The coordinates where BSplines derivatives are evaluated. + * @param[in] x The coordinate where BSplines derivatives are evaluated. */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_deriv(DSpan1D derivs, ddc::Coordinate const& x) const; - /** @brief Evaluates BSplines values and n derivatives at a given coordinate + /** @brief Evaluates BSplines values and \f$n\f$ derivatives at a given coordinate * * The values and derivatives are computed for every BSplines at the given coordinate x. * @param[out] derivs The values and n derivatives of the BSplines evaluated at coordinate x. It has to be a (1+degree)*(1+n) 2D mdspan. @@ -173,7 +173,7 @@ class UniformBSplines : UniformBSplinesBase ddc::Coordinate const& x, std::size_t n) const; - /** @brief Compute the integrals of the bsplines + /** @brief Compute the integrals of the BSplines. * * @param[out] int_vals The values of the integrals. It has to be a (1+nbasis) 1D mdspan. */ @@ -192,9 +192,9 @@ class UniformBSplines : UniformBSplinesBase return ddc::Coordinate(rmin() + idx * ddc::step()); } - /** @brief Returns the first support knot associated to a discrete_element identifying a BSpline. + /** @brief Returns the first support knot associated to a DiscreteElement identifying a BSpline. * - * @param[in] ix Index of the BSpline. + * @param[in] ix DiscreteElement identifying the BSpline. * @return Coordinate of the knot. */ KOKKOS_INLINE_FUNCTION double get_first_support_knot(discrete_element_type const& ix) const @@ -202,9 +202,9 @@ class UniformBSplines : UniformBSplinesBase return get_knot(ix.uid() - degree()); } - /** @brief Returns the last support knot associated to a discrete_element identifying a BSpline. + /** @brief Returns the last support knot associated to a DiscreteElement identifying a BSpline. * - * @param[in] ix Index of the BSpline. + * @param[in] ix DiscreteElement identifying the BSpline. * @return Coordinate of the knot. */ KOKKOS_INLINE_FUNCTION double get_last_support_knot(discrete_element_type const& ix) const @@ -212,10 +212,10 @@ class UniformBSplines : UniformBSplinesBase return get_knot(ix.uid() + 1); } - /** @brief Returns the n-th knot associated to a discrete_element identifying a BSpline. + /** @brief Returns the \f$n\f$-th knot associated to a discrete_element identifying a BSpline. * - * @param[in] ix Index of the BSpline. - * @param[in] n Integer identifying a knot in the support of the BSpline. + * @param[in] ix DiscreteElement identifying the BSpline. + * @param[in] n Integer indexing a knot in the support of the BSpline. */ KOKKOS_INLINE_FUNCTION double get_support_knot_n(discrete_element_type const& ix, int n) const @@ -308,9 +308,9 @@ struct is_uniform_bsplines : public std::is_base_of }; /** - * @brief Indicates if a dimension representing BSplines corresponds to uniform BSplines of not. + * @brief Indicates if a tag corresponds to uniform BSplines of not. * - * @tparam The discrete dimension associated to BSplines + * @tparam The presumed uniform BSplines. */ template constexpr bool is_uniform_bsplines_v = is_uniform_bsplines::value; From 7e6c05b4e07e9e5329332d2d0362ca272be9a2b8 Mon Sep 17 00:00:00 2001 From: blegouix Date: Thu, 18 Apr 2024 19:57:16 +0200 Subject: [PATCH 24/89] wip --- include/ddc/kernels/splines/bsplines_non_uniform.hpp | 1 + include/ddc/kernels/splines/bsplines_uniform.hpp | 1 + 2 files changed, 2 insertions(+) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index f2a027642..b57173cf7 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -172,6 +172,7 @@ class NonUniformBSplines : NonUniformBSplinesBase /** @brief Compute the integrals of the BSplines. * * @param[out] int_vals The values of the integrals. It has to be a (1+nbasis) 1D mdspan. + * @return The values of the integrals. */ template KOKKOS_INLINE_FUNCTION ddc::ChunkSpan diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index 6e3106610..192b30073 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -176,6 +176,7 @@ class UniformBSplines : UniformBSplinesBase /** @brief Compute the integrals of the BSplines. * * @param[out] int_vals The values of the integrals. It has to be a (1+nbasis) 1D mdspan. + * @return The values of the integrals. */ template KOKKOS_INLINE_FUNCTION ddc::ChunkSpan From d7472c7692dfd5f0574e2a1e7672cf83f61740f2 Mon Sep 17 00:00:00 2001 From: blegouix Date: Fri, 19 Apr 2024 08:48:16 +0200 Subject: [PATCH 25/89] wip --- .../kernels/splines/bsplines_non_uniform.hpp | 22 ++++++++++-------- .../ddc/kernels/splines/bsplines_uniform.hpp | 23 +++++++++++-------- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index fd11570fd..3266b49c9 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -138,6 +138,7 @@ class NonUniformBSplines : NonUniformBSplinesBase * The values are computed for every BSplines at the given coordinate x. A spline approximation at coordinate x is a linear combination of those BSplines evaluations weigthed with splines coefficients of the spline-transformed initial discrete function. * @param[out] values The values of the BSplines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. * @param[in] x The coordinate where BSplines are evaluated. + * @return TODO */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis(DSpan1D values, ddc::Coordinate const& x) const; @@ -147,6 +148,7 @@ class NonUniformBSplines : NonUniformBSplinesBase * The derivatives are computed for every BSplines at the given coordinate x. A spline approximation of a derivative at coordinate x is a linear combination of those BSplines derivatives weigthed with splines coefficients of the spline-transformed initial discrete function. * @param[out] derivs The derivatives of the BSplines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. * @param[in] x The coordinate where BSplines derivatives are evaluated. + * @return TODO */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_deriv(DSpan1D derivs, ddc::Coordinate const& x) const; @@ -157,6 +159,7 @@ class NonUniformBSplines : NonUniformBSplinesBase * @param[out] derivs The values and n derivatives of the BSplines evaluated at coordinate x. It has to be a (1+degree)*(1+n) 2D mdspan. * @param[in] x The coordinates where BSplines derivatives are evaluated. * @param[in] n The number of derivatives to evaluate (in addition to the BSplines values themselves). + * @return TODO */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis_and_n_derivs( ddc::DSpan2D derivs, @@ -183,7 +186,7 @@ class NonUniformBSplines : NonUniformBSplinesBase return ddc::coordinate(ddc::DiscreteElement(knot_idx + degree())); } - /** @brief Returns the first support knot associated to a discrete_element identifying a BSpline. + /** @brief Returns the coordinate of the first support knot associated to a discrete_element identifying a BSpline. * * @param[in] ix DiscreteElement identifying the BSpline. * @return Coordinate of the knot. @@ -194,7 +197,7 @@ class NonUniformBSplines : NonUniformBSplinesBase return ddc::coordinate(ddc::DiscreteElement(ix.uid())); } - /** @brief Returns the last support knot associated to a discrete_element identifying a BSpline. + /** @brief Returns the coordinate of the last support knot associated to a discrete_element identifying a BSpline. * * @param[in] ix DiscreteElement identifying the BSpline. * @return Coordinate of the knot. @@ -205,10 +208,11 @@ class NonUniformBSplines : NonUniformBSplinesBase return ddc::coordinate(ddc::DiscreteElement(ix.uid() + degree() + 1)); } - /** @brief Returns the \f$n\f$-th knot associated to a discrete_element identifying a BSpline. + /** @brief Returns the coordinate of the \f$n\f$-th knot associated to a discrete_element identifying a BSpline. * * @param[in] ix DiscreteElement identifying the BSpline. * @param[in] n Integer indexing a knot in the support of the BSpline. + * @return TODO */ KOKKOS_INLINE_FUNCTION ddc::Coordinate get_support_knot_n( discrete_element_type const& ix, @@ -217,27 +221,27 @@ class NonUniformBSplines : NonUniformBSplinesBase return ddc::coordinate(ddc::DiscreteElement(ix.uid() + n)); } - /** @brief Returns the coordinate of the lower boundary BSpline. + /** @brief Returns the coordinate of the lower boundary knot. * - * @return Coordinate of the lower boundary BSpline. + * @return Coordinate of the lower boundary knot. */ KOKKOS_INLINE_FUNCTION ddc::Coordinate rmin() const noexcept { return get_knot(0); } - /** @brief Returns the coordinate of the upper boundary BSpline. + /** @brief Returns the coordinate of the upper boundary knot. * - * @return Coordinate of the upper boundary BSpline. + * @return Coordinate of the upper boundary knot. */ KOKKOS_INLINE_FUNCTION ddc::Coordinate rmax() const noexcept { return get_knot(ncells()); } - /** @brief TODO + /** @brief Returns the length of the domain supporting knots. * - * @return TODO. + * @return The length of the domain supporting knots. */ KOKKOS_INLINE_FUNCTION double length() const noexcept { diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index dda44713d..32efa9da3 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -138,6 +138,7 @@ class UniformBSplines : UniformBSplinesBase * The values are computed for every BSplines at the given coordinate x. A spline approximation at coordinate x is a linear combination of those BSplines evaluations weigthed with splines coefficients of the spline-transformed initial discrete function. * @param[out] values The values of the BSplines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. * @param[in] x The coordinate where BSplines are evaluated. + * @return TODO */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis(DSpan1D values, ddc::Coordinate const& x) const @@ -151,6 +152,7 @@ class UniformBSplines : UniformBSplinesBase * The derivatives are computed for every BSplines at the given coordinate x. A spline approximation of a derivative at coordinate x is a linear combination of those BSplines derivatives weigthed with splines coefficients of the spline-transformed initial discrete function. * @param[out] derivs The derivatives of the BSplines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. * @param[in] x The coordinate where BSplines derivatives are evaluated. + * @return TODO */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_deriv(DSpan1D derivs, ddc::Coordinate const& x) const; @@ -161,6 +163,7 @@ class UniformBSplines : UniformBSplinesBase * @param[out] derivs The values and n derivatives of the BSplines evaluated at coordinate x. It has to be a (1+degree)*(1+n) 2D mdspan. * @param[in] x The coordinates where BSplines derivatives are evaluated. * @param[in] n The number of derivatives to evaluate (in addition to the BSplines values themselves). + * @return TODO */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis_and_n_derivs( ddc::DSpan2D derivs, @@ -187,7 +190,7 @@ class UniformBSplines : UniformBSplinesBase return ddc::Coordinate(rmin() + idx * ddc::step()); } - /** @brief Returns the first support knot associated to a DiscreteElement identifying a BSpline. + /** @brief Returns the coordinate of the first support knot associated to a DiscreteElement identifying a BSpline. * * @param[in] ix DiscreteElement identifying the BSpline. * @return Coordinate of the knot. @@ -197,7 +200,7 @@ class UniformBSplines : UniformBSplinesBase return get_knot(ix.uid() - degree()); } - /** @brief Returns the last support knot associated to a DiscreteElement identifying a BSpline. + /** @brief Returns the coordinate of the last support knot associated to a DiscreteElement identifying a BSpline. * * @param[in] ix DiscreteElement identifying the BSpline. * @return Coordinate of the knot. @@ -207,7 +210,7 @@ class UniformBSplines : UniformBSplinesBase return get_knot(ix.uid() + 1); } - /** @brief Returns the \f$n\f$-th knot associated to a discrete_element identifying a BSpline. + /** @brief Returns the coordinate of the \f$n\f$-th knot associated to a discrete_element identifying a BSpline. * * @param[in] ix DiscreteElement identifying the BSpline. * @param[in] n Integer indexing a knot in the support of the BSpline. @@ -218,34 +221,34 @@ class UniformBSplines : UniformBSplinesBase return get_knot(ix.uid() + n - degree()); } - /** @brief Returns the coordinate of the lower boundary BSpline. + /** @brief Returns the coordinate of the lower boundary knot. * - * @return Coordinate of the lower boundary BSpline. + * @return Coordinate of the lower boundary knot. */ KOKKOS_INLINE_FUNCTION ddc::Coordinate rmin() const noexcept { return ddc::coordinate(m_domain.front()); } - /** @brief Returns the coordinate of the upper boundary BSpline. + /** @brief Returns the coordinate of the upper boundary knot. * - * @return Coordinate of the upper boundary BSpline. + * @return Coordinate of the upper boundary knot. */ KOKKOS_INLINE_FUNCTION ddc::Coordinate rmax() const noexcept { return ddc::coordinate(m_domain.back()); } - /** @brief TODO + /** @brief Returns the length of the domain supporting knots. * - * @return TODO. + * @return The length of the domain supporting knots. */ KOKKOS_INLINE_FUNCTION double length() const noexcept { return rmax() - rmin(); } - /** @brief TODO + /** @brief TODO (number of knots ?). * * @return TODO. */ From a563f6dec9db346630a32a91e7a8babb881b0799 Mon Sep 17 00:00:00 2001 From: blegouix Date: Fri, 19 Apr 2024 09:02:04 +0200 Subject: [PATCH 26/89] wip --- .../kernels/splines/bsplines_non_uniform.hpp | 17 +++++++++-------- .../ddc/kernels/splines/bsplines_uniform.hpp | 1 + 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index 6080f053f..29e66878e 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -99,13 +99,6 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase Impl() = default; - template - explicit Impl(Impl const& impl) - : m_domain(impl.m_domain) - , m_nknots(impl.m_nknots) - { - } - /// @brief Construct a `Impl` using a brace-list, i.e. `Impl bsplines({0., 1.})` explicit Impl(std::initializer_list> breaks) : Impl(breaks.begin(), breaks.end()) @@ -122,6 +115,14 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase template Impl(RandomIt breaks_begin, RandomIt breaks_end); + /// @brief Copy-constructs from another Impl with different Kokkos memory space + template + explicit Impl(Impl const& impl) + : m_domain(impl.m_domain) + , m_nknots(impl.m_nknots) + { + } + /// @brief Copy-constructs Impl(Impl const& x) = default; @@ -216,7 +217,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase * * @param[in] ix DiscreteElement identifying the BSpline. * @param[in] n Integer indexing a knot in the support of the BSpline. - * @return TODO + * @return Coordinate of the knot. */ KOKKOS_INLINE_FUNCTION ddc::Coordinate get_support_knot_n( discrete_element_type const& ix, diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index c94f17f39..cfab54dcf 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -218,6 +218,7 @@ class UniformBSplines : detail::UniformBSplinesBase * * @param[in] ix DiscreteElement identifying the BSpline. * @param[in] n Integer indexing a knot in the support of the BSpline. + * @return Coordinate of the knot. */ KOKKOS_INLINE_FUNCTION double get_support_knot_n(discrete_element_type const& ix, int n) const From 70172346a26721f023620e04ad15a60d2296985e Mon Sep 17 00:00:00 2001 From: blegouix Date: Fri, 19 Apr 2024 09:11:13 +0200 Subject: [PATCH 27/89] fix for allowing doxygen to keep track of integrals() --- include/ddc/kernels/splines/bsplines_non_uniform.hpp | 4 ++-- include/ddc/kernels/splines/bsplines_uniform.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index 29e66878e..5d8fcfbb2 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -593,9 +593,9 @@ KOKKOS_INLINE_FUNCTION int NonUniformBSplines::Impl:: template template template -KOKKOS_INLINE_FUNCTION ddc::ChunkSpan, Layout, MemorySpace2> +KOKKOS_INLINE_FUNCTION ddc::ChunkSpan::Impl::discrete_domain_type, Layout, MemorySpace2> NonUniformBSplines::Impl::integrals( - ddc::ChunkSpan, Layout, MemorySpace2> int_vals) const + ddc::ChunkSpan::Impl::discrete_domain_type, Layout, MemorySpace2> int_vals) const { if constexpr (is_periodic()) { assert(int_vals.size() == nbasis() || int_vals.size() == size()); diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index cfab54dcf..49ab7703d 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -523,9 +523,9 @@ KOKKOS_INLINE_FUNCTION void UniformBSplines::Impl::ge template template template -KOKKOS_INLINE_FUNCTION ddc::ChunkSpan, Layout, MemorySpace2> +KOKKOS_INLINE_FUNCTION ddc::ChunkSpan::Impl::discrete_domain_type, Layout, MemorySpace2> UniformBSplines::Impl::integrals( - ddc::ChunkSpan, Layout, MemorySpace2> int_vals) const + ddc::ChunkSpan::Impl::discrete_domain_type, Layout, MemorySpace2> int_vals) const { if constexpr (is_periodic()) { assert(int_vals.size() == nbasis() || int_vals.size() == size()); From dcc5c6f4d8d62086f775bdbb4e81483734a481ee Mon Sep 17 00:00:00 2001 From: blegouix Date: Fri, 19 Apr 2024 09:11:59 +0200 Subject: [PATCH 28/89] format --- include/ddc/kernels/splines/bsplines_non_uniform.hpp | 12 ++++++++++-- include/ddc/kernels/splines/bsplines_uniform.hpp | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index 5d8fcfbb2..bbf1b1217 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -593,9 +593,17 @@ KOKKOS_INLINE_FUNCTION int NonUniformBSplines::Impl:: template template template -KOKKOS_INLINE_FUNCTION ddc::ChunkSpan::Impl::discrete_domain_type, Layout, MemorySpace2> +KOKKOS_INLINE_FUNCTION ddc::ChunkSpan< + double, + typename NonUniformBSplines::Impl::discrete_domain_type, + Layout, + MemorySpace2> NonUniformBSplines::Impl::integrals( - ddc::ChunkSpan::Impl::discrete_domain_type, Layout, MemorySpace2> int_vals) const + ddc::ChunkSpan< + double, + typename NonUniformBSplines::Impl::discrete_domain_type, + Layout, + MemorySpace2> int_vals) const { if constexpr (is_periodic()) { assert(int_vals.size() == nbasis() || int_vals.size() == size()); diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index 49ab7703d..2a3344691 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -523,9 +523,17 @@ KOKKOS_INLINE_FUNCTION void UniformBSplines::Impl::ge template template template -KOKKOS_INLINE_FUNCTION ddc::ChunkSpan::Impl::discrete_domain_type, Layout, MemorySpace2> +KOKKOS_INLINE_FUNCTION ddc::ChunkSpan< + double, + typename UniformBSplines::Impl::discrete_domain_type, + Layout, + MemorySpace2> UniformBSplines::Impl::integrals( - ddc::ChunkSpan::Impl::discrete_domain_type, Layout, MemorySpace2> int_vals) const + ddc::ChunkSpan< + double, + typename UniformBSplines::Impl::discrete_domain_type, + Layout, + MemorySpace2> int_vals) const { if constexpr (is_periodic()) { assert(int_vals.size() == nbasis() || int_vals.size() == size()); From 8f7f760efde697f4c36e146ef1273a2c565a31ee Mon Sep 17 00:00:00 2001 From: blegouix Date: Fri, 19 Apr 2024 09:50:34 +0200 Subject: [PATCH 29/89] Revert "fix for allowing doxygen to keep track of integrals()" This reverts commit 70172346a26721f023620e04ad15a60d2296985e. --- include/ddc/kernels/splines/bsplines_non_uniform.hpp | 12 ++---------- include/ddc/kernels/splines/bsplines_uniform.hpp | 12 ++---------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index bbf1b1217..29e66878e 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -593,17 +593,9 @@ KOKKOS_INLINE_FUNCTION int NonUniformBSplines::Impl:: template template template -KOKKOS_INLINE_FUNCTION ddc::ChunkSpan< - double, - typename NonUniformBSplines::Impl::discrete_domain_type, - Layout, - MemorySpace2> +KOKKOS_INLINE_FUNCTION ddc::ChunkSpan, Layout, MemorySpace2> NonUniformBSplines::Impl::integrals( - ddc::ChunkSpan< - double, - typename NonUniformBSplines::Impl::discrete_domain_type, - Layout, - MemorySpace2> int_vals) const + ddc::ChunkSpan, Layout, MemorySpace2> int_vals) const { if constexpr (is_periodic()) { assert(int_vals.size() == nbasis() || int_vals.size() == size()); diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index 2a3344691..cfab54dcf 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -523,17 +523,9 @@ KOKKOS_INLINE_FUNCTION void UniformBSplines::Impl::ge template template template -KOKKOS_INLINE_FUNCTION ddc::ChunkSpan< - double, - typename UniformBSplines::Impl::discrete_domain_type, - Layout, - MemorySpace2> +KOKKOS_INLINE_FUNCTION ddc::ChunkSpan, Layout, MemorySpace2> UniformBSplines::Impl::integrals( - ddc::ChunkSpan< - double, - typename UniformBSplines::Impl::discrete_domain_type, - Layout, - MemorySpace2> int_vals) const + ddc::ChunkSpan, Layout, MemorySpace2> int_vals) const { if constexpr (is_periodic()) { assert(int_vals.size() == nbasis() || int_vals.size() == size()); From 9d675c94d77c3dc96ea9880f2f60d3b834004dbf Mon Sep 17 00:00:00 2001 From: blegouix Date: Fri, 19 Apr 2024 10:30:31 +0200 Subject: [PATCH 30/89] autoreview --- include/ddc/kernels/splines/bsplines_non_uniform.hpp | 10 +++++----- include/ddc/kernels/splines/bsplines_uniform.hpp | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index 29e66878e..02cf29dd9 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -70,7 +70,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase return false; } - /// @brief Impl + /// @brief Impl TODO template class Impl { @@ -85,13 +85,13 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase int m_nknots; public: - /// @brief The type of discrete dimension identifying BSplines. + /// @brief The type of discrete dimension representing the BSplines. using discrete_dimension_type = NonUniformBSplines; - /// @brief The type of discrete domain indexing the BSplines. + /// @brief The type of discrete domain identifying the BSplines. using discrete_domain_type = DiscreteDomain; - /// @brief The type of discrete element indexing a BSpline. + /// @brief The type of discrete element identifying a BSpline. using discrete_element_type = DiscreteElement; /// @brief The type of discrete vector representing an "indexes displacement" between two BSplines. @@ -213,7 +213,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase return ddc::coordinate(ddc::DiscreteElement(ix.uid() + degree() + 1)); } - /** @brief Returns the coordinate of the \f$n\f$-th knot associated to a discrete_element identifying a BSpline. + /** @brief Returns the coordinate of the \f$n\f$-th knot associated to a DiscreteElement identifying a BSpline. * * @param[in] ix DiscreteElement identifying the BSpline. * @param[in] n Integer indexing a knot in the support of the BSpline. diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index cfab54dcf..8efb291ee 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -70,7 +70,7 @@ class UniformBSplines : detail::UniformBSplinesBase return true; } - /// @brief Impl + /// @brief Impl TODO template class Impl { @@ -84,13 +84,13 @@ class UniformBSplines : detail::UniformBSplinesBase ddc::DiscreteDomain m_domain; public: - /// @brief The type of discrete dimension identifying BSplines. + /// @brief The type of discrete dimension representing the BSplines. using discrete_dimension_type = UniformBSplines; - /// @brief The type of discrete domain indexing the BSplines. + /// @brief The type of discrete domain identifying the BSplines. using discrete_domain_type = DiscreteDomain; - /// @brief The type of discrete element indexing a BSpline. + /// @brief The type of discrete element identifying a BSpline. using discrete_element_type = DiscreteElement; /// @brief The type of discrete vector representing an "indexes displacement" between two BSplines. @@ -214,7 +214,7 @@ class UniformBSplines : detail::UniformBSplinesBase return get_knot(ix.uid() + 1); } - /** @brief Returns the coordinate of the \f$n\f$-th knot associated to a discrete_element identifying a BSpline. + /** @brief Returns the coordinate of the \f$n\f$-th knot associated to a DiscreteElement identifying a BSpline. * * @param[in] ix DiscreteElement identifying the BSpline. * @param[in] n Integer indexing a knot in the support of the BSpline. From 6850ae90fa8dff82d28b825d1ba27de385c50d3e Mon Sep 17 00:00:00 2001 From: blegouix Date: Fri, 19 Apr 2024 10:50:31 +0200 Subject: [PATCH 31/89] B-splines --- .../kernels/splines/bsplines_non_uniform.hpp | 74 ++++++++--------- .../ddc/kernels/splines/bsplines_uniform.hpp | 79 +++++++++---------- 2 files changed, 76 insertions(+), 77 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index 02cf29dd9..85df1f5fd 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -29,10 +29,10 @@ struct NonUniformBSplinesBase } // namespace detail /** - * The type of a non-uniform BSplines 1D basis. + * The type of a non-uniform B-splines 1D basis. * - * @tparam Tag The tag identifying the continuous dimension which supports the building of the BSplines. - * @tparam D The degree of the BSplines. + * @tparam Tag The tag identifying the continuous dimension which supports the building of the B-splines. + * @tparam D The degree of the B-splines. */ template class NonUniformBSplines : detail::NonUniformBSplinesBase @@ -40,31 +40,31 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase static_assert(D > 0, "Parameter `D` must be positive"); public: - /// @brief The tag identifying the continuous dimension which supports the building of the BSplines. + /// @brief The tag identifying the continuous dimension which supports the building of the B-splines. using tag_type = Tag; - /// @brief The discrete dimension identifying BSplines. + /// @brief The discrete dimension identifying B-splines. using discrete_dimension_type = NonUniformBSplines; - /// @brief The degree of BSplines. + /// @brief The degree of B-splines. static constexpr std::size_t degree() noexcept { return D; } - /// @brief Indicates if the BSplines are periodic or not. + /// @brief Indicates if the B-splines are periodic or not. static constexpr bool is_periodic() noexcept { return Tag::PERIODIC; } - /// @brief Indicates if the BSplines are radial or not (should be deprecated soon because this concept is not in the scope of DDC). + /// @brief Indicates if the B-splines are radial or not (should be deprecated soon because this concept is not in the scope of DDC). static constexpr bool is_radial() noexcept { return false; } - /// @brief Indicates if the BSplines are uniform or not (this is not the case here). + /// @brief Indicates if the B-splines are uniform or not (this is not the case here). static constexpr bool is_uniform() noexcept { return false; @@ -85,16 +85,16 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase int m_nknots; public: - /// @brief The type of discrete dimension representing the BSplines. + /// @brief The type of discrete dimension representing the B-splines. using discrete_dimension_type = NonUniformBSplines; - /// @brief The type of discrete domain identifying the BSplines. + /// @brief The type of discrete domain identifying the B-splines. using discrete_domain_type = DiscreteDomain; - /// @brief The type of discrete element identifying a BSpline. + /// @brief The type of discrete element identifying a B-spline. using discrete_element_type = DiscreteElement; - /// @brief The type of discrete vector representing an "indexes displacement" between two BSplines. + /// @brief The type of discrete vector representing an "indexes displacement" between two B-splines. using discrete_vector_type = DiscreteVector; Impl() = default; @@ -138,32 +138,32 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase /// @brief Move-assigns Impl& operator=(Impl&& x) = default; - /** @brief Evaluates BSplines at a given coordinate + /** @brief Evaluates B-splines at a given coordinate * - * The values are computed for every BSplines at the given coordinate x. A spline approximation at coordinate x is a linear combination of those BSplines evaluations weigthed with splines coefficients of the spline-transformed initial discrete function. - * @param[out] values The values of the BSplines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. - * @param[in] x The coordinate where BSplines are evaluated. + * The values are computed for every B-splines at the given coordinate x. A spline approximation at coordinate x is a linear combination of those B-splines evaluations weigthed with splines coefficients of the spline-transformed initial discrete function. + * @param[out] values The values of the B-splines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. + * @param[in] x The coordinate where B-splines are evaluated. * @return TODO */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis(DSpan1D values, ddc::Coordinate const& x) const; - /** @brief Evaluates BSplines derivatives at a given coordinate + /** @brief Evaluates B-splines derivatives at a given coordinate * - * The derivatives are computed for every BSplines at the given coordinate x. A spline approximation of a derivative at coordinate x is a linear combination of those BSplines derivatives weigthed with splines coefficients of the spline-transformed initial discrete function. - * @param[out] derivs The derivatives of the BSplines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. - * @param[in] x The coordinate where BSplines derivatives are evaluated. + * The derivatives are computed for every B-splines at the given coordinate x. A spline approximation of a derivative at coordinate x is a linear combination of those B-splines derivatives weigthed with splines coefficients of the spline-transformed initial discrete function. + * @param[out] derivs The derivatives of the B-splines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. + * @param[in] x The coordinate where B-splines derivatives are evaluated. * @return TODO */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_deriv(DSpan1D derivs, ddc::Coordinate const& x) const; - /** @brief Evaluates BSplines values and n derivatives at a given coordinate + /** @brief Evaluates B-splines values and n derivatives at a given coordinate * - * The values and derivatives are computed for every BSplines at the given coordinate x. - * @param[out] derivs The values and n derivatives of the BSplines evaluated at coordinate x. It has to be a (1+degree)*(1+n) 2D mdspan. - * @param[in] x The coordinates where BSplines derivatives are evaluated. - * @param[in] n The number of derivatives to evaluate (in addition to the BSplines values themselves). + * The values and derivatives are computed for every B-splines at the given coordinate x. + * @param[out] derivs The values and n derivatives of the B-splines evaluated at coordinate x. It has to be a (1+degree)*(1+n) 2D mdspan. + * @param[in] x The coordinates where B-splines derivatives are evaluated. + * @param[in] n The number of derivatives to evaluate (in addition to the B-splines values themselves). * @return TODO */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis_and_n_derivs( @@ -171,7 +171,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase ddc::Coordinate const& x, std::size_t n) const; - /** @brief Compute the integrals of the BSplines. + /** @brief Compute the integrals of the B-splines. * * @param[out] int_vals The values of the integrals. It has to be a (1+nbasis) 1D mdspan. * @return The values of the integrals. @@ -181,7 +181,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase integrals( ddc::ChunkSpan int_vals) const; - /** @brief Returns the coordinate of the knot corresponding to the given index for a BSpline. + /** @brief Returns the coordinate of the knot corresponding to the given index for a B-spline. * * @param[in] knot_idx Integer identifying index of the knot. * @return Coordinate of the knot. @@ -191,9 +191,9 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase return ddc::coordinate(ddc::DiscreteElement(knot_idx + degree())); } - /** @brief Returns the coordinate of the first support knot associated to a discrete_element identifying a BSpline. + /** @brief Returns the coordinate of the first support knot associated to a discrete_element identifying a B-spline. * - * @param[in] ix DiscreteElement identifying the BSpline. + * @param[in] ix DiscreteElement identifying the B-spline. * @return Coordinate of the knot. */ KOKKOS_INLINE_FUNCTION ddc::Coordinate get_first_support_knot( @@ -202,9 +202,9 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase return ddc::coordinate(ddc::DiscreteElement(ix.uid())); } - /** @brief Returns the coordinate of the last support knot associated to a discrete_element identifying a BSpline. + /** @brief Returns the coordinate of the last support knot associated to a discrete_element identifying a B-spline. * - * @param[in] ix DiscreteElement identifying the BSpline. + * @param[in] ix DiscreteElement identifying the B-spline. * @return Coordinate of the knot. */ KOKKOS_INLINE_FUNCTION ddc::Coordinate get_last_support_knot( @@ -213,10 +213,10 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase return ddc::coordinate(ddc::DiscreteElement(ix.uid() + degree() + 1)); } - /** @brief Returns the coordinate of the \f$n\f$-th knot associated to a DiscreteElement identifying a BSpline. + /** @brief Returns the coordinate of the \f$n\f$-th knot associated to a DiscreteElement identifying a B-spline. * - * @param[in] ix DiscreteElement identifying the BSpline. - * @param[in] n Integer indexing a knot in the support of the BSpline. + * @param[in] ix DiscreteElement identifying the B-spline. + * @param[in] n Integer indexing a knot in the support of the B-spline. * @return Coordinate of the knot. */ KOKKOS_INLINE_FUNCTION ddc::Coordinate get_support_knot_n( @@ -309,9 +309,9 @@ struct is_non_uniform_bsplines : public std::is_base_of constexpr bool is_non_uniform_bsplines_v = is_non_uniform_bsplines::value; diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index 8efb291ee..bd0354dbd 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -29,10 +29,10 @@ struct UniformBSplinesBase } // namespace detail /** - * The type of a uniform BSplines 1D basis. + * The type of a uniform B-splines 1D basis. * - * @tparam Tag The tag identifying the continuous dimension which supports the building of the BSplines. - * @tparam D The degree of the BSplines. + * @tparam Tag The tag identifying the continuous dimension which supports the building of the B-splines. + * @tparam D The degree of the B-splines. */ template class UniformBSplines : detail::UniformBSplinesBase @@ -40,31 +40,31 @@ class UniformBSplines : detail::UniformBSplinesBase static_assert(D > 0, "Parameter `D` must be positive"); public: - /// @brief The tag identifying the continuous dimension which supports the building of the BSplines. + /// @brief The tag identifying the continuous dimension which supports the building of the B-splines. using tag_type = Tag; - /// @brief The discrete dimension representing BSplines. + /// @brief The discrete dimension representing B-splines. using discrete_dimension_type = UniformBSplines; - /// @brief The degree of BSplines. + /// @brief The degree of B-splines. static constexpr std::size_t degree() noexcept { return D; } - /// @brief Indicates if the BSplines are periodic or not. + /// @brief Indicates if the B-splines are periodic or not. static constexpr bool is_periodic() noexcept { return Tag::PERIODIC; } - /// @brief Indicates if the BSplines are radial or not (should be deprecated soon because this concept is not in the scope of DDC). + /// @brief Indicates if the B-splines are radial or not (should be deprecated soon because this concept is not in the scope of DDC). static constexpr bool is_radial() noexcept { return false; } - /// @brief Indicates if the BSplines are uniform or not (this is the case here). + /// @brief Indicates if the B-splines are uniform or not (this is the case here). static constexpr bool is_uniform() noexcept { return true; @@ -84,21 +84,21 @@ class UniformBSplines : detail::UniformBSplinesBase ddc::DiscreteDomain m_domain; public: - /// @brief The type of discrete dimension representing the BSplines. + /// @brief The type of discrete dimension representing the B-splines. using discrete_dimension_type = UniformBSplines; - /// @brief The type of discrete domain identifying the BSplines. + /// @brief The type of discrete domain identifying the B-splines. using discrete_domain_type = DiscreteDomain; - /// @brief The type of discrete element identifying a BSpline. + /// @brief The type of discrete element identifying a B-spline. using discrete_element_type = DiscreteElement; - /// @brief The type of discrete vector representing an "indexes displacement" between two BSplines. + /// @brief The type of discrete vector representing an "indexes displacement" between two B-splines. using discrete_vector_type = DiscreteVector; Impl() = default; - /** Constructs a BSplines basis with n equidistant knots over \f$[a, b]\f$ + /** Constructs a B-splines basis with n equidistant knots over \f$[a, b]\f$ * * @param rmin the real ddc::coordinate of the first knot * @param rmax the real ddc::coordinate of the last knot @@ -137,11 +137,11 @@ class UniformBSplines : detail::UniformBSplinesBase /// @brief Move-assigns Impl& operator=(Impl&& x) = default; - /** @brief Evaluates BSplines at a given coordinate + /** @brief Evaluates B-splines at a given coordinate * - * The values are computed for every BSplines at the given coordinate x. A spline approximation at coordinate x is a linear combination of those BSplines evaluations weigthed with splines coefficients of the spline-transformed initial discrete function. - * @param[out] values The values of the BSplines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. - * @param[in] x The coordinate where BSplines are evaluated. + * The values are computed for every B-splines at the given coordinate x. A spline approximation at coordinate x is a linear combination of those B-splines evaluations weigthed with splines coefficients of the spline-transformed initial discrete function. + * @param[out] values The values of the B-splines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. + * @param[in] x The coordinate where B-splines are evaluated. * @return TODO */ KOKKOS_INLINE_FUNCTION discrete_element_type @@ -151,22 +151,22 @@ class UniformBSplines : detail::UniformBSplinesBase return eval_basis(values, x, degree()); } - /** @brief Evaluates BSplines derivatives at a given coordinate + /** @brief Evaluates B-splines derivatives at a given coordinate * - * The derivatives are computed for every BSplines at the given coordinate x. A spline approximation of a derivative at coordinate x is a linear combination of those BSplines derivatives weigthed with splines coefficients of the spline-transformed initial discrete function. - * @param[out] derivs The derivatives of the BSplines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. - * @param[in] x The coordinate where BSplines derivatives are evaluated. + * The derivatives are computed for every B-splines at the given coordinate x. A spline approximation of a derivative at coordinate x is a linear combination of those B-splines derivatives weigthed with splines coefficients of the spline-transformed initial discrete function. + * @param[out] derivs The derivatives of the B-splines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. + * @param[in] x The coordinate where B-splines derivatives are evaluated. * @return TODO */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_deriv(DSpan1D derivs, ddc::Coordinate const& x) const; - /** @brief Evaluates BSplines values and \f$n\f$ derivatives at a given coordinate + /** @brief Evaluates B-splines values and \f$n\f$ derivatives at a given coordinate * - * The values and derivatives are computed for every BSplines at the given coordinate x. - * @param[out] derivs The values and n derivatives of the BSplines evaluated at coordinate x. It has to be a (1+degree)*(1+n) 2D mdspan. - * @param[in] x The coordinates where BSplines derivatives are evaluated. - * @param[in] n The number of derivatives to evaluate (in addition to the BSplines values themselves). + * The values and derivatives are computed for every B-splines at the given coordinate x. + * @param[out] derivs The values and n derivatives of the B-splines evaluated at coordinate x. It has to be a (1+degree)*(1+n) 2D mdspan. + * @param[in] x The coordinates where B-splines derivatives are evaluated. + * @param[in] n The number of derivatives to evaluate (in addition to the B-splines values themselves). * @return TODO */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis_and_n_derivs( @@ -174,7 +174,7 @@ class UniformBSplines : detail::UniformBSplinesBase ddc::Coordinate const& x, std::size_t n) const; - /** @brief Compute the integrals of the BSplines. + /** @brief Compute the integrals of the B-splines. * * @param[out] int_vals The values of the integrals. It has to be a (1+nbasis) 1D mdspan. * @return The values of the integrals. @@ -184,7 +184,7 @@ class UniformBSplines : detail::UniformBSplinesBase integrals( ddc::ChunkSpan int_vals) const; - /** @brief Returns the coordinate of the knot corresponding to the given index for a BSpline. + /** @brief Returns the coordinate of the knot corresponding to the given index for a B-spline. * * @param[in] idx Integer identifying index of the knot. * @return Coordinate of the knot. @@ -194,9 +194,9 @@ class UniformBSplines : detail::UniformBSplinesBase return ddc::Coordinate(rmin() + idx * ddc::step()); } - /** @brief Returns the coordinate of the first support knot associated to a DiscreteElement identifying a BSpline. + /** @brief Returns the coordinate of the first support knot associated to a DiscreteElement identifying a B-spline. * - * @param[in] ix DiscreteElement identifying the BSpline. + * @param[in] ix DiscreteElement identifying the B-spline. * @return Coordinate of the knot. */ KOKKOS_INLINE_FUNCTION double get_first_support_knot(discrete_element_type const& ix) const @@ -204,9 +204,9 @@ class UniformBSplines : detail::UniformBSplinesBase return get_knot(ix.uid() - degree()); } - /** @brief Returns the coordinate of the last support knot associated to a DiscreteElement identifying a BSpline. + /** @brief Returns the coordinate of the last support knot associated to a DiscreteElement identifying a B-spline. * - * @param[in] ix DiscreteElement identifying the BSpline. + * @param[in] ix DiscreteElement identifying the B-spline. * @return Coordinate of the knot. */ KOKKOS_INLINE_FUNCTION double get_last_support_knot(discrete_element_type const& ix) const @@ -214,10 +214,10 @@ class UniformBSplines : detail::UniformBSplinesBase return get_knot(ix.uid() + 1); } - /** @brief Returns the coordinate of the \f$n\f$-th knot associated to a DiscreteElement identifying a BSpline. + /** @brief Returns the coordinate of the \f$n\f$-th knot associated to a DiscreteElement identifying a B-spline. * - * @param[in] ix DiscreteElement identifying the BSpline. - * @param[in] n Integer indexing a knot in the support of the BSpline. + * @param[in] ix DiscreteElement identifying the B-spline. + * @param[in] n Integer indexing a knot in the support of the B-spline. * @return Coordinate of the knot. */ KOKKOS_INLINE_FUNCTION double get_support_knot_n(discrete_element_type const& ix, int n) @@ -311,9 +311,9 @@ struct is_uniform_bsplines : public std::is_base_of constexpr bool is_uniform_bsplines_v = is_uniform_bsplines::value; @@ -426,8 +426,7 @@ KOKKOS_INLINE_FUNCTION ddc::DiscreteElement UniformBSplines::Impl< // 2. Compute index range of B-splines with support over cell 'icell' get_icell_and_offset(jmin, offset, x); - // 3. Recursively evaluate B-splines (see - // "sll_s_uniform_BSplines_eval_basis") + // 3. Recursively evaluate B-splines (eval_basis) // up to self%degree, and store them all in the upper-right triangle of // ndu double xx, temp, saved; From 937d4326fc94531aeb1a518631e809f0a406bc73 Mon Sep 17 00:00:00 2001 From: Baptiste Legouix Date: Fri, 19 Apr 2024 10:52:51 +0200 Subject: [PATCH 32/89] Update include/ddc/kernels/splines/bsplines_non_uniform.hpp Co-authored-by: EmilyBourne --- include/ddc/kernels/splines/bsplines_non_uniform.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index 02cf29dd9..68ad173f6 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -94,7 +94,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase /// @brief The type of discrete element identifying a BSpline. using discrete_element_type = DiscreteElement; - /// @brief The type of discrete vector representing an "indexes displacement" between two BSplines. + /// @brief The type of a discrete vector representing an "index displacement" between two B-splines. using discrete_vector_type = DiscreteVector; Impl() = default; From 9ffbe0439cc6e6f64ac9595aca528072b9574e3c Mon Sep 17 00:00:00 2001 From: blegouix Date: Fri, 19 Apr 2024 10:55:06 +0200 Subject: [PATCH 33/89] emily's review --- include/ddc/kernels/splines/bsplines_non_uniform.hpp | 8 ++++---- include/ddc/kernels/splines/bsplines_uniform.hpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index 85df1f5fd..b93e9b11e 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -85,16 +85,16 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase int m_nknots; public: - /// @brief The type of discrete dimension representing the B-splines. + /// @brief The type of the discrete dimension representing the B-splines. using discrete_dimension_type = NonUniformBSplines; - /// @brief The type of discrete domain identifying the B-splines. + /// @brief The type of a discrete domain identifying the B-splines. using discrete_domain_type = DiscreteDomain; - /// @brief The type of discrete element identifying a B-spline. + /// @brief The type of a discrete element identifying a B-spline. using discrete_element_type = DiscreteElement; - /// @brief The type of discrete vector representing an "indexes displacement" between two B-splines. + /// @brief The type of a discrete vector representing an "index displacement" between two B-splines. using discrete_vector_type = DiscreteVector; Impl() = default; diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index bd0354dbd..2cf34afad 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -84,16 +84,16 @@ class UniformBSplines : detail::UniformBSplinesBase ddc::DiscreteDomain m_domain; public: - /// @brief The type of discrete dimension representing the B-splines. + /// @brief The type of the discrete dimension representing the B-splines. using discrete_dimension_type = UniformBSplines; - /// @brief The type of discrete domain identifying the B-splines. + /// @brief The type of a discrete domain identifying the B-splines. using discrete_domain_type = DiscreteDomain; - /// @brief The type of discrete element identifying a B-spline. + /// @brief The type of a discrete element identifying a B-spline. using discrete_element_type = DiscreteElement; - /// @brief The type of discrete vector representing an "indexes displacement" between two B-splines. + /// @brief The type of a discrete vector representing an "index displacement" between two B-splines. using discrete_vector_type = DiscreteVector; Impl() = default; From 8c5c579841ac3c2a4b91ca941f09eaeb714472e5 Mon Sep 17 00:00:00 2001 From: blegouix Date: Fri, 19 Apr 2024 13:51:24 +0200 Subject: [PATCH 34/89] wip --- .../kernels/splines/bsplines_non_uniform.hpp | 75 +++++++++++++------ .../ddc/kernels/splines/bsplines_uniform.hpp | 71 +++++++++++++----- 2 files changed, 106 insertions(+), 40 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index b93e9b11e..34b19f826 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -31,7 +31,7 @@ struct NonUniformBSplinesBase /** * The type of a non-uniform B-splines 1D basis. * - * @tparam Tag The tag identifying the continuous dimension which supports the building of the B-splines. + * @tparam Tag The tag identifying the continuous dimension on which the support of the B-spline functions are defined. * @tparam D The degree of the B-splines. */ template @@ -40,7 +40,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase static_assert(D > 0, "Parameter `D` must be positive"); public: - /// @brief The tag identifying the continuous dimension which supports the building of the B-splines. + /// @brief The tag identifying the continuous dimension on which the support of the B-splines are defined. using tag_type = Tag; /// @brief The discrete dimension identifying B-splines. @@ -88,7 +88,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase /// @brief The type of the discrete dimension representing the B-splines. using discrete_dimension_type = NonUniformBSplines; - /// @brief The type of a discrete domain identifying the B-splines. + /// @brief The type of a discrete domain whose elements identify the B-splines. using discrete_domain_type = DiscreteDomain; /// @brief The type of a discrete element identifying a B-spline. @@ -138,33 +138,48 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase /// @brief Move-assigns Impl& operator=(Impl&& x) = default; - /** @brief Evaluates B-splines at a given coordinate + /** @brief Evaluates non-zero B-splines at a given coordinate. * - * The values are computed for every B-splines at the given coordinate x. A spline approximation at coordinate x is a linear combination of those B-splines evaluations weigthed with splines coefficients of the spline-transformed initial discrete function. - * @param[out] values The values of the B-splines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. + * The values are computed for every B-spline with support at the given coordinate x. There are only (degree+1) + * B-splines which are non-zero at any given point. It is these B-splines which are evaluated. + * This can be useful to calculate a spline approximation of a function. A spline approximation at coordinate x + * is a linear combination of these B-spline evaluations weighted with spline coefficients of the spline-transformed + * initial discrete function. + * + * @param[out] values The values of the B-splines evaluated at coordinate x. It has to be a 1D mdspan with (degree+1) elements. * @param[in] x The coordinate where B-splines are evaluated. - * @return TODO + * @return The index of the first B-spline which is evaluated. */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis(DSpan1D values, ddc::Coordinate const& x) const; - /** @brief Evaluates B-splines derivatives at a given coordinate + /** @brief Evaluates non-zero B-splines derivatives at a given coordinate + * + * The derivatives are computed for every B-splines with support at the given coordinate x. There are only (degree+1) + * B-splines which are non-zero at any given point. It is these B-splines which are derivated. + * A spline approximation of a derivative at coordinate x is a linear + * combination of those B-splines derivatives weigthed with splines coefficients of the spline-transformed + * initial discrete function. * - * The derivatives are computed for every B-splines at the given coordinate x. A spline approximation of a derivative at coordinate x is a linear combination of those B-splines derivatives weigthed with splines coefficients of the spline-transformed initial discrete function. - * @param[out] derivs The derivatives of the B-splines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. + * @param[out] derivs The derivatives of the B-splines evaluated at coordinate x. It has to be a 1D mdspan with (degree+1) elements. * @param[in] x The coordinate where B-splines derivatives are evaluated. - * @return TODO + * @return The index of the first B-spline which is derivated. */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_deriv(DSpan1D derivs, ddc::Coordinate const& x) const; - /** @brief Evaluates B-splines values and n derivatives at a given coordinate + /** @brief Evaluates non-zero B-splines values and \f$n\f$ derivatives at a given coordinate + * + * The values and derivatives are computed for every B-splines with support at the given coordinate x. There are only (degree+1) + * B-splines which are non-zero at any given point. It is these B-splines which are derivated. + * A spline approximation of a derivative at coordinate x is a linear + * combination of those B-splines derivatives weigthed with splines coefficients of the spline-transformed + * initial discrete function. * - * The values and derivatives are computed for every B-splines at the given coordinate x. - * @param[out] derivs The values and n derivatives of the B-splines evaluated at coordinate x. It has to be a (1+degree)*(1+n) 2D mdspan. - * @param[in] x The coordinates where B-splines derivatives are evaluated. + * @param[out] derivs The values and \f$n\f$ derivatives of the B-splines evaluated at coordinate x. It has to be a 2D mdspan with (degree+1)*(n+1) elements. + * @param[in] x The coordinate where B-splines derivatives are evaluated. * @param[in] n The number of derivatives to evaluate (in addition to the B-splines values themselves). - * @return TODO + * @return The index of the first B-spline which is evaluated/derivated. */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis_and_n_derivs( ddc::DSpan2D derivs, @@ -173,7 +188,9 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase /** @brief Compute the integrals of the B-splines. * - * @param[out] int_vals The values of the integrals. It has to be a (1+nbasis) 1D mdspan. + * The integral of each of the B-splines over their support within the domain on which this basis was defined. + * + * @param[out] int_vals The values of the integrals. It has to be a (nbasis) 1D mdspan. * @return The values of the integrals. */ template @@ -181,7 +198,12 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase integrals( ddc::ChunkSpan int_vals) const; - /** @brief Returns the coordinate of the knot corresponding to the given index for a B-spline. + /** @brief Returns the coordinate of the knot corresponding to the given index. + * + * Returns the coordinate of the knot corresponding to the given index for a B-spline. The domain + * over which the B-splines are defined is comprised of ncells+1 knots however there are a total of + * ncells+1+2*degree knots. The additional knots which control the shape of the B-splines near the + * boundary are added before and after the break points. The knot index is therefore in the interval [-degree, ncells+degree] * * @param[in] knot_idx Integer identifying index of the knot. * @return Coordinate of the knot. @@ -191,7 +213,11 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase return ddc::coordinate(ddc::DiscreteElement(knot_idx + degree())); } - /** @brief Returns the coordinate of the first support knot associated to a discrete_element identifying a B-spline. + /** @brief Returns the coordinate of the first support knot associated to a DiscreteElement identifying a B-spline. + * + * Each B-spline has a support defined over (degree+2) knots. For a B-spline identified by the + * provided DiscreteElement, this function returns the first knot in the support of the B-spline. + * In other words it returns the lower bound of the support. * * @param[in] ix DiscreteElement identifying the B-spline. * @return Coordinate of the knot. @@ -202,7 +228,11 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase return ddc::coordinate(ddc::DiscreteElement(ix.uid())); } - /** @brief Returns the coordinate of the last support knot associated to a discrete_element identifying a B-spline. + /** @brief Returns the coordinate of the last support knot associated to a DiscreteElement identifying a B-spline. + * + * Each B-spline has a support defined over (degree+2) knots. For a B-spline identified by the + * provided DiscreteElement, this function returns the last knot in the support of the B-spline. + * In other words it returns the upper bound of the support. * * @param[in] ix DiscreteElement identifying the B-spline. * @return Coordinate of the knot. @@ -213,7 +243,10 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase return ddc::coordinate(ddc::DiscreteElement(ix.uid() + degree() + 1)); } - /** @brief Returns the coordinate of the \f$n\f$-th knot associated to a DiscreteElement identifying a B-spline. + /** @brief Returns the coordinate of the first knot in the support of the identified B-spline. + * + * Each B-spline has a support defined over (degree+2) knots. For a B-spline identified by the + * provided DiscreteElement, this function returns the (n+1)-th knot in the support of the B-spline. * * @param[in] ix DiscreteElement identifying the B-spline. * @param[in] n Integer indexing a knot in the support of the B-spline. diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index 2cf34afad..692667d12 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -31,7 +31,7 @@ struct UniformBSplinesBase /** * The type of a uniform B-splines 1D basis. * - * @tparam Tag The tag identifying the continuous dimension which supports the building of the B-splines. + * @tparam Tag The tag identifying the continuous dimension on which the support of the B-spline functions are defined. * @tparam D The degree of the B-splines. */ template @@ -40,7 +40,7 @@ class UniformBSplines : detail::UniformBSplinesBase static_assert(D > 0, "Parameter `D` must be positive"); public: - /// @brief The tag identifying the continuous dimension which supports the building of the B-splines. + /// @brief The tag identifying the continuous dimension on which the support of the B-splines are defined. using tag_type = Tag; /// @brief The discrete dimension representing B-splines. @@ -87,7 +87,7 @@ class UniformBSplines : detail::UniformBSplinesBase /// @brief The type of the discrete dimension representing the B-splines. using discrete_dimension_type = UniformBSplines; - /// @brief The type of a discrete domain identifying the B-splines. + /// @brief The type of a discrete domain whose elements identify the B-splines. using discrete_domain_type = DiscreteDomain; /// @brief The type of a discrete element identifying a B-spline. @@ -137,12 +137,17 @@ class UniformBSplines : detail::UniformBSplinesBase /// @brief Move-assigns Impl& operator=(Impl&& x) = default; - /** @brief Evaluates B-splines at a given coordinate + /** @brief Evaluates non-zero B-splines at a given coordinate. * - * The values are computed for every B-splines at the given coordinate x. A spline approximation at coordinate x is a linear combination of those B-splines evaluations weigthed with splines coefficients of the spline-transformed initial discrete function. - * @param[out] values The values of the B-splines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. + * The values are computed for every B-spline with support at the given coordinate x. There are only (degree+1) + * B-splines which are non-zero at any given point. It is these B-splines which are evaluated. + * This can be useful to calculate a spline approximation of a function. A spline approximation at coordinate x + * is a linear combination of these B-spline evaluations weighted with spline coefficients of the spline-transformed + * initial discrete function. + * + * @param[out] values The values of the B-splines evaluated at coordinate x. It has to be a 1D mdspan with (degree+1) elements. * @param[in] x The coordinate where B-splines are evaluated. - * @return TODO + * @return The index of the first B-spline which is evaluated. */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis(DSpan1D values, ddc::Coordinate const& x) const @@ -151,23 +156,33 @@ class UniformBSplines : detail::UniformBSplinesBase return eval_basis(values, x, degree()); } - /** @brief Evaluates B-splines derivatives at a given coordinate + /** @brief Evaluates non-zero B-splines derivatives at a given coordinate + * + * The derivatives are computed for every B-splines with support at the given coordinate x. There are only (degree+1) + * B-splines which are non-zero at any given point. It is these B-splines which are derivated. + * A spline approximation of a derivative at coordinate x is a linear + * combination of those B-splines derivatives weigthed with splines coefficients of the spline-transformed + * initial discrete function. * - * The derivatives are computed for every B-splines at the given coordinate x. A spline approximation of a derivative at coordinate x is a linear combination of those B-splines derivatives weigthed with splines coefficients of the spline-transformed initial discrete function. - * @param[out] derivs The derivatives of the B-splines evaluated at coordinate x. It has to be a (1+degree) 1D mdspan. + * @param[out] derivs The derivatives of the B-splines evaluated at coordinate x. It has to be a 1D mdspan with (degree+1) elements. * @param[in] x The coordinate where B-splines derivatives are evaluated. - * @return TODO + * @return The index of the first B-spline which is evaluated. */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_deriv(DSpan1D derivs, ddc::Coordinate const& x) const; - /** @brief Evaluates B-splines values and \f$n\f$ derivatives at a given coordinate + /** @brief Evaluates non-zero B-splines values and \f$n\f$ derivatives at a given coordinate + * + * The values and derivatives are computed for every B-splines with support at the given coordinate x. There are only (degree+1) + * B-splines which are non-zero at any given point. It is these B-splines which are derivated. + * A spline approximation of a derivative at coordinate x is a linear + * combination of those B-splines derivatives weigthed with splines coefficients of the spline-transformed + * initial discrete function. * - * The values and derivatives are computed for every B-splines at the given coordinate x. - * @param[out] derivs The values and n derivatives of the B-splines evaluated at coordinate x. It has to be a (1+degree)*(1+n) 2D mdspan. - * @param[in] x The coordinates where B-splines derivatives are evaluated. + * @param[out] derivs The values and \f$n\f$ derivatives of the B-splines evaluated at coordinate x. It has to be a 2D mdspan with (degree+1)*(n+1) elements. + * @param[in] x The coordinate where B-splines derivatives are evaluated. * @param[in] n The number of derivatives to evaluate (in addition to the B-splines values themselves). - * @return TODO + * @return The index of the first B-spline which is evaluated. */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis_and_n_derivs( ddc::DSpan2D derivs, @@ -176,7 +191,9 @@ class UniformBSplines : detail::UniformBSplinesBase /** @brief Compute the integrals of the B-splines. * - * @param[out] int_vals The values of the integrals. It has to be a (1+nbasis) 1D mdspan. + * The integral of each of the B-splines over their support within the domain on which this basis was defined. + * + * @param[out] int_vals The values of the integrals. It has to be a (nbasis) 1D mdspan. * @return The values of the integrals. */ template @@ -184,7 +201,12 @@ class UniformBSplines : detail::UniformBSplinesBase integrals( ddc::ChunkSpan int_vals) const; - /** @brief Returns the coordinate of the knot corresponding to the given index for a B-spline. + /** @brief Returns the coordinate of the knot corresponding to the given index. + * + * Returns the coordinate of the knot corresponding to the given index for a B-spline. The domain + * over which the B-splines are defined is comprised of ncells+1 knots however there are a total of + * ncells+1+2*degree knots. The additional knots which control the shape of the B-splines near the + * boundary are added before and after the break points. The knot index is therefore in the interval [-degree, ncells+degree] * * @param[in] idx Integer identifying index of the knot. * @return Coordinate of the knot. @@ -195,6 +217,10 @@ class UniformBSplines : detail::UniformBSplinesBase } /** @brief Returns the coordinate of the first support knot associated to a DiscreteElement identifying a B-spline. + * + * Each B-spline has a support defined over (degree+2) knots. For a B-spline identified by the + * provided DiscreteElement, this function returns the first knot in the support of the B-spline. + * In other words it returns the lower bound of the support. * * @param[in] ix DiscreteElement identifying the B-spline. * @return Coordinate of the knot. @@ -205,6 +231,10 @@ class UniformBSplines : detail::UniformBSplinesBase } /** @brief Returns the coordinate of the last support knot associated to a DiscreteElement identifying a B-spline. + * + * Each B-spline has a support defined over (degree+2) knots. For a B-spline identified by the + * provided DiscreteElement, this function returns the last knot in the support of the B-spline. + * In other words it returns the upper bound of the support. * * @param[in] ix DiscreteElement identifying the B-spline. * @return Coordinate of the knot. @@ -214,7 +244,10 @@ class UniformBSplines : detail::UniformBSplinesBase return get_knot(ix.uid() + 1); } - /** @brief Returns the coordinate of the \f$n\f$-th knot associated to a DiscreteElement identifying a B-spline. + /** @brief Returns the coordinate of the first knot in the support of the identified B-spline. + * + * Each B-spline has a support defined over (degree+2) knots. For a B-spline identified by the + * provided DiscreteElement, this function returns the (n+1)-th knot in the support of the B-spline. * * @param[in] ix DiscreteElement identifying the B-spline. * @param[in] n Integer indexing a knot in the support of the B-spline. From 0589694d56089638578034a187d616a85c22cf50 Mon Sep 17 00:00:00 2001 From: Baptiste Legouix Date: Mon, 22 Apr 2024 09:34:04 +0200 Subject: [PATCH 35/89] Update include/ddc/kernels/splines/bsplines_non_uniform.hpp Co-authored-by: Thomas Padioleau --- include/ddc/kernels/splines/bsplines_non_uniform.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index 34b19f826..9d0db9074 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -59,7 +59,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase } /// @brief Indicates if the B-splines are radial or not (should be deprecated soon because this concept is not in the scope of DDC). - static constexpr bool is_radial() noexcept + [[deprecated]] static constexpr bool is_radial() noexcept { return false; } From ffe161efcd9f2b262398fce4dc27eb6d249ea3ce Mon Sep 17 00:00:00 2001 From: blegouix Date: Mon, 22 Apr 2024 10:13:10 +0200 Subject: [PATCH 36/89] wip --- include/ddc/kernels/splines/bsplines_non_uniform.hpp | 2 +- include/ddc/kernels/splines/bsplines_uniform.hpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index 34b19f826..05a4c8872 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -200,7 +200,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase /** @brief Returns the coordinate of the knot corresponding to the given index. * - * Returns the coordinate of the knot corresponding to the given index for a B-spline. The domain + * Returns the coordinate of the knot corresponding to the given index. The domain * over which the B-splines are defined is comprised of ncells+1 knots however there are a total of * ncells+1+2*degree knots. The additional knots which control the shape of the B-splines near the * boundary are added before and after the break points. The knot index is therefore in the interval [-degree, ncells+degree] diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index 692667d12..cfd499804 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -203,15 +203,15 @@ class UniformBSplines : detail::UniformBSplinesBase /** @brief Returns the coordinate of the knot corresponding to the given index. * - * Returns the coordinate of the knot corresponding to the given index for a B-spline. The domain + * Returns the coordinate of the knot corresponding to the given index. The domain * over which the B-splines are defined is comprised of ncells+1 knots however there are a total of * ncells+1+2*degree knots. The additional knots which control the shape of the B-splines near the * boundary are added before and after the break points. The knot index is therefore in the interval [-degree, ncells+degree] * - * @param[in] idx Integer identifying index of the knot. + * @param[in] knot_idx Integer identifying index of the knot. * @return Coordinate of the knot. */ - KOKKOS_INLINE_FUNCTION ddc::Coordinate get_knot(int idx) const noexcept + KOKKOS_INLINE_FUNCTION ddc::Coordinate get_knot(int knot_idx) const noexcept { return ddc::Coordinate(rmin() + idx * ddc::step()); } From f853bca264c4072c0d03b78d72b8238316a71730 Mon Sep 17 00:00:00 2001 From: blegouix Date: Mon, 22 Apr 2024 11:32:45 +0200 Subject: [PATCH 37/89] reviews --- .../kernels/splines/bsplines_non_uniform.hpp | 57 ++++++++++++------- .../ddc/kernels/splines/bsplines_uniform.hpp | 49 ++++++++++------ 2 files changed, 67 insertions(+), 39 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index 79e78bdf8..dae5c9b88 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -59,7 +59,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase } /// @brief Indicates if the B-splines are radial or not (should be deprecated soon because this concept is not in the scope of DDC). - [[deprecated]] static constexpr bool is_radial() noexcept + [[deprecated]] static constexpr bool is_radial() noexcept { return false; } @@ -70,7 +70,11 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase return false; } - /// @brief Impl TODO + /** @brief Impl Storage class of the static attributes of the discrete dimension. + * + * @tparam DDim The name of the discrete dimension. + * @tparam MemorySpace The Kokkos memory space where the attributes are being stored. + */ template class Impl { @@ -190,7 +194,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase * * The integral of each of the B-splines over their support within the domain on which this basis was defined. * - * @param[out] int_vals The values of the integrals. It has to be a (nbasis) 1D mdspan. + * @param[out] int_vals The values of the integrals. It has to be a 1D mdspan of size (nbasis). * @return The values of the integrals. */ template @@ -259,74 +263,85 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase return ddc::coordinate(ddc::DiscreteElement(ix.uid() + n)); } - /** @brief Returns the coordinate of the lower boundary knot. + /** @brief Returns the coordinate of the lower bound of the domain on which the B-splines are defined. * - * @return Coordinate of the lower boundary knot. + * @return Coordinate of the lower bound of the domain. */ KOKKOS_INLINE_FUNCTION ddc::Coordinate rmin() const noexcept { return get_knot(0); } - /** @brief Returns the coordinate of the upper boundary knot. + /** @brief Returns the coordinate of the upper bound of the domain on which the B-splines are defined. * - * @return Coordinate of the upper boundary knot. + * @return Coordinate of the upper bound of the domain. */ KOKKOS_INLINE_FUNCTION ddc::Coordinate rmax() const noexcept { return get_knot(ncells()); } - /** @brief Returns the length of the domain supporting knots. + /** @brief Returns the length of the domain. * - * @return The length of the domain supporting knots. + * @return The length of the domain. */ KOKKOS_INLINE_FUNCTION double length() const noexcept { return rmax() - rmin(); } - /** @brief TODO + /** @brief Returns the number of elements necessary to construct a spline representation of a function. + * + * For a non-periodic domain the number of elements necessary to construct a spline representation of a function + * is equal to the number of basis functions. However in the periodic case it additionally includes degree additional elements + * which allow the first B-splines to be evaluated close to rmax (where they also appear due to the periodicity). * - * @return TODO. + * @return The number of elements necessary to construct a spline representation of a function. */ KOKKOS_INLINE_FUNCTION std::size_t size() const noexcept { return degree() + ncells(); } - /** @brief Returns the discrete domain including ghost bsplines + /** @brief Returns the discrete domain including eventual additionnal bsplines in the periodic case. See size(). * - * @return The discrete domain including ghost bsplines. + * @return The discrete domain including eventual additionnal bsplines. */ KOKKOS_INLINE_FUNCTION discrete_domain_type full_domain() const { return discrete_domain_type(discrete_element_type(0), discrete_vector_type(size())); } - /** @brief TODO + /** @brief The number of break points + * + * The number of break points or cell boundaries. * - * @return TODO + * @return The number of break points */ KOKKOS_INLINE_FUNCTION std::size_t npoints() const noexcept { return m_nknots - 2 * degree(); } - /** @brief TODO + /** @brief Returns the number of basis functions. * - * @return TODO + * The number of functions in the spline basis. + * + * @return The number of basis functions. */ KOKKOS_INLINE_FUNCTION std::size_t nbasis() const noexcept { return ncells() + !is_periodic() * degree(); } - /** @brief TODO + /** @brief Returns the number of cells over which the B-splines are defined. + * + * The number of cells over which the B-splines and any spline representation are defined. + * In other words the number of polynomials that comprise a spline representation on the domain where the basis is defined. * - * @return TODO + * @return The number of cells over which the B-splines are defined. */ - KOKKOS_INLINE_FUNCTION std::size_t ncells() const noexcept + KOKKOS_INLINE_FUNCTIO std::size_t ncells() const noexcept { return npoints() - 1; } @@ -342,7 +357,7 @@ struct is_non_uniform_bsplines : public std::is_base_of class Impl { @@ -193,7 +197,7 @@ class UniformBSplines : detail::UniformBSplinesBase * * The integral of each of the B-splines over their support within the domain on which this basis was defined. * - * @param[out] int_vals The values of the integrals. It has to be a (nbasis) 1D mdspan. + * @param[out] int_vals The values of the integrals. It has to be a 1D mdspan of size (nbasis). * @return The values of the integrals. */ template @@ -259,63 +263,72 @@ class UniformBSplines : detail::UniformBSplinesBase return get_knot(ix.uid() + n - degree()); } - /** @brief Returns the coordinate of the lower boundary knot. + /** @brief Returns the coordinate of the lower bound of the domain on which the B-splines are defined. * - * @return Coordinate of the lower boundary knot. + * @return Coordinate of the lower bound of the domain. */ KOKKOS_INLINE_FUNCTION ddc::Coordinate rmin() const noexcept { return ddc::coordinate(m_domain.front()); } - /** @brief Returns the coordinate of the upper boundary knot. + /** @brief Returns the coordinate of the upper bound of the domain on which the B-splines are defined. * - * @return Coordinate of the upper boundary knot. + * @return Coordinate of the upper bound of the domain. */ KOKKOS_INLINE_FUNCTION ddc::Coordinate rmax() const noexcept { return ddc::coordinate(m_domain.back()); } - /** @brief Returns the length of the domain supporting knots. + /** @brief Returns the length of the domain. * - * @return The length of the domain supporting knots. + * @return The length of the domain. */ KOKKOS_INLINE_FUNCTION double length() const noexcept { return rmax() - rmin(); } - /** @brief TODO (number of knots ?). + /** @brief Returns the number of elements necessary to construct a spline representation of a function. * - * @return TODO. + * For a non-periodic domain the number of elements necessary to construct a spline representation of a function + * is equal to the number of basis functions. However in the periodic case it additionally includes degree additional elements + * which allow the first B-splines to be evaluated close to rmax (where they also appear due to the periodicity). + * + * @return The number of elements necessary to construct a spline representation of a function. */ KOKKOS_INLINE_FUNCTION std::size_t size() const noexcept { return degree() + ncells(); } - /** @brief Returns the discrete domain including ghost bsplines + /** @brief Returns the discrete domain including eventual additionnal bsplines in the periodic case. See size(). * - * @return The discrete domain including ghost bsplines. + * @return The discrete domain including eventual additionnal bsplines. */ KOKKOS_INLINE_FUNCTION discrete_domain_type full_domain() const { return discrete_domain_type(discrete_element_type(0), discrete_vector_type(size())); } - /** @brief TODO + /** @brief Returns the number of basis functions. + * + * The number of functions in the spline basis. * - * @return TODO + * @return The number of basis functions. */ KOKKOS_INLINE_FUNCTION std::size_t nbasis() const noexcept { return ncells() + !is_periodic() * degree(); } - /** @brief TODO + /** @brief Returns the number of cells over which the B-splines are defined. + * + * The number of cells over which the B-splines and any spline representation are defined. + * In other words the number of polynomials that comprise a spline representation on the domain where the basis is defined. * - * @return TODO + * @return The number of cells over which the B-splines are defined. */ KOKKOS_INLINE_FUNCTION std::size_t ncells() const noexcept { @@ -344,7 +357,7 @@ struct is_uniform_bsplines : public std::is_base_of Date: Mon, 22 Apr 2024 12:32:16 +0200 Subject: [PATCH 38/89] typo --- include/ddc/kernels/splines/bsplines_non_uniform.hpp | 2 +- include/ddc/kernels/splines/bsplines_uniform.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index dae5c9b88..1173e42bc 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -247,7 +247,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase return ddc::coordinate(ddc::DiscreteElement(ix.uid() + degree() + 1)); } - /** @brief Returns the coordinate of the first knot in the support of the identified B-spline. + /** @brief Returns the coordinate of the (n+1)-th knot in the support of the identified B-spline. * * Each B-spline has a support defined over (degree+2) knots. For a B-spline identified by the * provided DiscreteElement, this function returns the (n+1)-th knot in the support of the B-spline. diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index 5ff0e4dc9..13d4726f4 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -248,7 +248,7 @@ class UniformBSplines : detail::UniformBSplinesBase return get_knot(ix.uid() + 1); } - /** @brief Returns the coordinate of the first knot in the support of the identified B-spline. + /** @brief Returns the coordinate of the (n+1)-th knot in the support of the identified B-spline. * * Each B-spline has a support defined over (degree+2) knots. For a B-spline identified by the * provided DiscreteElement, this function returns the (n+1)-th knot in the support of the B-spline. From 65c221e1442ecddaeaab7beb05f0e57096104773 Mon Sep 17 00:00:00 2001 From: blegouix Date: Mon, 22 Apr 2024 12:34:02 +0200 Subject: [PATCH 39/89] fix --- include/ddc/kernels/splines/bsplines_non_uniform.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index 1173e42bc..13a0ecb17 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -341,7 +341,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase * * @return The number of cells over which the B-splines are defined. */ - KOKKOS_INLINE_FUNCTIO std::size_t ncells() const noexcept + KOKKOS_INLINE_FUNCTION std::size_t ncells() const noexcept { return npoints() - 1; } From 49b9b01a01751445c260bb219c9c84f62031c1fc Mon Sep 17 00:00:00 2001 From: blegouix Date: Mon, 22 Apr 2024 12:38:04 +0200 Subject: [PATCH 40/89] minor --- include/ddc/kernels/splines/bsplines_non_uniform.hpp | 6 +++--- include/ddc/kernels/splines/bsplines_uniform.hpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index 13a0ecb17..e6022fce0 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -92,13 +92,13 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase /// @brief The type of the discrete dimension representing the B-splines. using discrete_dimension_type = NonUniformBSplines; - /// @brief The type of a discrete domain whose elements identify the B-splines. + /// @brief The type of a DiscreteDomain whose elements identify the B-splines. using discrete_domain_type = DiscreteDomain; - /// @brief The type of a discrete element identifying a B-spline. + /// @brief The type of a DiscreteElement identifying a B-spline. using discrete_element_type = DiscreteElement; - /// @brief The type of a discrete vector representing an "index displacement" between two B-splines. + /// @brief The type of a DiscreteVector representing an "index displacement" between two B-splines. using discrete_vector_type = DiscreteVector; Impl() = default; diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index 13d4726f4..4194fc377 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -91,13 +91,13 @@ class UniformBSplines : detail::UniformBSplinesBase /// @brief The type of the discrete dimension representing the B-splines. using discrete_dimension_type = UniformBSplines; - /// @brief The type of a discrete domain whose elements identify the B-splines. + /// @brief The type of a DiscreteDomain whose elements identify the B-splines. using discrete_domain_type = DiscreteDomain; - /// @brief The type of a discrete element identifying a B-spline. + /// @brief The type of a DiscreteElement identifying a B-spline. using discrete_element_type = DiscreteElement; - /// @brief The type of a discrete vector representing an "index displacement" between two B-splines. + /// @brief The type of a DiscreteVector representing an "index displacement" between two B-splines. using discrete_vector_type = DiscreteVector; Impl() = default; From 195dc501fa1873c07e9eaa7e237af31301fd8654 Mon Sep 17 00:00:00 2001 From: blegouix Date: Mon, 22 Apr 2024 12:50:13 +0200 Subject: [PATCH 41/89] more details on uniformity --- include/ddc/kernels/splines/bsplines_non_uniform.hpp | 3 +++ include/ddc/kernels/splines/bsplines_uniform.hpp | 2 ++ 2 files changed, 5 insertions(+) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index e6022fce0..3a740809f 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -31,6 +31,9 @@ struct NonUniformBSplinesBase /** * The type of a non-uniform B-splines 1D basis. * + * Knots for non-uniform B-splines are non-uniformly distributed (no assumption is made on the uniformity of their distribution, + * the associated discrete dimension is a NonUniformPointSampling). + * * @tparam Tag The tag identifying the continuous dimension on which the support of the B-spline functions are defined. * @tparam D The degree of the B-splines. */ diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index 4194fc377..6c47b930e 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -31,6 +31,8 @@ struct UniformBSplinesBase /** * The type of a uniform B-splines 1D basis. * + * Knots for non-uniform B-splines basis are non-uniformly distributed (no assumption is made on the uniformity of their distribution). + * * @tparam Tag The tag identifying the continuous dimension on which the support of the B-spline functions are defined. * @tparam D The degree of the B-splines. */ From bae41cc7d22ed5464a816d64484655ad14d2bd10 Mon Sep 17 00:00:00 2001 From: blegouix Date: Mon, 22 Apr 2024 13:13:33 +0200 Subject: [PATCH 42/89] non-uniform constructors --- .../kernels/splines/bsplines_non_uniform.hpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index 3a740809f..5d86051d3 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -106,19 +106,30 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase Impl() = default; - /// @brief Construct a `Impl` using a brace-list, i.e. `Impl bsplines({0., 1.})` + /** @brief Constructs an Impl using a brace-list, i.e. `Impl bsplines({0., 1.})` + * + * The brace-list is usually the iterable list of knots. However, only the first and last + * indexes of the elements of the lists are effectively used by the constructor to build the Impl. + */ explicit Impl(std::initializer_list> breaks) : Impl(breaks.begin(), breaks.end()) { } - /// @brief Construct a `Impl` using a C++20 "common range". + /** @brief Constructs an Impl using a std::vector. + * + * The std::vector is usually the iterable list of knots. However, only the first and last + * indexes of the elements of the lists are effectively used by the constructor to build the Impl. + */ explicit Impl(std::vector> const& breaks) : Impl(breaks.begin(), breaks.end()) { } - /// @brief Construct a `Impl` using a pair of iterators. + /** @brief Construct a `Impl` using a pair of iterators. + * + * The (lower and upper) iterators are used to build the DiscreteDomain indexing the B-splines. + */ template Impl(RandomIt breaks_begin, RandomIt breaks_end); From e702a5be835d9558fe5cc27ee3d1985bfd36d125 Mon Sep 17 00:00:00 2001 From: blegouix Date: Mon, 22 Apr 2024 13:17:06 +0200 Subject: [PATCH 43/89] minor --- include/ddc/kernels/splines/bsplines_non_uniform.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index 5d86051d3..ab3d11362 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -126,7 +126,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase { } - /** @brief Construct a `Impl` using a pair of iterators. + /** @brief Constructs a Impl using a pair of iterators. * * The (lower and upper) iterators are used to build the DiscreteDomain indexing the B-splines. */ From f31ab4a8d8c3ebf1e710fb5f515f89a46c73e1ff Mon Sep 17 00:00:00 2001 From: blegouix Date: Mon, 22 Apr 2024 13:53:07 +0200 Subject: [PATCH 44/89] non_uniform constructors again --- include/ddc/kernels/splines/bsplines_non_uniform.hpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index ab3d11362..cdde6409c 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -108,8 +108,8 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase /** @brief Constructs an Impl using a brace-list, i.e. `Impl bsplines({0., 1.})` * - * The brace-list is usually the iterable list of knots. However, only the first and last - * indexes of the elements of the lists are effectively used by the constructor to build the Impl. + * The brace-list is the list of break points. It is used to build the DiscreteDomain indexing + * the knots and iterated over to build the knots coordinates list and initialize the associated DiscreteSpace. */ explicit Impl(std::initializer_list> breaks) : Impl(breaks.begin(), breaks.end()) @@ -118,8 +118,8 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase /** @brief Constructs an Impl using a std::vector. * - * The std::vector is usually the iterable list of knots. However, only the first and last - * indexes of the elements of the lists are effectively used by the constructor to build the Impl. + * The std::vector is the list of break points. It is used to build the DiscreteDomain indexing + * the knots and iterated over to build the knots coordinates list and initialize the associated DiscreteSpace. */ explicit Impl(std::vector> const& breaks) : Impl(breaks.begin(), breaks.end()) @@ -128,7 +128,8 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase /** @brief Constructs a Impl using a pair of iterators. * - * The (lower and upper) iterators are used to build the DiscreteDomain indexing the B-splines. + * The iterators are used to build the DiscreteDomain indexing the knots, build the knots list + * and initialize the associated DiscreteSpace. */ template Impl(RandomIt breaks_begin, RandomIt breaks_end); From f180f4d9bf3db6952e5d769362c78c5268f59960 Mon Sep 17 00:00:00 2001 From: blegouix Date: Mon, 22 Apr 2024 15:00:43 +0200 Subject: [PATCH 45/89] wip --- .../ddc/kernels/splines/spline_builder.hpp | 4 ++- .../ddc/kernels/splines/spline_builder_2d.hpp | 27 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index b2b112d59..4e0859b7f 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -23,10 +23,11 @@ enum class SplineSolver { GINKGO }; * @brief An helper giving the uniform/non_uniform status of a spline interpolation mesh according to its attributes. * * An helper giving the uniform/non_uniform status of a spline interpolation mesh according to its attributes. + * * @param is_uniform A boolean giving the presumed status before considering boundary conditions. * @param BcXmin The lower boundary condition. * @param BcXmax The upper boundary condition. - * @param int The degree of the spline. + * @param degree The degree of the spline. */ constexpr bool is_spline_interpolation_mesh_uniform( bool const is_uniform, @@ -214,6 +215,7 @@ class SplineBuilder * * @param batched_interpolation_domain The domain on which are defined the interpolation points. * @param cols_per_chunk An hyperparameter used by the slicer (internal to the solver) to define the size of a chunk of right-and-sides of the linear problem to be computed in parallel. + * @param preconditionner_max_block_size An hyperparameter used by the slicer (internal to the solver) to define the size of a block used by Block-Jacobi preconditionner. */ explicit SplineBuilder( batched_interpolation_domain_type const& batched_interpolation_domain, diff --git a/include/ddc/kernels/splines/spline_builder_2d.hpp b/include/ddc/kernels/splines/spline_builder_2d.hpp index 872bf2956..ae3cfc178 100644 --- a/include/ddc/kernels/splines/spline_builder_2d.hpp +++ b/include/ddc/kernels/splines/spline_builder_2d.hpp @@ -120,25 +120,45 @@ class SplineBuilder2D using interpolation_domain_type = ddc::DiscreteDomain; + /** + * @brief The type of the whole domain representing interpolation points. + */ using batched_interpolation_domain_type = ddc::DiscreteDomain; + /** + * @brief The type of the batch domain (obtained by removing dimensions of interests from whole space). + */ using batch_domain_type = ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq>>; + /** + * @brief The type of the whole spline domain (cartesian product of 2D spline domain and batch domain) preserving the underlying memory layout (order of dimensions). + */ using batched_spline_domain_type = ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, ddc::detail::TypeSeq>>; + /** + * @brief The type of the whole Derivs domain (cartesian product of the 1D Deriv domain and the associated batch domain) in the first dimension used by the class, preserving the underlying memory layout (order of dimensions). + */ using batched_derivs_domain_type1 = typename builder_type1::batched_derivs_domain_type; + + /** + * @brief The type of the whole Derivs domain (cartesian product of the 1D Deriv domain and the associated batch domain) in the second dimension used by the class, preserving the underlying memory layout (order of dimensions). + */ using batched_derivs_domain_type2 = ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, ddc::detail::TypeSeq>>; + + /** + * @brief The type of the whole Derivs domain (cartesian product of the 2D Deriv domain and the batch domain) in the second dimension used by the class, preserving the underlying memory layout (order of dimensions). + */ using batched_derivs_domain_type = ddc::detail::convert_type_seq_to_discrete_domain, @@ -251,6 +271,13 @@ class SplineBuilder2D ddc::discrete_space().full_domain()); } + /** + * @brief Get the whole domain on which spline coefficients are defined, preserving memory layout. + * + * Get the whole domain on which spline coefficients will be computed, preserving memory layout (order of dimensions). + * + * @return The domain for the spline coefficients. + */ batched_spline_domain_type batched_spline_domain() const noexcept { return ddc::replace_dim_of( From 1484581e7369c4fa4ac707090f0b23806204bcd1 Mon Sep 17 00:00:00 2001 From: blegouix Date: Mon, 22 Apr 2024 16:20:14 +0200 Subject: [PATCH 46/89] wip on CI --- .../kernels/splines/bsplines_non_uniform.hpp | 45 +++++++++++++++---- .../ddc/kernels/splines/bsplines_uniform.hpp | 45 +++++++++++++++---- 2 files changed, 72 insertions(+), 18 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index cdde6409c..b38fb0ca7 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -49,25 +49,37 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase /// @brief The discrete dimension identifying B-splines. using discrete_dimension_type = NonUniformBSplines; - /// @brief The degree of B-splines. + /** @brief The degree of B-splines. + * + * @return The degree. + */ static constexpr std::size_t degree() noexcept { return D; } - /// @brief Indicates if the B-splines are periodic or not. + /** @brief Indicates if the B-splines are periodic or not. + * + * @return A boolean indicating if the B-splines are periodic or not. + */ static constexpr bool is_periodic() noexcept { return Tag::PERIODIC; } - /// @brief Indicates if the B-splines are radial or not (should be deprecated soon because this concept is not in the scope of DDC). + /** @brief Indicates if the B-splines are radial or not (should be deprecated soon because this concept is not in the scope of DDC). + * + * @return A boolean indicating if the dimension is radial or not. + */ [[deprecated]] static constexpr bool is_radial() noexcept { return false; } - /// @brief Indicates if the B-splines are uniform or not (this is not the case here). + /** @brief Indicates if the B-splines are uniform or not (this is not the case here). + * + * @return A boolean indicating if the B-splines are uniform or not. + */ static constexpr bool is_uniform() noexcept { return false; @@ -134,7 +146,10 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase template Impl(RandomIt breaks_begin, RandomIt breaks_end); - /// @brief Copy-constructs from another Impl with different Kokkos memory space + /** @brief Copy-constructs from another Impl with different Kokkos memory space + * + * @param A reference to the other Impl + */ template explicit Impl(Impl const& impl) : m_domain(impl.m_domain) @@ -142,19 +157,31 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase { } - /// @brief Copy-constructs + /** @brief Copy-constructs + * + * @param A reference to another Impl + */ Impl(Impl const& x) = default; - /// @brief Move-constructs + /** @brief Move-constructs + * + * @param An rvalue to another Impl + */ Impl(Impl&& x) = default; /// @brief Destructs ~Impl() = default; - /// @brief Copy-assigns + /** @brief Copy-assigns + * + * @param A reference to another Impl + */ Impl& operator=(Impl const& x) = default; - /// @brief Move-assigns + /** @brief Move-assigns + * + * @param An rvalue to another Impl + */ Impl& operator=(Impl&& x) = default; /** @brief Evaluates non-zero B-splines at a given coordinate. diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index 6c47b930e..f9ab5ac28 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -48,25 +48,37 @@ class UniformBSplines : detail::UniformBSplinesBase /// @brief The discrete dimension representing B-splines. using discrete_dimension_type = UniformBSplines; - /// @brief The degree of B-splines. + /** @brief The degree of B-splines. + * + * @return The degree. + */ static constexpr std::size_t degree() noexcept { return D; } - /// @brief Indicates if the B-splines are periodic or not. + /** @brief Indicates if the B-splines are periodic or not. + * + * @return A boolean indicating if the B-splines are periodic or not. + */ static constexpr bool is_periodic() noexcept { return Tag::PERIODIC; } - /// @brief Indicates if the B-splines are radial or not (should be deprecated soon because this concept is not in the scope of DDC). + /** @brief Indicates if the B-splines are radial or not (should be deprecated soon because this concept is not in the scope of DDC). + * + * @return A boolean indicating if the dimension is radial or not. + */ [[deprecated]] static constexpr bool is_radial() noexcept { return false; } - /// @brief Indicates if the B-splines are uniform or not (this is the case here). + /** @brief Indicates if the B-splines are uniform or not (this is the case here). + * + * @return A boolean indicating if the B-splines are uniform or not. + */ static constexpr bool is_uniform() noexcept { return true; @@ -122,25 +134,40 @@ class UniformBSplines : detail::UniformBSplinesBase mesh_type>(rmin, rmax, ddc::DiscreteVector(ncells + 1))); } - /// @brief Copy-constructs from another Impl with different Kokkos memory space + /** @brief Copy-constructs from another Impl with different Kokkos memory space + * + * @param A reference to the other Impl + */ template explicit Impl(Impl const& impl) : m_domain(impl.m_domain) { } - /// @brief Copy-constructs + /** @brief Copy-constructs + * + * @param A reference to another Impl + */ Impl(Impl const& x) = default; - /// @brief Move-constructs + /** @brief Move-constructs + * + * @param An rvalue to another Impl + */ Impl(Impl&& x) = default; /// @brief Destructs ~Impl() = default; - /// @brief Copy-assigns + /** @brief Copy-assigns + * + * @param A reference to another Impl + */ Impl& operator=(Impl const& x) = default; - /// @brief Move-assigns + /** @brief Move-assigns + * + * @param An rvalue to another Impl + */ Impl& operator=(Impl&& x) = default; /** @brief Evaluates non-zero B-splines at a given coordinate. From 792b7f1ca1daf3ff6f5761b15ecb9d69a066441a Mon Sep 17 00:00:00 2001 From: blegouix Date: Mon, 22 Apr 2024 16:34:46 +0200 Subject: [PATCH 47/89] wip on CI --- .../kernels/splines/bsplines_non_uniform.hpp | 17 ++++++++++++----- .../ddc/kernels/splines/bsplines_uniform.hpp | 10 +++++----- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index d8b114930..7139297c9 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -113,6 +113,8 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase * * The brace-list is the list of break points. It is used to build the DiscreteDomain indexing * the knots and iterated over to build the knots coordinates list and initialize the associated DiscreteSpace. + * + * @param breaks The std::initializer_list of the coordinates of break points. */ explicit Impl(std::initializer_list> breaks) : Impl(breaks.begin(), breaks.end()) @@ -123,6 +125,8 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase * * The std::vector is the list of break points. It is used to build the DiscreteDomain indexing * the knots and iterated over to build the knots coordinates list and initialize the associated DiscreteSpace. + * + * @param breaks The std::vector of the coordinates of break points. */ explicit Impl(std::vector> const& breaks) : Impl(breaks.begin(), breaks.end()) @@ -133,13 +137,16 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase * * The iterators are used to build the DiscreteDomain indexing the knots, build the knots list * and initialize the associated DiscreteSpace. + * + * @param breaks_begin The iterator to begin with to iterate on break points. + * @param breaks_end The iterator to end with to iterate on break points. */ template Impl(RandomIt breaks_begin, RandomIt breaks_end); /** @brief Copy-constructs from another Impl with different Kokkos memory space * - * @param A reference to the other Impl + * @param impl A reference to the other Impl */ template explicit Impl(Impl const& impl) @@ -150,13 +157,13 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase /** @brief Copy-constructs * - * @param A reference to another Impl + * @param x A reference to another Impl */ Impl(Impl const& x) = default; /** @brief Move-constructs * - * @param An rvalue to another Impl + * @param x An rvalue to another Impl */ Impl(Impl&& x) = default; @@ -165,13 +172,13 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase /** @brief Copy-assigns * - * @param A reference to another Impl + * @param x A reference to another Impl */ Impl& operator=(Impl const& x) = default; /** @brief Move-assigns * - * @param An rvalue to another Impl + * @param x An rvalue to another Impl */ Impl& operator=(Impl&& x) = default; diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index 570f4cc8e..982fb7415 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -127,7 +127,7 @@ class UniformBSplines : detail::UniformBSplinesBase /** @brief Copy-constructs from another Impl with different Kokkos memory space * - * @param A reference to the other Impl + * @param impl A reference to the other Impl */ template explicit Impl(Impl const& impl) : m_domain(impl.m_domain) @@ -136,13 +136,13 @@ class UniformBSplines : detail::UniformBSplinesBase /** @brief Copy-constructs * - * @param A reference to another Impl + * @param x A reference to another Impl */ Impl(Impl const& x) = default; /** @brief Move-constructs * - * @param An rvalue to another Impl + * @param x An rvalue to another Impl */ Impl(Impl&& x) = default; @@ -151,13 +151,13 @@ class UniformBSplines : detail::UniformBSplinesBase /** @brief Copy-assigns * - * @param A reference to another Impl + * @param x A reference to another Impl */ Impl& operator=(Impl const& x) = default; /** @brief Move-assigns * - * @param An rvalue to another Impl + * @param x An rvalue to another Impl */ Impl& operator=(Impl&& x) = default; From e516124f620f0a04f969966e73f3c2e254b4edff Mon Sep 17 00:00:00 2001 From: blegouix Date: Mon, 22 Apr 2024 17:40:46 +0200 Subject: [PATCH 48/89] CI, integrals doxygen tracking still wrong --- include/ddc/kernels/splines/bsplines_non_uniform.hpp | 2 ++ include/ddc/kernels/splines/bsplines_uniform.hpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index 7139297c9..4ec0315dc 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -173,12 +173,14 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase /** @brief Copy-assigns * * @param x A reference to another Impl + * @return A reference to the copy Impl */ Impl& operator=(Impl const& x) = default; /** @brief Move-assigns * * @param x An rvalue to another Impl + * @return A reference to the moved Impl */ Impl& operator=(Impl&& x) = default; diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index 982fb7415..2e7680a2e 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -152,12 +152,14 @@ class UniformBSplines : detail::UniformBSplinesBase /** @brief Copy-assigns * * @param x A reference to another Impl + * @return A reference to the copy Impl */ Impl& operator=(Impl const& x) = default; /** @brief Move-assigns * * @param x An rvalue to another Impl + * @return A reference to the moved Impl */ Impl& operator=(Impl&& x) = default; From a0baf93d5bbbcd4230c75acbe2f2bf5da711b300 Mon Sep 17 00:00:00 2001 From: blegouix Date: Mon, 22 Apr 2024 17:42:28 +0200 Subject: [PATCH 49/89] fix --- include/ddc/kernels/splines/bsplines_uniform.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index 2e7680a2e..30b4eac71 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -239,7 +239,7 @@ class UniformBSplines : detail::UniformBSplinesBase */ KOKKOS_INLINE_FUNCTION ddc::Coordinate get_knot(int knot_idx) const noexcept { - return ddc::Coordinate(rmin() + idx * ddc::step()); + return ddc::Coordinate(rmin() + knot_idx * ddc::step()); } /** @brief Returns the coordinate of the first support knot associated to a DiscreteElement identifying a B-spline. From d5f56b51ab86f4c3eb403045b80e0be0127b465e Mon Sep 17 00:00:00 2001 From: Baptiste Legouix Date: Mon, 22 Apr 2024 17:44:26 +0200 Subject: [PATCH 50/89] Update include/ddc/kernels/splines/bsplines_non_uniform.hpp Co-authored-by: EmilyBourne --- .../kernels/splines/bsplines_non_uniform.hpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index 4ec0315dc..235db2b94 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -133,13 +133,20 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase { } - /** @brief Constructs a Impl using a pair of iterators. + /** @brief Constructs a Impl by iterating over a set of break points from begin to end. * - * The iterators are used to build the DiscreteDomain indexing the knots, build the knots list - * and initialize the associated DiscreteSpace. + * The provided break points describe the separation between the cells on which the polynomials + * comprising a spline are defined. They are used to build a set of knots. There are 2*degree more + * knots than break points. The knots are defined as follows: + * @f$ k_i = b_0 \forall 0 \leq i < d @f$ + * @f$ k_{i+d} = b_i \forall 0 \leq i < n_b @f$ + * @f$ k_{i+d+n_b} = b_{n_b} \forall 0 \leq i < d @f$ + * where @f$d@f$ is the degree of the polynomials, and @f$n_b@f$ is the number of basis points. * - * @param breaks_begin The iterator to begin with to iterate on break points. - * @param breaks_end The iterator to end with to iterate on break points. + * This constructor makes the knots accessible via a DiscreteSpace. + * + * @param breaks_begin The iterator which points at the beginning of the break points. + * @param breaks_end The iterator which points at the end of the break points. */ template Impl(RandomIt breaks_begin, RandomIt breaks_end); From 29a9c3c98ef49f8915d0e95aa7748babfc85bd63 Mon Sep 17 00:00:00 2001 From: blegouix Date: Tue, 23 Apr 2024 09:50:36 +0200 Subject: [PATCH 51/89] wip --- include/ddc/kernels/splines/bsplines_non_uniform.hpp | 12 ++++++++---- include/ddc/kernels/splines/bsplines_uniform.hpp | 8 ++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index 4ec0315dc..e43cd1001 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -114,6 +114,8 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase * The brace-list is the list of break points. It is used to build the DiscreteDomain indexing * the knots and iterated over to build the knots coordinates list and initialize the associated DiscreteSpace. * + * @see Impl(RandomIt breaks_begin, RandomIt breaks_end) + * * @param breaks The std::initializer_list of the coordinates of break points. */ explicit Impl(std::initializer_list> breaks) @@ -126,6 +128,8 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase * The std::vector is the list of break points. It is used to build the DiscreteDomain indexing * the knots and iterated over to build the knots coordinates list and initialize the associated DiscreteSpace. * + * @see Impl(RandomIt breaks_begin, RandomIt breaks_end) + * * @param breaks The std::vector of the coordinates of break points. */ explicit Impl(std::vector> const& breaks) @@ -204,7 +208,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase * The derivatives are computed for every B-splines with support at the given coordinate x. There are only (degree+1) * B-splines which are non-zero at any given point. It is these B-splines which are derivated. * A spline approximation of a derivative at coordinate x is a linear - * combination of those B-splines derivatives weigthed with splines coefficients of the spline-transformed + * combination of those B-splines derivatives weighted with splines coefficients of the spline-transformed * initial discrete function. * * @param[out] derivs The derivatives of the B-splines evaluated at coordinate x. It has to be a 1D mdspan with (degree+1) elements. @@ -216,10 +220,10 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase /** @brief Evaluates non-zero B-splines values and \f$n\f$ derivatives at a given coordinate * - * The values and derivatives are computed for every B-splines with support at the given coordinate x. There are only (degree+1) - * B-splines which are non-zero at any given point. It is these B-splines which are derivated. + * The values and derivatives are computed for every B-spline with support at the given coordinate x. There are only (degree+1) + * B-splines which are non-zero at any given point. It is these B-splines which are evaluated and derivated. * A spline approximation of a derivative at coordinate x is a linear - * combination of those B-splines derivatives weigthed with splines coefficients of the spline-transformed + * combination of those B-splines derivatives weighted with splines coefficients of the spline-transformed * initial discrete function. * * @param[out] derivs The values and \f$n\f$ derivatives of the B-splines evaluated at coordinate x. It has to be a 2D mdspan with (degree+1)*(n+1) elements. diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index 30b4eac71..5d2746e14 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -187,7 +187,7 @@ class UniformBSplines : detail::UniformBSplinesBase * The derivatives are computed for every B-splines with support at the given coordinate x. There are only (degree+1) * B-splines which are non-zero at any given point. It is these B-splines which are derivated. * A spline approximation of a derivative at coordinate x is a linear - * combination of those B-splines derivatives weigthed with splines coefficients of the spline-transformed + * combination of those B-splines derivatives weighted with splines coefficients of the spline-transformed * initial discrete function. * * @param[out] derivs The derivatives of the B-splines evaluated at coordinate x. It has to be a 1D mdspan with (degree+1) elements. @@ -199,10 +199,10 @@ class UniformBSplines : detail::UniformBSplinesBase /** @brief Evaluates non-zero B-splines values and \f$n\f$ derivatives at a given coordinate * - * The values and derivatives are computed for every B-splines with support at the given coordinate x. There are only (degree+1) - * B-splines which are non-zero at any given point. It is these B-splines which are derivated. + * The values and derivatives are computed for every B-spline with support at the given coordinate x. There are only (degree+1) + * B-splines which are non-zero at any given point. It is these B-splines which are evaluated and derivated. * A spline approximation of a derivative at coordinate x is a linear - * combination of those B-splines derivatives weigthed with splines coefficients of the spline-transformed + * combination of those B-splines derivatives weighted with splines coefficients of the spline-transformed * initial discrete function. * * @param[out] derivs The values and \f$n\f$ derivatives of the B-splines evaluated at coordinate x. It has to be a 2D mdspan with (degree+1)*(n+1) elements. From f55723000c33c327469dd62423b676044dd714df Mon Sep 17 00:00:00 2001 From: blegouix Date: Tue, 23 Apr 2024 09:59:07 +0200 Subject: [PATCH 52/89] emily's review --- include/ddc/kernels/splines/bsplines_non_uniform.hpp | 12 ++++++------ include/ddc/kernels/splines/bsplines_uniform.hpp | 7 ++++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index a90ded649..fcd208195 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -142,10 +142,10 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase * The provided break points describe the separation between the cells on which the polynomials * comprising a spline are defined. They are used to build a set of knots. There are 2*degree more * knots than break points. The knots are defined as follows: - * @f$ k_i = b_0 \forall 0 \leq i < d @f$ - * @f$ k_{i+d} = b_i \forall 0 \leq i < n_b @f$ - * @f$ k_{i+d+n_b} = b_{n_b} \forall 0 \leq i < d @f$ - * where @f$d@f$ is the degree of the polynomials, and @f$n_b@f$ is the number of basis points. + * \f$ k_i = b_0 \forall 0 \leq i < d \f$ + * \f$ k_{i+d} = b_i \forall 0 \leq i < n_b \f$ + * \f$ k_{i+d+n_b} = b_{n_b} \forall 0 \leq i < d \f$ + * where \f$d\f$ is the degree of the polynomials, and \f$n_b\f$ is the number of basis points. * * This constructor makes the knots accessible via a DiscreteSpace. * @@ -356,9 +356,9 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase return degree() + ncells(); } - /** @brief Returns the discrete domain including eventual additionnal bsplines in the periodic case. See size(). + /** @brief Returns the discrete domain including eventual additionnal B-splines in the periodic case. See size(). * - * @return The discrete domain including eventual additionnal bsplines. + * @return The discrete domain including eventual additionnal B-splines. */ KOKKOS_INLINE_FUNCTION discrete_domain_type full_domain() const { diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index 5d2746e14..930c1075c 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -31,7 +31,8 @@ struct UniformBSplinesBase /** * The type of a uniform B-splines 1D basis. * - * Knots for non-uniform B-splines basis are non-uniformly distributed (no assumption is made on the uniformity of their distribution). + * Knots for uniform B-splines basis are uniformly distributed (the associated discrete dimension + * is a UniformPointSampling). * * @tparam Tag The tag identifying the continuous dimension on which the support of the B-spline functions are defined. * @tparam D The degree of the B-splines. @@ -325,9 +326,9 @@ class UniformBSplines : detail::UniformBSplinesBase return degree() + ncells(); } - /** @brief Returns the discrete domain including eventual additionnal bsplines in the periodic case. See size(). + /** @brief Returns the discrete domain including eventual additionnal B-splines in the periodic case. See size(). * - * @return The discrete domain including eventual additionnal bsplines. + * @return The discrete domain including eventual additionnal B-splines. */ KOKKOS_INLINE_FUNCTION discrete_domain_type full_domain() const { From a0dc60980e3b7ac5450548fa3dc1f0665f604490 Mon Sep 17 00:00:00 2001 From: blegouix Date: Tue, 23 Apr 2024 10:01:33 +0200 Subject: [PATCH 53/89] minor --- include/ddc/kernels/splines/bsplines_non_uniform.hpp | 2 +- include/ddc/kernels/splines/bsplines_uniform.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index fcd208195..f124a00d2 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -212,7 +212,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase /** @brief Evaluates non-zero B-splines derivatives at a given coordinate * - * The derivatives are computed for every B-splines with support at the given coordinate x. There are only (degree+1) + * The derivatives are computed for every B-spline with support at the given coordinate x. There are only (degree+1) * B-splines which are non-zero at any given point. It is these B-splines which are derivated. * A spline approximation of a derivative at coordinate x is a linear * combination of those B-splines derivatives weighted with splines coefficients of the spline-transformed diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index 930c1075c..4ffb29694 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -185,7 +185,7 @@ class UniformBSplines : detail::UniformBSplinesBase /** @brief Evaluates non-zero B-splines derivatives at a given coordinate * - * The derivatives are computed for every B-splines with support at the given coordinate x. There are only (degree+1) + * The derivatives are computed for every B-spline with support at the given coordinate x. There are only (degree+1) * B-splines which are non-zero at any given point. It is these B-splines which are derivated. * A spline approximation of a derivative at coordinate x is a linear * combination of those B-splines derivatives weighted with splines coefficients of the spline-transformed From 403a99a5fd94f5b129bc3d2a683dfb0b333fd314 Mon Sep 17 00:00:00 2001 From: blegouix Date: Tue, 23 Apr 2024 10:02:29 +0200 Subject: [PATCH 54/89] minor --- include/ddc/kernels/splines/bsplines_non_uniform.hpp | 4 ++-- include/ddc/kernels/splines/bsplines_uniform.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index f124a00d2..2a1619fec 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -356,9 +356,9 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase return degree() + ncells(); } - /** @brief Returns the discrete domain including eventual additionnal B-splines in the periodic case. See size(). + /** @brief Returns the discrete domain including eventual additional B-splines in the periodic case. See size(). * - * @return The discrete domain including eventual additionnal B-splines. + * @return The discrete domain including eventual additional B-splines. */ KOKKOS_INLINE_FUNCTION discrete_domain_type full_domain() const { diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index 4ffb29694..41bdbf628 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -326,9 +326,9 @@ class UniformBSplines : detail::UniformBSplinesBase return degree() + ncells(); } - /** @brief Returns the discrete domain including eventual additionnal B-splines in the periodic case. See size(). + /** @brief Returns the discrete domain including eventual additional B-splines in the periodic case. See size(). * - * @return The discrete domain including eventual additionnal B-splines. + * @return The discrete domain including eventual additional B-splines. */ KOKKOS_INLINE_FUNCTION discrete_domain_type full_domain() const { From bdd529a5e16fb07f94007258c6cdbab8624d677f Mon Sep 17 00:00:00 2001 From: blegouix Date: Tue, 23 Apr 2024 10:54:57 +0200 Subject: [PATCH 55/89] the spline coefficients --- include/ddc/kernels/splines/bsplines_non_uniform.hpp | 4 ++-- include/ddc/kernels/splines/bsplines_uniform.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index 2a1619fec..e742e82c0 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -200,7 +200,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase * The values are computed for every B-spline with support at the given coordinate x. There are only (degree+1) * B-splines which are non-zero at any given point. It is these B-splines which are evaluated. * This can be useful to calculate a spline approximation of a function. A spline approximation at coordinate x - * is a linear combination of these B-spline evaluations weighted with spline coefficients of the spline-transformed + * is a linear combination of these B-spline evaluations weighted with the spline coefficients of the spline-transformed * initial discrete function. * * @param[out] values The values of the B-splines evaluated at coordinate x. It has to be a 1D mdspan with (degree+1) elements. @@ -215,7 +215,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase * The derivatives are computed for every B-spline with support at the given coordinate x. There are only (degree+1) * B-splines which are non-zero at any given point. It is these B-splines which are derivated. * A spline approximation of a derivative at coordinate x is a linear - * combination of those B-splines derivatives weighted with splines coefficients of the spline-transformed + * combination of those B-splines derivatives weighted with the splines coefficients of the spline-transformed * initial discrete function. * * @param[out] derivs The derivatives of the B-splines evaluated at coordinate x. It has to be a 1D mdspan with (degree+1) elements. diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index 41bdbf628..de38d5005 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -169,7 +169,7 @@ class UniformBSplines : detail::UniformBSplinesBase * The values are computed for every B-spline with support at the given coordinate x. There are only (degree+1) * B-splines which are non-zero at any given point. It is these B-splines which are evaluated. * This can be useful to calculate a spline approximation of a function. A spline approximation at coordinate x - * is a linear combination of these B-spline evaluations weighted with spline coefficients of the spline-transformed + * is a linear combination of these B-spline evaluations weighted with the spline coefficients of the spline-transformed * initial discrete function. * * @param[out] values The values of the B-splines evaluated at coordinate x. It has to be a 1D mdspan with (degree+1) elements. @@ -188,7 +188,7 @@ class UniformBSplines : detail::UniformBSplinesBase * The derivatives are computed for every B-spline with support at the given coordinate x. There are only (degree+1) * B-splines which are non-zero at any given point. It is these B-splines which are derivated. * A spline approximation of a derivative at coordinate x is a linear - * combination of those B-splines derivatives weighted with splines coefficients of the spline-transformed + * combination of those B-splines derivatives weighted with the splines coefficients of the spline-transformed * initial discrete function. * * @param[out] derivs The derivatives of the B-splines evaluated at coordinate x. It has to be a 1D mdspan with (degree+1) elements. From 8068c3b0ed54902f3c62501ec639bec0a2e8e8b3 Mon Sep 17 00:00:00 2001 From: blegouix Date: Tue, 23 Apr 2024 11:09:45 +0200 Subject: [PATCH 56/89] CI --- .../ddc/kernels/splines/spline_builder.hpp | 28 +++++++++++---- .../ddc/kernels/splines/spline_builder_2d.hpp | 34 +++++++++++++++++++ 2 files changed, 56 insertions(+), 6 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index 4e0859b7f..9af36aba0 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -17,7 +17,9 @@ namespace ddc { * An enum determining the backend solver of a SplineBuilder or SplineBuilder2d. Only GINKGO available at the moment, * other solvers will be implemented in the futur. */ -enum class SplineSolver { GINKGO }; +enum class SplineSolver { + GINKGO ///< Enum member to identify the Ginkgo-based solver (iterative method) +}; /** * @brief An helper giving the uniform/non_uniform status of a spline interpolation mesh according to its attributes. @@ -28,6 +30,8 @@ enum class SplineSolver { GINKGO }; * @param BcXmin The lower boundary condition. * @param BcXmax The upper boundary condition. * @param degree The degree of the spline. + * + * @return A boolean giving the uniform/non_uniform status. */ constexpr bool is_spline_interpolation_mesh_uniform( bool const is_uniform, @@ -204,12 +208,12 @@ class SplineBuilder // interpolator specific std::unique_ptr matrix; -public: /** * @brief An helper to compute the offset. */ int compute_offset(interpolation_domain_type const& interpolation_domain); +public: /** * @brief Build a SplineBuilder acting on batched_interpolation_domain. * @@ -244,19 +248,31 @@ class SplineBuilder preconditionner_max_block_size); } - /// @brief Copy-constructor is deleted + /** @brief Copy-constructor is deleted + * + * @param x A reference to another SplineBuilder. + */ SplineBuilder(SplineBuilder const& x) = delete; - /// @brief Move-constructs + /** @brief Move-constructs + * + * @param x An rvalue to another SplineBuilder. + */ SplineBuilder(SplineBuilder&& x) = default; /// @brief Destructs ~SplineBuilder() = default; - /// @brief Copy-assignment is deleted + /** @brief Copy-assignment is deleted + * + * @param x A reference to another SplineBuilder. + */ SplineBuilder& operator=(SplineBuilder const& x) = delete; - /// @brief Move-assigns + /** @brief Move-assigns + * + * @param x An rvalue to another SplineBuilder. + */ SplineBuilder& operator=(SplineBuilder&& x) = default; /** diff --git a/include/ddc/kernels/splines/spline_builder_2d.hpp b/include/ddc/kernels/splines/spline_builder_2d.hpp index ae3cfc178..f817d670f 100644 --- a/include/ddc/kernels/splines/spline_builder_2d.hpp +++ b/include/ddc/kernels/splines/spline_builder_2d.hpp @@ -32,10 +32,19 @@ template < class SplineBuilder2D { public: + /** + * @brief The type of the Kokkos execution space used by this class. + */ using exec_space = ExecSpace; + /** + * @brief The type of the Kokkos memory space used by this class. + */ using memory_space = MemorySpace; + /** + * @brief The type of the SplineBuilder used by this class to spline-transform along first dimension. + */ using builder_type1 = ddc::SplineBuilder< ExecSpace, MemorySpace, @@ -45,6 +54,10 @@ class SplineBuilder2D BcXmax1, Solver, IDimX...>; + + /** + * @brief The type of the SplineBuilder used by this class to spline-transform along second dimension. + */ using builder_type2 = ddc::SplineBuilder< ExecSpace, MemorySpace, @@ -54,6 +67,10 @@ class SplineBuilder2D BcXmax2, Solver, std::conditional_t, BSpline1, IDimX>...>; + + /** + * @brief The type of the SplineBuilder used by this class to spline-transform the second-dimension-derivatives along first dimension. + */ using builder_deriv_type1 = ddc::SplineBuilder< ExecSpace, MemorySpace, @@ -72,6 +89,7 @@ class SplineBuilder2D * @brief Tag the dimension of the first 1D SplineBuilder. */ using tag_type1 = typename builder_type1::bsplines_type::tag_type; + /** * @brief Tag the dimension of the second 1D SplineBuilder. */ @@ -82,6 +100,7 @@ class SplineBuilder2D * @brief The type of the BSplines in the first dimension which are compatible with this class. */ using bsplines_type1 = typename builder_type1::bsplines_type; + /** * @brief The type of the BSplines in the second dimension which are compatible with this class. */ @@ -230,6 +249,14 @@ class SplineBuilder2D */ SplineBuilder2D& operator=(SplineBuilder2D&& x) = default; + /** + * @brief Get the whole domain representing interpolation points. + * + * Get the domain on which values of the function must be provided in order + * to build a 2D spline transform of the function. + * + * @return The domain for the grid points. + */ batched_interpolation_domain_type batched_interpolation_domain() const noexcept { return m_spline_builder1.batched_interpolation_domain(); @@ -250,6 +277,13 @@ class SplineBuilder2D m_spline_builder2.interpolation_domain()); } + /** + * @brief Get the batch domain. + * + * Get the batch domain (obtained by removing dimensions of interest from whole interpolation domain). + * + * @return The batch domain. + */ batch_domain_type batch_domain() const noexcept { return ddc::remove_dims_of(batched_interpolation_domain(), interpolation_domain()); From ad555555da49079d7e902ece210216ffb0acacfd Mon Sep 17 00:00:00 2001 From: blegouix Date: Tue, 23 Apr 2024 14:17:24 +0200 Subject: [PATCH 57/89] emily's review --- .../ddc/kernels/splines/bsplines_non_uniform.hpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index e742e82c0..ea13c032c 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -111,10 +111,8 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase /** @brief Constructs an Impl using a brace-list, i.e. `Impl bsplines({0., 1.})` * - * The brace-list is the list of break points. It is used to build the DiscreteDomain indexing - * the knots and iterated over to build the knots coordinates list and initialize the associated DiscreteSpace. - * - * @see Impl(RandomIt breaks_begin, RandomIt breaks_end) + * Constructs a Impl by iterating over a list of break points. Internally this constructor calls the constructor + * Impl(RandomIt breaks_begin, RandomIt breaks_end). * * @param breaks The std::initializer_list of the coordinates of break points. */ @@ -125,10 +123,8 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase /** @brief Constructs an Impl using a std::vector. * - * The std::vector is the list of break points. It is used to build the DiscreteDomain indexing - * the knots and iterated over to build the knots coordinates list and initialize the associated DiscreteSpace. - * - * @see Impl(RandomIt breaks_begin, RandomIt breaks_end) + * Constructs a Impl by iterating over a list of break points. Internally this constructor calls the constructor + * Impl(RandomIt breaks_begin, RandomIt breaks_end). * * @param breaks The std::vector of the coordinates of break points. */ @@ -215,7 +211,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase * The derivatives are computed for every B-spline with support at the given coordinate x. There are only (degree+1) * B-splines which are non-zero at any given point. It is these B-splines which are derivated. * A spline approximation of a derivative at coordinate x is a linear - * combination of those B-splines derivatives weighted with the splines coefficients of the spline-transformed + * combination of those B-splines derivatives weighted with the spline coefficients of the spline-transformed * initial discrete function. * * @param[out] derivs The derivatives of the B-splines evaluated at coordinate x. It has to be a 1D mdspan with (degree+1) elements. @@ -230,7 +226,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase * The values and derivatives are computed for every B-spline with support at the given coordinate x. There are only (degree+1) * B-splines which are non-zero at any given point. It is these B-splines which are evaluated and derivated. * A spline approximation of a derivative at coordinate x is a linear - * combination of those B-splines derivatives weighted with splines coefficients of the spline-transformed + * combination of those B-splines derivatives weighted with spline coefficients of the spline-transformed * initial discrete function. * * @param[out] derivs The values and \f$n\f$ derivatives of the B-splines evaluated at coordinate x. It has to be a 2D mdspan with (degree+1)*(n+1) elements. From 45db898b4b2cbe31cf9228427c0ad2bc81bb80cb Mon Sep 17 00:00:00 2001 From: blegouix Date: Tue, 23 Apr 2024 15:59:38 +0200 Subject: [PATCH 58/89] forgot a files save --- include/ddc/kernels/splines/bsplines_uniform.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index de38d5005..6d6d18e5b 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -188,7 +188,7 @@ class UniformBSplines : detail::UniformBSplinesBase * The derivatives are computed for every B-spline with support at the given coordinate x. There are only (degree+1) * B-splines which are non-zero at any given point. It is these B-splines which are derivated. * A spline approximation of a derivative at coordinate x is a linear - * combination of those B-splines derivatives weighted with the splines coefficients of the spline-transformed + * combination of those B-splines derivatives weighted with the spline coefficients of the spline-transformed * initial discrete function. * * @param[out] derivs The derivatives of the B-splines evaluated at coordinate x. It has to be a 1D mdspan with (degree+1) elements. @@ -203,7 +203,7 @@ class UniformBSplines : detail::UniformBSplinesBase * The values and derivatives are computed for every B-spline with support at the given coordinate x. There are only (degree+1) * B-splines which are non-zero at any given point. It is these B-splines which are evaluated and derivated. * A spline approximation of a derivative at coordinate x is a linear - * combination of those B-splines derivatives weighted with splines coefficients of the spline-transformed + * combination of those B-splines derivatives weighted with spline coefficients of the spline-transformed * initial discrete function. * * @param[out] derivs The values and \f$n\f$ derivatives of the B-splines evaluated at coordinate x. It has to be a 2D mdspan with (degree+1)*(n+1) elements. From 5f821772ac2149066b957461ff94c75c433a9d47 Mon Sep 17 00:00:00 2001 From: blegouix Date: Wed, 24 Apr 2024 11:37:57 +0200 Subject: [PATCH 59/89] fix doxygen --- include/ddc/kernels/splines/bsplines_non_uniform.hpp | 9 +++++---- include/ddc/kernels/splines/bsplines_uniform.hpp | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index ea13c032c..fc2429b00 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -247,9 +247,10 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase * @return The values of the integrals. */ template - KOKKOS_INLINE_FUNCTION ddc::ChunkSpan - integrals( - ddc::ChunkSpan int_vals) const; + KOKKOS_INLINE_FUNCTION ddc:: + ChunkSpan, Layout, MemorySpace2> + integrals(ddc::ChunkSpan + int_vals) const; /** @brief Returns the coordinate of the knot corresponding to the given index. * @@ -692,7 +693,7 @@ template template KOKKOS_INLINE_FUNCTION ddc::ChunkSpan, Layout, MemorySpace2> NonUniformBSplines::Impl::integrals( - ddc::ChunkSpan, Layout, MemorySpace2> int_vals) const + ddc::ChunkSpan int_vals) const { if constexpr (is_periodic()) { assert(int_vals.size() == nbasis() || int_vals.size() == size()); diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index 6d6d18e5b..9f7e65e00 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -224,9 +224,10 @@ class UniformBSplines : detail::UniformBSplinesBase * @return The values of the integrals. */ template - KOKKOS_INLINE_FUNCTION ddc::ChunkSpan - integrals( - ddc::ChunkSpan int_vals) const; + KOKKOS_INLINE_FUNCTION ddc:: + ChunkSpan, Layout, MemorySpace2> + integrals(ddc::ChunkSpan + int_vals) const; /** @brief Returns the coordinate of the knot corresponding to the given index. * @@ -593,7 +594,7 @@ template template KOKKOS_INLINE_FUNCTION ddc::ChunkSpan, Layout, MemorySpace2> UniformBSplines::Impl::integrals( - ddc::ChunkSpan, Layout, MemorySpace2> int_vals) const + ddc::ChunkSpan int_vals) const { if constexpr (is_periodic()) { assert(int_vals.size() == nbasis() || int_vals.size() == size()); From 7dfbed25a4677cb4f4576ab71d8543b1c7119141 Mon Sep 17 00:00:00 2001 From: blegouix Date: Wed, 24 Apr 2024 12:59:13 +0200 Subject: [PATCH 60/89] clang-format --- include/ddc/kernels/splines/spline_builder.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index 9af36aba0..d04954827 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -18,7 +18,7 @@ namespace ddc { * other solvers will be implemented in the futur. */ enum class SplineSolver { - GINKGO ///< Enum member to identify the Ginkgo-based solver (iterative method) + GINKGO ///< Enum member to identify the Ginkgo-based solver (iterative method) }; /** From 669719e03780b6b5248db913cffe5c7a4f752a92 Mon Sep 17 00:00:00 2001 From: blegouix Date: Wed, 24 Apr 2024 13:15:30 +0200 Subject: [PATCH 61/89] wip on CI --- include/ddc/kernels/splines/spline_builder.hpp | 11 +++-------- include/ddc/kernels/splines/spline_builder_2d.hpp | 9 +++------ 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index d04954827..9333497d8 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -248,10 +248,7 @@ class SplineBuilder preconditionner_max_block_size); } - /** @brief Copy-constructor is deleted - * - * @param x A reference to another SplineBuilder. - */ + /// @brief Copy-constructor is deleted SplineBuilder(SplineBuilder const& x) = delete; /** @brief Move-constructs @@ -263,15 +260,13 @@ class SplineBuilder /// @brief Destructs ~SplineBuilder() = default; - /** @brief Copy-assignment is deleted - * - * @param x A reference to another SplineBuilder. - */ + /// @brief Copy-assignment is deleted SplineBuilder& operator=(SplineBuilder const& x) = delete; /** @brief Move-assigns * * @param x An rvalue to another SplineBuilder. + * @return A reference to the moved SplineBuilder */ SplineBuilder& operator=(SplineBuilder&& x) = default; diff --git a/include/ddc/kernels/splines/spline_builder_2d.hpp b/include/ddc/kernels/splines/spline_builder_2d.hpp index f817d670f..64e690567 100644 --- a/include/ddc/kernels/splines/spline_builder_2d.hpp +++ b/include/ddc/kernels/splines/spline_builder_2d.hpp @@ -219,12 +219,7 @@ class SplineBuilder2D { } - /** - * @brief Create a new SplineBuilder2D by copy - * - * @param x - * The SplineBuilder2D being copied. - */ + /// @brief Copy-constructor is deleted SplineBuilder2D(SplineBuilder2D const& x) = delete; /** @@ -235,8 +230,10 @@ class SplineBuilder2D */ SplineBuilder2D(SplineBuilder2D&& x) = default; + /// @brief Destructs ~SplineBuilder2D() = default; + /// @brief Copy-assignment is deleted SplineBuilder2D& operator=(SplineBuilder2D const& x) = delete; From 0e27bfeaff554e34c7a588ab751e05f370d57791 Mon Sep 17 00:00:00 2001 From: blegouix Date: Wed, 24 Apr 2024 13:27:48 +0200 Subject: [PATCH 62/89] null_extrap --- .../ddc/kernels/splines/null_extrapolation_rule.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/ddc/kernels/splines/null_extrapolation_rule.hpp b/include/ddc/kernels/splines/null_extrapolation_rule.hpp index b79fd5850..131eb0af1 100644 --- a/include/ddc/kernels/splines/null_extrapolation_rule.hpp +++ b/include/ddc/kernels/splines/null_extrapolation_rule.hpp @@ -11,6 +11,16 @@ namespace ddc { */ struct NullExtrapolationRule { + /** + * @brief Evaluates 0. out of the domain. + * + * @param[in] pos + * The coordinate where we want to evaluate the function on B-splines. + * @param[in] spline_coef + * The coefficients of the function on B-splines. + * + * @return A double with the value of the function on B-splines evaluated at the coordinate (here, 0.). + */ template KOKKOS_FUNCTION double operator()(CoordType, ChunkSpan) const { From 3982b958dfa1750881dde453541e72cbc7e230b8 Mon Sep 17 00:00:00 2001 From: blegouix Date: Wed, 24 Apr 2024 13:45:20 +0200 Subject: [PATCH 63/89] CI --- include/ddc/kernels/splines/null_extrapolation_rule.hpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/include/ddc/kernels/splines/null_extrapolation_rule.hpp b/include/ddc/kernels/splines/null_extrapolation_rule.hpp index 131eb0af1..e7c1348f2 100644 --- a/include/ddc/kernels/splines/null_extrapolation_rule.hpp +++ b/include/ddc/kernels/splines/null_extrapolation_rule.hpp @@ -14,11 +14,6 @@ struct NullExtrapolationRule /** * @brief Evaluates 0. out of the domain. * - * @param[in] pos - * The coordinate where we want to evaluate the function on B-splines. - * @param[in] spline_coef - * The coefficients of the function on B-splines. - * * @return A double with the value of the function on B-splines evaluated at the coordinate (here, 0.). */ template From e302ef9fd17b139e67ae55dec3354423625c6cbc Mon Sep 17 00:00:00 2001 From: blegouix Date: Wed, 24 Apr 2024 14:55:15 +0200 Subject: [PATCH 64/89] wip --- include/ddc/kernels/splines/spline_builder.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index 2a20a3caa..63c1bac2b 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -104,7 +104,7 @@ class SplineBuilder using bsplines_type = BSplines; /** - * @brief The Deriv dimension at the boundaries. + * @brief The type of the Deriv dimension at the boundaries. */ using deriv_type = ddc::Deriv; @@ -136,7 +136,7 @@ class SplineBuilder ddc::detail::TypeSeq>>; /** - * @brief The type of the whole spline domain (cartesian product of 1D spline domain and batch domain) with 1D spline domain being contiguous . + * @brief The type of the whole spline domain (cartesian product of 1D spline domain and batch domain) with 1D spline dimension being contiguous . */ using batched_spline_tr_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain>>>; /** - * @brief The type of the whole Derivs domain (cartesian product of 1D Deriv domain and batch domain) preserving the underlying memory layout (order of dimensions). + * @brief The type of the whole Deriv domain (cartesian product of 1D Deriv domain and batch domain) preserving the underlying memory layout (order of dimensions). */ using batched_derivs_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain Date: Wed, 24 Apr 2024 17:49:39 +0200 Subject: [PATCH 65/89] Emily's review --- .../kernels/splines/bsplines_non_uniform.hpp | 28 +++++++++---------- .../ddc/kernels/splines/bsplines_uniform.hpp | 28 +++++++++---------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index fc2429b00..4e60efd88 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -29,7 +29,7 @@ struct NonUniformBSplinesBase } // namespace detail /** - * The type of a non-uniform B-splines 1D basis. + * The type of a non-uniform 1D spline basis (B-spline). * * Knots for non-uniform B-splines are non-uniformly distributed (no assumption is made on the uniformity of their distribution, * the associated discrete dimension is a NonUniformPointSampling). @@ -111,7 +111,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase /** @brief Constructs an Impl using a brace-list, i.e. `Impl bsplines({0., 1.})` * - * Constructs a Impl by iterating over a list of break points. Internally this constructor calls the constructor + * Constructs an Impl by iterating over a list of break points. Internally this constructor calls the constructor * Impl(RandomIt breaks_begin, RandomIt breaks_end). * * @param breaks The std::initializer_list of the coordinates of break points. @@ -123,7 +123,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase /** @brief Constructs an Impl using a std::vector. * - * Constructs a Impl by iterating over a list of break points. Internally this constructor calls the constructor + * Constructs an Impl by iterating over a list of break points. Internally this constructor calls the constructor * Impl(RandomIt breaks_begin, RandomIt breaks_end). * * @param breaks The std::vector of the coordinates of break points. @@ -133,7 +133,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase { } - /** @brief Constructs a Impl by iterating over a set of break points from begin to end. + /** @brief Constructs an Impl by iterating over a set of break points from begin to end. * * The provided break points describe the separation between the cells on which the polynomials * comprising a spline are defined. They are used to build a set of knots. There are 2*degree more @@ -151,7 +151,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase template Impl(RandomIt breaks_begin, RandomIt breaks_end); - /** @brief Copy-constructs from another Impl with different Kokkos memory space + /** @brief Copy-constructs from another Impl with a different Kokkos memory space * * @param impl A reference to the other Impl */ @@ -180,7 +180,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase /** @brief Copy-assigns * * @param x A reference to another Impl - * @return A reference to the copy Impl + * @return A reference to the copied Impl */ Impl& operator=(Impl const& x) = default; @@ -206,32 +206,32 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis(DSpan1D values, ddc::Coordinate const& x) const; - /** @brief Evaluates non-zero B-splines derivatives at a given coordinate + /** @brief Evaluates non-zero B-spline derivatives at a given coordinate * * The derivatives are computed for every B-spline with support at the given coordinate x. There are only (degree+1) * B-splines which are non-zero at any given point. It is these B-splines which are derivated. * A spline approximation of a derivative at coordinate x is a linear - * combination of those B-splines derivatives weighted with the spline coefficients of the spline-transformed + * combination of those B-spline derivatives weighted with the spline coefficients of the spline-transformed * initial discrete function. * * @param[out] derivs The derivatives of the B-splines evaluated at coordinate x. It has to be a 1D mdspan with (degree+1) elements. - * @param[in] x The coordinate where B-splines derivatives are evaluated. + * @param[in] x The coordinate where B-spline derivatives are evaluated. * @return The index of the first B-spline which is derivated. */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_deriv(DSpan1D derivs, ddc::Coordinate const& x) const; - /** @brief Evaluates non-zero B-splines values and \f$n\f$ derivatives at a given coordinate + /** @brief Evaluates non-zero B-spline values and \f$n\f$ derivatives at a given coordinate * * The values and derivatives are computed for every B-spline with support at the given coordinate x. There are only (degree+1) * B-splines which are non-zero at any given point. It is these B-splines which are evaluated and derivated. * A spline approximation of a derivative at coordinate x is a linear - * combination of those B-splines derivatives weighted with spline coefficients of the spline-transformed + * combination of those B-spline derivatives weighted with spline coefficients of the spline-transformed * initial discrete function. * * @param[out] derivs The values and \f$n\f$ derivatives of the B-splines evaluated at coordinate x. It has to be a 2D mdspan with (degree+1)*(n+1) elements. - * @param[in] x The coordinate where B-splines derivatives are evaluated. - * @param[in] n The number of derivatives to evaluate (in addition to the B-splines values themselves). + * @param[in] x The coordinate where B-spline derivatives are evaluated. + * @param[in] n The number of derivatives to evaluate (in addition to the B-spline values themselves). * @return The index of the first B-spline which is evaluated/derivated. */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis_and_n_derivs( @@ -255,7 +255,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase /** @brief Returns the coordinate of the knot corresponding to the given index. * * Returns the coordinate of the knot corresponding to the given index. The domain - * over which the B-splines are defined is comprised of ncells+1 knots however there are a total of + * over which the B-splines are defined is comprised of ncells+1 break points however there are a total of * ncells+1+2*degree knots. The additional knots which control the shape of the B-splines near the * boundary are added before and after the break points. The knot index is therefore in the interval [-degree, ncells+degree] * diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index 9f7e65e00..79a6b5a13 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -29,9 +29,9 @@ struct UniformBSplinesBase } // namespace detail /** - * The type of a uniform B-splines 1D basis. + * The type of a uniform 1D spline basis (B-spline). * - * Knots for uniform B-splines basis are uniformly distributed (the associated discrete dimension + * Knots for uniform B-splines are uniformly distributed (the associated discrete dimension * is a UniformPointSampling). * * @tparam Tag The tag identifying the continuous dimension on which the support of the B-spline functions are defined. @@ -108,7 +108,7 @@ class UniformBSplines : detail::UniformBSplinesBase Impl() = default; - /** Constructs a B-splines basis with n equidistant knots over \f$[a, b]\f$ + /** Constructs a spline basis (B-splines) with n equidistant knots over \f$[a, b]\f$ * * @param rmin the real ddc::coordinate of the first knot * @param rmax the real ddc::coordinate of the last knot @@ -126,7 +126,7 @@ class UniformBSplines : detail::UniformBSplinesBase mesh_type>(rmin, rmax, ddc::DiscreteVector(ncells + 1))); } - /** @brief Copy-constructs from another Impl with different Kokkos memory space + /** @brief Copy-constructs from another Impl with a different Kokkos memory space * * @param impl A reference to the other Impl */ @@ -153,7 +153,7 @@ class UniformBSplines : detail::UniformBSplinesBase /** @brief Copy-assigns * * @param x A reference to another Impl - * @return A reference to the copy Impl + * @return A reference to the copied Impl */ Impl& operator=(Impl const& x) = default; @@ -183,32 +183,32 @@ class UniformBSplines : detail::UniformBSplinesBase return eval_basis(values, x, degree()); } - /** @brief Evaluates non-zero B-splines derivatives at a given coordinate + /** @brief Evaluates non-zero B-spline derivatives at a given coordinate * * The derivatives are computed for every B-spline with support at the given coordinate x. There are only (degree+1) * B-splines which are non-zero at any given point. It is these B-splines which are derivated. * A spline approximation of a derivative at coordinate x is a linear - * combination of those B-splines derivatives weighted with the spline coefficients of the spline-transformed + * combination of those B-spline derivatives weighted with the spline coefficients of the spline-transformed * initial discrete function. * * @param[out] derivs The derivatives of the B-splines evaluated at coordinate x. It has to be a 1D mdspan with (degree+1) elements. - * @param[in] x The coordinate where B-splines derivatives are evaluated. + * @param[in] x The coordinate where B-spline derivatives are evaluated. * @return The index of the first B-spline which is evaluated. */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_deriv(DSpan1D derivs, ddc::Coordinate const& x) const; - /** @brief Evaluates non-zero B-splines values and \f$n\f$ derivatives at a given coordinate + /** @brief Evaluates non-zero B-spline values and \f$n\f$ derivatives at a given coordinate * * The values and derivatives are computed for every B-spline with support at the given coordinate x. There are only (degree+1) * B-splines which are non-zero at any given point. It is these B-splines which are evaluated and derivated. * A spline approximation of a derivative at coordinate x is a linear - * combination of those B-splines derivatives weighted with spline coefficients of the spline-transformed + * combination of those B-spline derivatives weighted with spline coefficients of the spline-transformed * initial discrete function. * * @param[out] derivs The values and \f$n\f$ derivatives of the B-splines evaluated at coordinate x. It has to be a 2D mdspan with (degree+1)*(n+1) elements. - * @param[in] x The coordinate where B-splines derivatives are evaluated. - * @param[in] n The number of derivatives to evaluate (in addition to the B-splines values themselves). + * @param[in] x The coordinate where B-spline derivatives are evaluated. + * @param[in] n The number of derivatives to evaluate (in addition to the B-spline values themselves). * @return The index of the first B-spline which is evaluated. */ KOKKOS_INLINE_FUNCTION discrete_element_type eval_basis_and_n_derivs( @@ -232,9 +232,9 @@ class UniformBSplines : detail::UniformBSplinesBase /** @brief Returns the coordinate of the knot corresponding to the given index. * * Returns the coordinate of the knot corresponding to the given index. The domain - * over which the B-splines are defined is comprised of ncells+1 knots however there are a total of + * over which the B-splines are defined is comprised of ncells+1 break points however there are a total of * ncells+1+2*degree knots. The additional knots which control the shape of the B-splines near the - * boundary are added before and after the break points. The knot index is therefore in the interval [-degree, ncells+degree] + * boundary are added equidistantly before and after the break points. The knot index is therefore in the interval [-degree, ncells+degree] * * @param[in] knot_idx Integer identifying index of the knot. * @return Coordinate of the knot. From 167a36f5156b1af39ae4589d0c5617110822518d Mon Sep 17 00:00:00 2001 From: blegouix Date: Thu, 25 Apr 2024 12:59:23 +0200 Subject: [PATCH 66/89] wip --- .../ddc/kernels/splines/spline_builder.hpp | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index 7615cfe43..4a51c7bfd 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -50,12 +50,12 @@ constexpr bool is_spline_interpolation_mesh_uniform( * * 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 + * of B-splines. 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. * @tparam ExecSpace The Kokkos execution space on which the spline transform is performed. * @tparam MemorySpace The Kokkos memory space on which the data (interpolation function and splines coefficients) are stored. - * @tparam BSplines The discrete dimension representing the BSplines. + * @tparam BSplines The discrete dimension representing the B-splines. * @tparam InterpolationMesh The discrete dimension supporting the interpolation points. * @tparam BcXmin The lower boundary condition. * @tparam BcXmax The upper boundary condition. @@ -99,7 +99,7 @@ class SplineBuilder using interpolation_mesh_type = InterpolationMesh; /** - * @brief The discrete dimension representing the BSplines. + * @brief The discrete dimension representing the B-splines. */ using bsplines_type = BSplines; @@ -252,7 +252,7 @@ class SplineBuilder /** * @brief Get the domain for the 1D interpolation mesh used by this class. * - * Get the 1D interpolation domain associated to dimension of interest. + * This is the 1D because it is defined along the dimension of interest. * * @return The 1D domain for the grid points. */ @@ -264,10 +264,10 @@ class SplineBuilder /** * @brief Get the whole domain representing interpolation points. * - * Get the domain on which values of the function must be provided in order - * to build a spline transform of the function. + * Values of the function must be provided on this domain in order + * to build a spline transform of the function (cartesian product of 1D interpolation_domain and batch_domain). * - * @return The domain for the grid points. + * @return The domain for the interpolation points. */ batched_interpolation_domain_type batched_interpolation_domain() const noexcept { @@ -276,8 +276,8 @@ class SplineBuilder /** * @brief Get the batch domain. - * - * Get the batch domain (obtained by removing dimension of interest from whole interpolation domain). + * + * Obtained by removing dimension of interest from whole interpolation domain. * * @return The batch domain. */ @@ -289,7 +289,7 @@ class SplineBuilder /** * @brief Get the 1D domain on which spline coefficients are defined. * - * Get the 1D spline domain corresponding to dimension of interest. + * The 1D spline domain corresponding to dimension of interest. * * @return The 1D domain for the spline coefficients. */ @@ -301,7 +301,7 @@ class SplineBuilder /** * @brief Get the whole domain on which spline coefficients are defined, preserving memory layout. * - * Get the whole domain on which spline coefficients will be computed, preserving memory layout (order of dimensions). + * The domain on which spline coefficients will be computed, preserving memory layout (order of dimensions). * * @return The domain for the spline coefficients. */ @@ -315,7 +315,7 @@ class SplineBuilder /** * @brief Get the whole domain on which spline coefficients are defined, with dimension of interest contiguous. * - * Get the (transposed) whole domain on which spline coefficients will be computed, with dimension of interest contiguous. + * The (transposed) whole domain on which spline coefficients will be computed, with dimension of interest contiguous. * * @return The (transposed) domain for the spline coefficients. */ @@ -327,7 +327,7 @@ class SplineBuilder /** * @brief Get the whole domain on which derivatives on lower boundary are defined. * - * Get the whole domain on which derivatives on lower boundary are defined. This is used only with HERMITE boundary conditions. + * This is only used with HERMITE boundary conditions. * * @return The domain for the Derivs values. */ @@ -343,7 +343,7 @@ class SplineBuilder /** * @brief Get the whole domain on which derivatives on upper boundary are defined. * - * Get the whole domain on which derivatives on upper boundary are defined. This is used only with HERMITE boundary conditions. + * This is only used with HERMITE boundary conditions. * * @return The domain for the Derivs values. */ From 19e3cc918db28181a722d06f76859e8d30b47022 Mon Sep 17 00:00:00 2001 From: blegouix Date: Thu, 25 Apr 2024 13:26:42 +0200 Subject: [PATCH 67/89] Thomas' review --- .../kernels/splines/bsplines_non_uniform.hpp | 27 ++++++++++--------- .../ddc/kernels/splines/bsplines_uniform.hpp | 12 ++++----- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/include/ddc/kernels/splines/bsplines_non_uniform.hpp b/include/ddc/kernels/splines/bsplines_non_uniform.hpp index 4e60efd88..2f1430a8b 100644 --- a/include/ddc/kernels/splines/bsplines_non_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_non_uniform.hpp @@ -76,7 +76,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase return false; } - /** @brief Impl Storage class of the static attributes of the discrete dimension. + /** @brief Storage class of the static attributes of the discrete dimension. * * @tparam DDim The name of the discrete dimension. * @tparam MemorySpace The Kokkos memory space where the attributes are being stored. @@ -133,15 +133,18 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase { } - /** @brief Constructs an Impl by iterating over a set of break points from begin to end. + /** @brief Constructs an Impl by iterating over a range of break points from begin to end. * * The provided break points describe the separation between the cells on which the polynomials * comprising a spline are defined. They are used to build a set of knots. There are 2*degree more - * knots than break points. The knots are defined as follows: + * knots than break points. In the non-periodic case the knots are defined as follows: * \f$ k_i = b_0 \forall 0 \leq i < d \f$ * \f$ k_{i+d} = b_i \forall 0 \leq i < n_b \f$ - * \f$ k_{i+d+n_b} = b_{n_b} \forall 0 \leq i < d \f$ - * where \f$d\f$ is the degree of the polynomials, and \f$n_b\f$ is the number of basis points. + * \f$ k_{i+d+n_b} = b_{n_b-1} \forall 0 \leq i < d \f$ + * where \f$d\f$ is the degree of the polynomials, and \f$n_b\f$ is the number of break points in the input pair of iterators. And in the periodic case: + * \f$ k_i = b_{n_b-1-d+i} \forall 0 \leq i < d \f$ + * \f$ k_{i+d} = b_i \forall 0 \leq i \leq n_b \f$ + * \f$ k_{i+d+n_b} = b_{i+1} \forall 0 \leq i < d \f$ * * This constructor makes the knots accessible via a DiscreteSpace. * @@ -200,7 +203,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase * initial discrete function. * * @param[out] values The values of the B-splines evaluated at coordinate x. It has to be a 1D mdspan with (degree+1) elements. - * @param[in] x The coordinate where B-splines are evaluated. + * @param[in] x The coordinate where B-splines are evaluated. It has to be in the range of break points coordinates. * @return The index of the first B-spline which is evaluated. */ KOKKOS_INLINE_FUNCTION discrete_element_type @@ -215,7 +218,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase * initial discrete function. * * @param[out] derivs The derivatives of the B-splines evaluated at coordinate x. It has to be a 1D mdspan with (degree+1) elements. - * @param[in] x The coordinate where B-spline derivatives are evaluated. + * @param[in] x The coordinate where B-spline derivatives are evaluated. It has to be in the range of break points coordinates. * @return The index of the first B-spline which is derivated. */ KOKKOS_INLINE_FUNCTION discrete_element_type @@ -229,8 +232,8 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase * combination of those B-spline derivatives weighted with spline coefficients of the spline-transformed * initial discrete function. * - * @param[out] derivs The values and \f$n\f$ derivatives of the B-splines evaluated at coordinate x. It has to be a 2D mdspan with (degree+1)*(n+1) elements. - * @param[in] x The coordinate where B-spline derivatives are evaluated. + * @param[out] derivs The values and \f$n\f$ derivatives of the B-splines evaluated at coordinate x. It has to be a 2D mdspan of sizes (degree+1, n+1). + * @param[in] x The coordinate where B-spline derivatives are evaluated. It has to be in the range of break points coordinates. * @param[in] n The number of derivatives to evaluate (in addition to the B-spline values themselves). * @return The index of the first B-spline which is evaluated/derivated. */ @@ -243,7 +246,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase * * The integral of each of the B-splines over their support within the domain on which this basis was defined. * - * @param[out] int_vals The values of the integrals. It has to be a 1D mdspan of size (nbasis). + * @param[out] int_vals The values of the integrals. It has to be a 1D Chunkspan of size (nbasis). * @return The values of the integrals. */ template @@ -313,7 +316,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase return ddc::coordinate(ddc::DiscreteElement(ix.uid() + n)); } - /** @brief Returns the coordinate of the lower bound of the domain on which the B-splines are defined. + /** @brief Returns the coordinate of the first break point of the domain on which the B-splines are defined. * * @return Coordinate of the lower bound of the domain. */ @@ -322,7 +325,7 @@ class NonUniformBSplines : detail::NonUniformBSplinesBase return get_knot(0); } - /** @brief Returns the coordinate of the upper bound of the domain on which the B-splines are defined. + /** @brief Returns the coordinate of the last break point of the domain on which the B-splines are defined. * * @return Coordinate of the upper bound of the domain. */ diff --git a/include/ddc/kernels/splines/bsplines_uniform.hpp b/include/ddc/kernels/splines/bsplines_uniform.hpp index 79a6b5a13..a11019a42 100644 --- a/include/ddc/kernels/splines/bsplines_uniform.hpp +++ b/include/ddc/kernels/splines/bsplines_uniform.hpp @@ -76,7 +76,7 @@ class UniformBSplines : detail::UniformBSplinesBase return true; } - /** @brief Impl Storage class of the static attributes of the discrete dimension. + /** @brief Storage class of the static attributes of the discrete dimension. * * @tparam DDim The name of the discrete dimension. * @tparam MemorySpace The Kokkos memory space where the attributes are being stored. @@ -173,7 +173,7 @@ class UniformBSplines : detail::UniformBSplinesBase * initial discrete function. * * @param[out] values The values of the B-splines evaluated at coordinate x. It has to be a 1D mdspan with (degree+1) elements. - * @param[in] x The coordinate where B-splines are evaluated. + * @param[in] x The coordinate where B-splines are evaluated. It has to be in the range of break points coordinates. * @return The index of the first B-spline which is evaluated. */ KOKKOS_INLINE_FUNCTION discrete_element_type @@ -192,7 +192,7 @@ class UniformBSplines : detail::UniformBSplinesBase * initial discrete function. * * @param[out] derivs The derivatives of the B-splines evaluated at coordinate x. It has to be a 1D mdspan with (degree+1) elements. - * @param[in] x The coordinate where B-spline derivatives are evaluated. + * @param[in] x The coordinate where B-spline derivatives are evaluated. It has to be in the range of break points coordinates. * @return The index of the first B-spline which is evaluated. */ KOKKOS_INLINE_FUNCTION discrete_element_type @@ -206,8 +206,8 @@ class UniformBSplines : detail::UniformBSplinesBase * combination of those B-spline derivatives weighted with spline coefficients of the spline-transformed * initial discrete function. * - * @param[out] derivs The values and \f$n\f$ derivatives of the B-splines evaluated at coordinate x. It has to be a 2D mdspan with (degree+1)*(n+1) elements. - * @param[in] x The coordinate where B-spline derivatives are evaluated. + * @param[out] derivs The values and \f$n\f$ derivatives of the B-splines evaluated at coordinate x. It has to be a 2D mdspan of sizes (degree+1, n+1). + * @param[in] x The coordinate where B-spline derivatives are evaluated. It has to be in the range of break points coordinates. * @param[in] n The number of derivatives to evaluate (in addition to the B-spline values themselves). * @return The index of the first B-spline which is evaluated. */ @@ -220,7 +220,7 @@ class UniformBSplines : detail::UniformBSplinesBase * * The integral of each of the B-splines over their support within the domain on which this basis was defined. * - * @param[out] int_vals The values of the integrals. It has to be a 1D mdspan of size (nbasis). + * @param[out] int_vals The values of the integrals. It has to be a 1D Chunkspan of size (nbasis). * @return The values of the integrals. */ template From a268a08ca1cc8f1d1c48ecf2c9b03989661e6b3a Mon Sep 17 00:00:00 2001 From: blegouix Date: Thu, 25 Apr 2024 14:38:41 +0200 Subject: [PATCH 68/89] autoreview --- .../ddc/kernels/splines/spline_builder.hpp | 43 ++++---- .../ddc/kernels/splines/spline_builder_2d.hpp | 101 ++++++++---------- 2 files changed, 69 insertions(+), 75 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index 4a51c7bfd..b6ba4570f 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -252,9 +252,9 @@ class SplineBuilder /** * @brief Get the domain for the 1D interpolation mesh used by this class. * - * This is the 1D because it is defined along the dimension of interest. + * This is 1D because it is defined along the dimension of interest. * - * @return The 1D domain for the grid points. + * @return The 1D domain for the interpolation mesh. */ interpolation_domain_type interpolation_domain() const noexcept { @@ -267,7 +267,7 @@ class SplineBuilder * Values of the function must be provided on this domain in order * to build a spline transform of the function (cartesian product of 1D interpolation_domain and batch_domain). * - * @return The domain for the interpolation points. + * @return The domain for the interpolation mesh. */ batched_interpolation_domain_type batched_interpolation_domain() const noexcept { @@ -289,7 +289,7 @@ class SplineBuilder /** * @brief Get the 1D domain on which spline coefficients are defined. * - * The 1D spline domain corresponding to dimension of interest. + * The 1D spline domain corresponding to the dimension of interest. * * @return The 1D domain for the spline coefficients. */ @@ -301,7 +301,7 @@ class SplineBuilder /** * @brief Get the whole domain on which spline coefficients are defined, preserving memory layout. * - * The domain on which spline coefficients will be computed, preserving memory layout (order of dimensions). + * Spline-transformed functions are computed on this domain. * * @return The domain for the spline coefficients. */ @@ -315,7 +315,7 @@ class SplineBuilder /** * @brief Get the whole domain on which spline coefficients are defined, with dimension of interest contiguous. * - * The (transposed) whole domain on which spline coefficients will be computed, with dimension of interest contiguous. + * This is used internally because of solvers limitation and because it may be beneficial to computation performance. * * @return The (transposed) domain for the spline coefficients. */ @@ -327,7 +327,7 @@ class SplineBuilder /** * @brief Get the whole domain on which derivatives on lower boundary are defined. * - * This is only used with HERMITE boundary conditions. + * This is only used with BoundCond::HERMITE boundary conditions. * * @return The domain for the Derivs values. */ @@ -343,7 +343,7 @@ class SplineBuilder /** * @brief Get the whole domain on which derivatives on upper boundary are defined. * - * This is only used with HERMITE boundary conditions. + * This is only used with BoundCond::HERMITE boundary conditions. * * @return The domain for the Derivs values. */ @@ -359,11 +359,11 @@ class SplineBuilder /** * @brief Get the interpolation matrix. * - * Get the interpolation matrix. This can be useful for debugging (as it allows + * This can be useful for debugging (as it allows * one to print the matrix) or for more complex quadrature schemes. * - * Warning: the returned ddc::detail::Matrix class is not supposed to be exposed - * to user, which means its usage is not tested out of the scope of DDC splines transforms. + * Warning: the returned detail::Matrix class is not supposed to be exposed + * to user, which means its usage is not supported out of the scope of DDC spline transforms. * Use at your own risk. * * @return A reference to the interpolation matrix. @@ -374,22 +374,23 @@ class SplineBuilder } /** - * @brief Build a spline approximation of a function. + * @brief Compute 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. + * 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 BoundCond::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 basis-splines. + * associated with B-splines. * - * @param[out] spline The coefficients of the spline calculated by the function. - * @param[in] vals The values of the function at the grid points. + * @param[out] spline The coefficients of the spline computed by this SplineBuilder. + * @param[in] vals The values of the function on the interpolation mesh. * @param[in] derivs_xmin The values of the derivatives at the lower boundary - * (used only with HERMITE lower boundary condition). + * (used only with BoundCond::HERMITE lower boundary condition). * @param[in] derivs_xmax The values of the derivatives at the upper boundary - * (used only with HERMITE upper boundary condition). + * (used only with BoundCond::HERMITE upper boundary condition). */ template void operator()( diff --git a/include/ddc/kernels/splines/spline_builder_2d.hpp b/include/ddc/kernels/splines/spline_builder_2d.hpp index 64e690567..816ecb82a 100644 --- a/include/ddc/kernels/splines/spline_builder_2d.hpp +++ b/include/ddc/kernels/splines/spline_builder_2d.hpp @@ -12,7 +12,7 @@ namespace ddc { * @brief A class for creating a 2D spline approximation of a function. * * A class which contains an operator () which can be used to build a 2D spline approximation - * of a function. A 2D spline approximation uses a cross-product between two 1D spline builder. + * of a function. A 2D spline approximation uses a cross-product between two 1D SplineBuilder. * * @see SplineBuilder */ @@ -97,44 +97,44 @@ class SplineBuilder2D public: /** - * @brief The type of the BSplines in the first dimension which are compatible with this class. + * @brief The type of the B-splines in the first dimension. */ using bsplines_type1 = typename builder_type1::bsplines_type; /** - * @brief The type of the BSplines in the second dimension which are compatible with this class. + * @brief The type of the B-splines in the second dimension. */ using bsplines_type2 = typename builder_type2::bsplines_type; /** - * @brief The type of the Deriv domain on boundaries in the first dimension which are compatible with this class. + * @brief The type of the Deriv domain on boundaries in the first dimension. */ using deriv_type1 = typename builder_type1::deriv_type; /** - * @brief The type of the Deriv domain on boundaries in the second dimension which are compatible with this class. + * @brief The type of the Deriv domain on boundaries in the second dimension. */ using deriv_type2 = typename builder_type2::deriv_type; /** - * @brief The type of the interpolation mesh in the first dimension used by this class. + * @brief The type of the interpolation mesh in the first dimension. */ using interpolation_mesh_type1 = typename builder_type1::interpolation_mesh_type; /** - * @brief The type of the interpolation mesh in the second dimension used by this class. + * @brief The type of the interpolation mesh in the second dimension. */ using interpolation_mesh_type2 = typename builder_type2::interpolation_mesh_type; /** - * @brief The type of the domain for the interpolation mesh is the first dimension used by this class. + * @brief The type of the domain for the interpolation mesh is the first dimension. */ using interpolation_domain_type1 = typename builder_type1::interpolation_mesh_type; /** - * @brief The type of the domain for the interpolation mesh is the second dimension used by this class. + * @brief The type of the domain for the interpolation mesh is the second dimension. */ using interpolation_domain_type2 = typename builder_type2::interpolation_mesh_type; /** - * @brief The type of the domain for the interpolation mesh is the 2D dimension used by this class. + * @brief The type of the domain for the interpolation mesh is the 2D dimension. */ using interpolation_domain_type = ddc::DiscreteDomain; @@ -145,7 +145,7 @@ class SplineBuilder2D using batched_interpolation_domain_type = ddc::DiscreteDomain; /** - * @brief The type of the batch domain (obtained by removing dimensions of interests from whole space). + * @brief The type of the batch domain (obtained by removing dimensions of interest from whole space). */ using batch_domain_type = ddc::detail::convert_type_seq_to_discrete_domain>>; /** - * @brief The type of the whole Derivs domain (cartesian product of the 1D Deriv domain and the associated batch domain) in the first dimension used by the class, preserving the underlying memory layout (order of dimensions). + * @brief The type of the whole Derivs domain (cartesian product of the 1D Deriv domain and the associated batch domain) in the first dimension, preserving the underlying memory layout (order of dimensions). */ using batched_derivs_domain_type1 = typename builder_type1::batched_derivs_domain_type; /** - * @brief The type of the whole Derivs domain (cartesian product of the 1D Deriv domain and the associated batch domain) in the second dimension used by the class, preserving the underlying memory layout (order of dimensions). + * @brief The type of the whole Derivs domain (cartesian product of the 1D Deriv domain and the associated batch domain) in the second dimension, preserving the underlying memory layout (order of dimensions). */ using batched_derivs_domain_type2 = ddc::detail::convert_type_seq_to_discrete_domain>>; /** - * @brief The type of the whole Derivs domain (cartesian product of the 2D Deriv domain and the batch domain) in the second dimension used by the class, preserving the underlying memory layout (order of dimensions). + * @brief The type of the whole Derivs domain (cartesian product of the 2D Deriv domain and the batch domain) in the second dimension, preserving the underlying memory layout (order of dimensions). */ using batched_derivs_domain_type = ddc::detail::convert_type_seq_to_discrete_domain( + m_spline_builder1.interpolation_domain(), + m_spline_builder2.interpolation_domain()); } /** - * @brief Get the 2D dimension domain from which the approximation is defined. + * @brief Get the whole domain representing interpolation points. * - * Get the 2D dimension domain on which values of the function must be provided in order - * to build a spline approximation of the function. + * Values of the function must be provided on this domain in order + * to build a spline transform of the function (cartesian product of 2D interpolation_domain and batch_domain). * - * @return The 2D dimension domain for the grid points. + * @return The domain for the interpolation mesh. */ - interpolation_domain_type interpolation_domain() const noexcept + batched_interpolation_domain_type batched_interpolation_domain() const noexcept { - return ddc::DiscreteDomain( - m_spline_builder1.interpolation_domain(), - m_spline_builder2.interpolation_domain()); + return m_spline_builder1.batched_interpolation_domain(); } /** * @brief Get the batch domain. * - * Get the batch domain (obtained by removing dimensions of interest from whole interpolation domain). + * Obtained by removing dimensions of interest from whole interpolation domain. * * @return The batch domain. */ @@ -287,15 +282,13 @@ class SplineBuilder2D } /** - * @brief Get the 2D domain on which the approximation is defined. + * @brief Get the 2D domain on which spline coefficients are defined. * - * Get the 2D domain of the basis-splines for which the coefficients of the spline - * approximation must be calculated. + * The 2D spline domain corresponding to the dimensions of interest. * - * @return The 2D domain for the splines. + * @return The 2D domain for the spline coefficients. */ - ddc::DiscreteDomain spline_domain() - const noexcept // TODO : clarify name + ddc::DiscreteDomain spline_domain() const noexcept { return ddc::DiscreteDomain( ddc::discrete_space().full_domain(), @@ -305,7 +298,7 @@ class SplineBuilder2D /** * @brief Get the whole domain on which spline coefficients are defined, preserving memory layout. * - * Get the whole domain on which spline coefficients will be computed, preserving memory layout (order of dimensions). + * Spline-transformed functions are computed on this domain. * * @return The domain for the spline coefficients. */ @@ -319,20 +312,20 @@ class SplineBuilder2D } /** - * @brief Build a 2D spline approximation of a function. - * - * Use the values of a function at known grid points (as specified by - * SplineBuilder2D::interpolation_domain_type) and the derivatives of the - * function at the boundaries (if necessary for the chosen boundary - * conditions) to calculate a 2D spline approximation of a function. + * @brief Compute a 2D spline approximation of a function. * + * Use the values of a function (defined on + * SplineBuilder2D::batched_interpolation_domain) and the derivatives of the + * function at the boundaries (in the case of BoundCond::HERMITE only) + * to calculate a 2D spline approximation of this function. + * * The spline approximation is stored as a ChunkSpan of coefficients - * associated with basis-splines. + * associated with B-splines. * * @param[out] spline - * The coefficients of the spline calculated by the function. + * The coefficients of the spline computed by this SplineBuilder. * @param[in] vals - * The values of the function at the grid points. + * The values of the function at the interpolation mesh. * @param[in] derivs_min1 * The values of the derivatives at the lower boundary in the first dimension. * @param[in] derivs_max1 From a972961c03d541446fef146f37d4badd34394797 Mon Sep 17 00:00:00 2001 From: blegouix Date: Thu, 25 Apr 2024 14:41:28 +0200 Subject: [PATCH 69/89] remove null_extrapolation --- include/ddc/kernels/splines/null_extrapolation_rule.hpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/include/ddc/kernels/splines/null_extrapolation_rule.hpp b/include/ddc/kernels/splines/null_extrapolation_rule.hpp index e7c1348f2..a81930da6 100644 --- a/include/ddc/kernels/splines/null_extrapolation_rule.hpp +++ b/include/ddc/kernels/splines/null_extrapolation_rule.hpp @@ -6,16 +6,8 @@ namespace ddc { -/** - * @brief A functor for describing a spline boundary value by a null extrapolation for 1D evaluator. - */ struct NullExtrapolationRule { - /** - * @brief Evaluates 0. out of the domain. - * - * @return A double with the value of the function on B-splines evaluated at the coordinate (here, 0.). - */ template KOKKOS_FUNCTION double operator()(CoordType, ChunkSpan) const { From c116d00efc189083c85cfcfadc63509c0c8a175f Mon Sep 17 00:00:00 2001 From: blegouix Date: Thu, 25 Apr 2024 14:45:03 +0200 Subject: [PATCH 70/89] Emily's minireview --- include/ddc/kernels/splines/spline_builder.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index b6ba4570f..af186eee0 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -22,9 +22,9 @@ enum class SplineSolver { }; /** - * @brief An helper giving the uniform/non_uniform status of a spline interpolation mesh according to its attributes. + * @brief A helper giving the uniform/non_uniform status of a spline interpolation mesh according to its attributes. * - * An helper giving the uniform/non_uniform status of a spline interpolation mesh according to its attributes. + * A helper giving the uniform/non_uniform status of a spline interpolation mesh according to its attributes. * * @param is_uniform A boolean giving the presumed status before considering boundary conditions. * @param BcXmin The lower boundary condition. From b247fbc63f8cd5002384cbc983db2a1f4ea0292b Mon Sep 17 00:00:00 2001 From: blegouix Date: Thu, 25 Apr 2024 15:57:01 +0200 Subject: [PATCH 71/89] shorten doxygen comments --- .../ddc/kernels/splines/spline_builder.hpp | 64 ++++--------- .../ddc/kernels/splines/spline_builder_2d.hpp | 91 +++++-------------- 2 files changed, 41 insertions(+), 114 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index af186eee0..3ad17158e 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -83,61 +83,41 @@ class SplineBuilder using tag_type = typename InterpolationMesh::continuous_dimension_type; public: - /** - * @brief The type of the Kokkos execution space used by this class. - */ + /// @brief The type of the Kokkos execution space used by this class. using exec_space = ExecSpace; - /** - * @brief The type of the Kokkos memory space used by this class. - */ + /// @brief The type of the Kokkos memory space used by this class. using memory_space = MemorySpace; - /** - * @brief The type of the interpolation discrete dimension (discrete dimension of interest) used by this class. - */ + /// @brief The type of the interpolation discrete dimension (discrete dimension of interest) used by this class. using interpolation_mesh_type = InterpolationMesh; - /** - * @brief The discrete dimension representing the B-splines. - */ + /// @brief The discrete dimension representing the B-splines. using bsplines_type = BSplines; - /** - * @brief The type of the Deriv dimension at the boundaries. - */ + /// @brief The type of the Deriv dimension at the boundaries. using deriv_type = ddc::Deriv; - /** - * @brief The type of the domain for the 1D interpolation mesh used by this class. - */ + /// @brief The type of the domain for the 1D interpolation mesh used by this class. using interpolation_domain_type = ddc::DiscreteDomain; - /** - * @brief The type of the whole domain representing interpolation points. - */ + /// @brief The type of the whole domain representing interpolation points. using batched_interpolation_domain_type = ddc::DiscreteDomain; - /** - * @brief The type of the batch domain (obtained by removing dimension of interest from whole space). - */ + /// @brief The type of the batch domain (obtained by removing dimension of interest from whole space). using batch_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq>>; - /** - * @brief The type of the whole spline domain (cartesian product of 1D spline domain and batch domain) preserving the underlying memory layout (order of dimensions). - */ + /// @brief The type of the whole spline domain (cartesian product of 1D spline domain and batch domain) preserving the underlying memory layout (order of dimensions). using batched_spline_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, ddc::detail::TypeSeq>>; - /** - * @brief The type of the whole spline domain (cartesian product of 1D spline domain and batch domain) with 1D spline dimension being contiguous . - */ + /// @brief The type of the whole spline domain (cartesian product of 1D spline domain and batch domain) with 1D spline dimension being contiguous . using batched_spline_tr_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, @@ -145,38 +125,26 @@ class SplineBuilder ddc::detail::TypeSeq, ddc::detail::TypeSeq>>>; - /** - * @brief The type of the whole Deriv domain (cartesian product of 1D Deriv domain and batch domain) preserving the underlying memory layout (order of dimensions). - */ + /// @brief The type of the whole Deriv domain (cartesian product of 1D Deriv domain and batch domain) preserving the underlying memory layout (order of dimensions). using batched_derivs_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, ddc::detail::TypeSeq>>; - /** - * @brief Indicates if the degree of the splines is odd or even. - */ + /// @brief Indicates if the degree of the splines is odd or even. static constexpr bool s_odd = BSplines::degree() % 2; - /** - * @brief The number of equations defining the boundary condition at the lower bound. - */ + /// @brief The number of equations defining the boundary condition at the lower bound. static constexpr int s_nbc_xmin = n_boundary_equations(BcXmin, BSplines::degree()); - /** - * @brief The number of equations defining the boundary condition at the upper bound. - */ + /// @brief The number of equations defining the boundary condition at the upper bound. static constexpr int s_nbc_xmax = n_boundary_equations(BcXmax, BSplines::degree()); - /** - * @brief The boundary condition implemented at the lower bound. - */ + /// @brief The boundary condition implemented at the lower bound. static constexpr ddc::BoundCond s_bc_xmin = BcXmin; - /** - * @brief The boundary condition implemented at the upper bound. - */ + /// @brief The boundary condition implemented at the upper bound. static constexpr ddc::BoundCond s_bc_xmax = BcXmax; private: diff --git a/include/ddc/kernels/splines/spline_builder_2d.hpp b/include/ddc/kernels/splines/spline_builder_2d.hpp index 816ecb82a..b2aee61ee 100644 --- a/include/ddc/kernels/splines/spline_builder_2d.hpp +++ b/include/ddc/kernels/splines/spline_builder_2d.hpp @@ -32,19 +32,13 @@ template < class SplineBuilder2D { public: - /** - * @brief The type of the Kokkos execution space used by this class. - */ + /// @brief The type of the Kokkos execution space used by this class. using exec_space = ExecSpace; - /** - * @brief The type of the Kokkos memory space used by this class. - */ + /// @brief The type of the Kokkos memory space used by this class. using memory_space = MemorySpace; - /** - * @brief The type of the SplineBuilder used by this class to spline-transform along first dimension. - */ + /// @brief The type of the SplineBuilder used by this class to spline-transform along first dimension. using builder_type1 = ddc::SplineBuilder< ExecSpace, MemorySpace, @@ -55,9 +49,7 @@ class SplineBuilder2D Solver, IDimX...>; - /** - * @brief The type of the SplineBuilder used by this class to spline-transform along second dimension. - */ + /// @brief The type of the SplineBuilder used by this class to spline-transform along second dimension. using builder_type2 = ddc::SplineBuilder< ExecSpace, MemorySpace, @@ -68,9 +60,7 @@ class SplineBuilder2D Solver, std::conditional_t, BSpline1, IDimX>...>; - /** - * @brief The type of the SplineBuilder used by this class to spline-transform the second-dimension-derivatives along first dimension. - */ + /// @brief The type of the SplineBuilder used by this class to spline-transform the second-dimension-derivatives along first dimension. using builder_deriv_type1 = ddc::SplineBuilder< ExecSpace, MemorySpace, @@ -85,99 +75,68 @@ class SplineBuilder2D IDimX>...>; private: - /** - * @brief Tag the dimension of the first 1D SplineBuilder. - */ + /// @brief Tag the dimension of the first 1D SplineBuilder. using tag_type1 = typename builder_type1::bsplines_type::tag_type; - /** - * @brief Tag the dimension of the second 1D SplineBuilder. - */ + /// @brief Tag the dimension of the second 1D SplineBuilder. using tag_type2 = typename builder_type2::bsplines_type::tag_type; public: - /** - * @brief The type of the B-splines in the first dimension. - */ + /// @brief The type of the B-splines in the first dimension. using bsplines_type1 = typename builder_type1::bsplines_type; - /** - * @brief The type of the B-splines in the second dimension. - */ + /// @brief The type of the B-splines in the second dimension. using bsplines_type2 = typename builder_type2::bsplines_type; - /** - * @brief The type of the Deriv domain on boundaries in the first dimension. - */ + /// @brief The type of the Deriv domain on boundaries in the first dimension. using deriv_type1 = typename builder_type1::deriv_type; - /** - * @brief The type of the Deriv domain on boundaries in the second dimension. - */ + /// @brief The type of the Deriv domain on boundaries in the second dimension. using deriv_type2 = typename builder_type2::deriv_type; - /** - * @brief The type of the interpolation mesh in the first dimension. - */ + /// @brief The type of the interpolation mesh in the first dimension. using interpolation_mesh_type1 = typename builder_type1::interpolation_mesh_type; - /** - * @brief The type of the interpolation mesh in the second dimension. - */ + + /// @brief The type of the interpolation mesh in the second dimension. using interpolation_mesh_type2 = typename builder_type2::interpolation_mesh_type; - /** - * @brief The type of the domain for the interpolation mesh is the first dimension. - */ + /// @brief The type of the domain for the interpolation mesh is the first dimension. using interpolation_domain_type1 = typename builder_type1::interpolation_mesh_type; - /** - * @brief The type of the domain for the interpolation mesh is the second dimension. - */ + + /// @brief The type of the domain for the interpolation mesh is the second dimension. using interpolation_domain_type2 = typename builder_type2::interpolation_mesh_type; - /** - * @brief The type of the domain for the interpolation mesh is the 2D dimension. - */ + + /// @brief The type of the domain for the interpolation mesh is the 2D dimension. using interpolation_domain_type = ddc::DiscreteDomain; - /** - * @brief The type of the whole domain representing interpolation points. - */ + /// @brief The type of the whole domain representing interpolation points. using batched_interpolation_domain_type = ddc::DiscreteDomain; - /** - * @brief The type of the batch domain (obtained by removing dimensions of interest from whole space). - */ + /// @brief The type of the batch domain (obtained by removing dimensions of interest from whole space). using batch_domain_type = ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq>>; - /** - * @brief The type of the whole spline domain (cartesian product of 2D spline domain and batch domain) preserving the underlying memory layout (order of dimensions). - */ + /// @brief The type of the whole spline domain (cartesian product of 2D spline domain and batch domain) preserving the underlying memory layout (order of dimensions). using batched_spline_domain_type = ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, ddc::detail::TypeSeq>>; - /** - * @brief The type of the whole Derivs domain (cartesian product of the 1D Deriv domain and the associated batch domain) in the first dimension, preserving the underlying memory layout (order of dimensions). - */ + /// @brief The type of the whole Derivs domain (cartesian product of the 1D Deriv domain and the associated batch domain) in the first dimension, preserving the underlying memory layout (order of dimensions). using batched_derivs_domain_type1 = typename builder_type1::batched_derivs_domain_type; - /** - * @brief The type of the whole Derivs domain (cartesian product of the 1D Deriv domain and the associated batch domain) in the second dimension, preserving the underlying memory layout (order of dimensions). - */ + /// @brief The type of the whole Derivs domain (cartesian product of the 1D Deriv domain and the associated batch domain) in the second dimension, preserving the underlying memory layout (order of dimensions). using batched_derivs_domain_type2 = ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, ddc::detail::TypeSeq>>; - /** - * @brief The type of the whole Derivs domain (cartesian product of the 2D Deriv domain and the batch domain) in the second dimension, preserving the underlying memory layout (order of dimensions). - */ + /// @brief The type of the whole Derivs domain (cartesian product of the 2D Deriv domain and the batch domain) in the second dimension, preserving the underlying memory layout (order of dimensions). using batched_derivs_domain_type = ddc::detail::convert_type_seq_to_discrete_domain, From 185ca1132f9f812bd22f0626684256d208025bf6 Mon Sep 17 00:00:00 2001 From: blegouix Date: Fri, 26 Apr 2024 11:04:50 +0200 Subject: [PATCH 72/89] Emily's review --- .../ddc/kernels/splines/spline_builder.hpp | 58 ++++++++++++------- .../ddc/kernels/splines/spline_builder_2d.hpp | 42 ++++++++++---- 2 files changed, 66 insertions(+), 34 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index 3ad17158e..eef15c403 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -14,8 +14,8 @@ namespace ddc { /** * @brief An enum determining the backend solver of a SplineBuilder or SplineBuilder2d. * - * An enum determining the backend solver of a SplineBuilder or SplineBuilder2d. Only GINKGO available at the moment, - * other solvers will be implemented in the futur. + * An enum determining the backend solver of a SplineBuilder or SplineBuilder2d. Only GINKGO is available at the moment, + * other solvers will be implemented in the future. */ enum class SplineSolver { GINKGO ///< Enum member to identify the Ginkgo-based solver (iterative method) @@ -54,9 +54,9 @@ constexpr bool is_spline_interpolation_mesh_uniform( * BcXmin and BcXmax, and it interpolates the function at the points on the interpolation_mesh * associated with interpolation_mesh_type. * @tparam ExecSpace The Kokkos execution space on which the spline transform is performed. - * @tparam MemorySpace The Kokkos memory space on which the data (interpolation function and splines coefficients) are stored. + * @tparam MemorySpace The Kokkos memory space on which the data (interpolation function and splines coefficients) is stored. * @tparam BSplines The discrete dimension representing the B-splines. - * @tparam InterpolationMesh The discrete dimension supporting the interpolation points. + * @tparam InterpolationMesh The discrete dimension on which interpolation points are defined. * @tparam BcXmin The lower boundary condition. * @tparam BcXmax The upper boundary condition. * @tparam Solver The SplineSolver giving the backend used to perform the spline transform. @@ -104,20 +104,29 @@ class SplineBuilder /// @brief The type of the whole domain representing interpolation points. using batched_interpolation_domain_type = ddc::DiscreteDomain; - /// @brief The type of the batch domain (obtained by removing dimension of interest from whole space). + /** + * @brief The type of the batch domain (obtained by removing the dimension of interest + * from the whole domain). + */ using batch_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq>>; - /// @brief The type of the whole spline domain (cartesian product of 1D spline domain and batch domain) preserving the underlying memory layout (order of dimensions). + /** + * @brief The type of the whole spline domain (cartesian product of 1D spline domain + * and batch domain) preserving the underlying memory layout (order of dimensions). + */ using batched_spline_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, ddc::detail::TypeSeq>>; - /// @brief The type of the whole spline domain (cartesian product of 1D spline domain and batch domain) with 1D spline dimension being contiguous . + /** + * @brief The type of the whole spline domain (cartesian product of the 1D spline domain + * and the batch domain) with 1D spline dimension being coalescent. + */ using batched_spline_tr_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, @@ -125,7 +134,10 @@ class SplineBuilder ddc::detail::TypeSeq, ddc::detail::TypeSeq>>>; - /// @brief The type of the whole Deriv domain (cartesian product of 1D Deriv domain and batch domain) preserving the underlying memory layout (order of dimensions). + /** + * @brief The type of the whole Deriv domain (cartesian product of 1D Deriv domain + * and batch domain) preserving the underlying memory layout (order of dimensions). + */ using batched_derivs_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, @@ -164,9 +176,11 @@ class SplineBuilder /** * @brief Build a SplineBuilder acting on batched_interpolation_domain. * - * @param batched_interpolation_domain The domain on which are defined the interpolation points. - * @param cols_per_chunk An hyperparameter used by the slicer (internal to the solver) to define the size of a chunk of right-and-sides of the linear problem to be computed in parallel. - * @param preconditionner_max_block_size An hyperparameter used by the slicer (internal to the solver) to define the size of a block used by Block-Jacobi preconditionner. + * @param batched_interpolation_domain The domain on which the interpolation points are defined. + * @param cols_per_chunk A hyperparameter used by the slicer (internal to the solver) to define the size of a chunk of right-and-sides of the linear problem to be computed in parallel. + * @param preconditionner_max_block_size A hyperparameter used by the slicer (internal to the solver) to define the size of a block used by the Block-Jacobi preconditioner. + * + * @see MatrixSparse */ explicit SplineBuilder( batched_interpolation_domain_type const& batched_interpolation_domain, @@ -233,7 +247,7 @@ class SplineBuilder * @brief Get the whole domain representing interpolation points. * * Values of the function must be provided on this domain in order - * to build a spline transform of the function (cartesian product of 1D interpolation_domain and batch_domain). + * to build a spline representation of the function (cartesian product of 1D interpolation_domain and batch_domain). * * @return The domain for the interpolation mesh. */ @@ -245,7 +259,7 @@ class SplineBuilder /** * @brief Get the batch domain. * - * Obtained by removing dimension of interest from whole interpolation domain. + * Obtained by removing the dimension of interest from the whole interpolation domain. * * @return The batch domain. */ @@ -281,7 +295,7 @@ class SplineBuilder } /** - * @brief Get the whole domain on which spline coefficients are defined, with dimension of interest contiguous. + * @brief Get the whole domain on which spline coefficients are defined, with the dimension of interest coalescent. * * This is used internally because of solvers limitation and because it may be beneficial to computation performance. * @@ -329,10 +343,10 @@ class SplineBuilder * * This can be useful for debugging (as it allows * one to print the matrix) or for more complex quadrature schemes. - * - * Warning: the returned detail::Matrix class is not supposed to be exposed - * to user, which means its usage is not supported out of the scope of DDC spline transforms. - * Use at your own risk. + * + * Warning: the returned detail::Matrix class is not supposed to be exposed + * to user, which means its usage is not supported out of the scope of DDC spline transforms. + * Use at your own risk. * * @return A reference to the interpolation matrix. */ @@ -347,8 +361,8 @@ class SplineBuilder * 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 BoundCond::HERMITE only, defined - * on SplineBuilder::batched_derivs_xmin_domain and SplineBuilder::batched_derivs_xmax_domain) - * to calculate a spline approximation of this function. + * 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. @@ -356,9 +370,9 @@ class SplineBuilder * @param[out] spline The coefficients of the spline computed by this SplineBuilder. * @param[in] vals The values of the function on the interpolation mesh. * @param[in] derivs_xmin The values of the derivatives at the lower boundary - * (used only with BoundCond::HERMITE lower boundary condition). + * (used only with BoundCond::HERMITE lower boundary condition). * @param[in] derivs_xmax The values of the derivatives at the upper boundary - * (used only with BoundCond::HERMITE upper boundary condition). + * (used only with BoundCond::HERMITE upper boundary condition). */ template void operator()( diff --git a/include/ddc/kernels/splines/spline_builder_2d.hpp b/include/ddc/kernels/splines/spline_builder_2d.hpp index b2aee61ee..24a8c5c3e 100644 --- a/include/ddc/kernels/splines/spline_builder_2d.hpp +++ b/include/ddc/kernels/splines/spline_builder_2d.hpp @@ -113,30 +113,48 @@ class SplineBuilder2D /// @brief The type of the whole domain representing interpolation points. using batched_interpolation_domain_type = ddc::DiscreteDomain; - /// @brief The type of the batch domain (obtained by removing dimensions of interest from whole space). + /** + * @brief The type of the batch domain (obtained by removing the dimensions of interest + * from the whole domain). + */ using batch_domain_type = ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq>>; - /// @brief The type of the whole spline domain (cartesian product of 2D spline domain and batch domain) preserving the underlying memory layout (order of dimensions). + /** + * @brief The type of the whole spline domain (cartesian product of 2D spline domain + * and batch domain) preserving the underlying memory layout (order of dimensions). + */ using batched_spline_domain_type = ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, ddc::detail::TypeSeq>>; - /// @brief The type of the whole Derivs domain (cartesian product of the 1D Deriv domain and the associated batch domain) in the first dimension, preserving the underlying memory layout (order of dimensions). + /** + * @brief The type of the whole Derivs domain (cartesian product of the 1D Deriv domain + * and the associated batch domain) in the first dimension, preserving the underlying + * memory layout (order of dimensions). + */ using batched_derivs_domain_type1 = typename builder_type1::batched_derivs_domain_type; - /// @brief The type of the whole Derivs domain (cartesian product of the 1D Deriv domain and the associated batch domain) in the second dimension, preserving the underlying memory layout (order of dimensions). + /** + * @brief The type of the whole Derivs domain (cartesian product of the 1D Deriv domain + * and the associated batch domain) in the second dimension, preserving the underlying + * memory layout (order of dimensions). + */ using batched_derivs_domain_type2 = ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, ddc::detail::TypeSeq>>; - /// @brief The type of the whole Derivs domain (cartesian product of the 2D Deriv domain and the batch domain) in the second dimension, preserving the underlying memory layout (order of dimensions). + /** + * @brief The type of the whole Derivs domain (cartesian product of the 2D Deriv domain + * and the batch domain) in the second dimension, preserving the underlying + * memory layout (order of dimensions). + */ using batched_derivs_domain_type = ddc::detail::convert_type_seq_to_discrete_domain, @@ -152,11 +170,11 @@ class SplineBuilder2D /** * @brief Create a new SplineBuilder2D. * - * @param batched_interpolation_domain - * The 2D domain on which points will be provided in order to - * create the 2D spline approximation. - * @param cols_per_chunk The number of columns in the rhs passed to the underlying linear solver. - * @param preconditionner_max_block_size The block size of in the block Jacobi preconditioner. + * @param batched_interpolation_domain The domain on which the interpolation points are defined. + * @param cols_per_chunk A hyperparameter used by the slicer (internal to the solver) to define the size of a chunk of right-and-sides of the linear problem to be computed in parallel. + * @param preconditionner_max_block_size A hyperparameter used by the slicer (internal to the solver) to define the size of a block used by the Block-Jacobi preconditioner. + * + * @see MatrixSparse */ explicit SplineBuilder2D( batched_interpolation_domain_type const& batched_interpolation_domain, @@ -219,7 +237,7 @@ class SplineBuilder2D * @brief Get the whole domain representing interpolation points. * * Values of the function must be provided on this domain in order - * to build a spline transform of the function (cartesian product of 2D interpolation_domain and batch_domain). + * to build a spline representation of the function (cartesian product of 2D interpolation_domain and batch_domain). * * @return The domain for the interpolation mesh. */ @@ -231,7 +249,7 @@ class SplineBuilder2D /** * @brief Get the batch domain. * - * Obtained by removing dimensions of interest from whole interpolation domain. + * Obtained by removing the dimensions of interest from the whole interpolation domain. * * @return The batch domain. */ From 89bff3f8f8898d918b81c6399012a99c4043cde7 Mon Sep 17 00:00:00 2001 From: blegouix Date: Fri, 26 Apr 2024 11:14:36 +0200 Subject: [PATCH 73/89] ident --- .../ddc/kernels/splines/spline_builder.hpp | 4 +-- .../ddc/kernels/splines/spline_builder_2d.hpp | 36 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index eef15c403..3e2e8bfd7 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -179,8 +179,8 @@ class SplineBuilder * @param batched_interpolation_domain The domain on which the interpolation points are defined. * @param cols_per_chunk A hyperparameter used by the slicer (internal to the solver) to define the size of a chunk of right-and-sides of the linear problem to be computed in parallel. * @param preconditionner_max_block_size A hyperparameter used by the slicer (internal to the solver) to define the size of a block used by the Block-Jacobi preconditioner. - * - * @see MatrixSparse + * + * @see MatrixSparse */ explicit SplineBuilder( batched_interpolation_domain_type const& batched_interpolation_domain, diff --git a/include/ddc/kernels/splines/spline_builder_2d.hpp b/include/ddc/kernels/splines/spline_builder_2d.hpp index 24a8c5c3e..fdce252b2 100644 --- a/include/ddc/kernels/splines/spline_builder_2d.hpp +++ b/include/ddc/kernels/splines/spline_builder_2d.hpp @@ -123,9 +123,9 @@ class SplineBuilder2D ddc::detail::TypeSeq>>; /** - * @brief The type of the whole spline domain (cartesian product of 2D spline domain - * and batch domain) preserving the underlying memory layout (order of dimensions). - */ + * @brief The type of the whole spline domain (cartesian product of 2D spline domain + * and batch domain) preserving the underlying memory layout (order of dimensions). + */ using batched_spline_domain_type = ddc::detail::convert_type_seq_to_discrete_domain, @@ -133,17 +133,17 @@ class SplineBuilder2D ddc::detail::TypeSeq>>; /** - * @brief The type of the whole Derivs domain (cartesian product of the 1D Deriv domain - * and the associated batch domain) in the first dimension, preserving the underlying - * memory layout (order of dimensions). - */ + * @brief The type of the whole Derivs domain (cartesian product of the 1D Deriv domain + * and the associated batch domain) in the first dimension, preserving the underlying + * memory layout (order of dimensions). + */ using batched_derivs_domain_type1 = typename builder_type1::batched_derivs_domain_type; /** - * @brief The type of the whole Derivs domain (cartesian product of the 1D Deriv domain - * and the associated batch domain) in the second dimension, preserving the underlying - * memory layout (order of dimensions). - */ + * @brief The type of the whole Derivs domain (cartesian product of the 1D Deriv domain + * and the associated batch domain) in the second dimension, preserving the underlying + * memory layout (order of dimensions). + */ using batched_derivs_domain_type2 = ddc::detail::convert_type_seq_to_discrete_domain, @@ -151,10 +151,10 @@ class SplineBuilder2D ddc::detail::TypeSeq>>; /** - * @brief The type of the whole Derivs domain (cartesian product of the 2D Deriv domain - * and the batch domain) in the second dimension, preserving the underlying - * memory layout (order of dimensions). - */ + * @brief The type of the whole Derivs domain (cartesian product of the 2D Deriv domain + * and the batch domain) in the second dimension, preserving the underlying + * memory layout (order of dimensions). + */ using batched_derivs_domain_type = ddc::detail::convert_type_seq_to_discrete_domain, @@ -171,10 +171,10 @@ class SplineBuilder2D * @brief Create a new SplineBuilder2D. * * @param batched_interpolation_domain The domain on which the interpolation points are defined. - * @param cols_per_chunk A hyperparameter used by the slicer (internal to the solver) to define the size of a chunk of right-and-sides of the linear problem to be computed in parallel. + * @param cols_per_chunk A hyperparameter used by the slicer (internal to the solver) to define the size of a chunk of right-and-sides of the linear problem to be computed in parallel. * @param preconditionner_max_block_size A hyperparameter used by the slicer (internal to the solver) to define the size of a block used by the Block-Jacobi preconditioner. - * - * @see MatrixSparse + * + * @see MatrixSparse */ explicit SplineBuilder2D( batched_interpolation_domain_type const& batched_interpolation_domain, From bdc3ac852ebc891536a8a8049b738d66543343b4 Mon Sep 17 00:00:00 2001 From: blegouix Date: Tue, 30 Apr 2024 13:21:15 +0200 Subject: [PATCH 74/89] wip --- .../ddc/kernels/splines/spline_builder.hpp | 19 +++++++++++++++---- .../ddc/kernels/splines/spline_builder_2d.hpp | 6 ++++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index 3e2e8bfd7..9d4e1dfd1 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -107,6 +107,8 @@ class SplineBuilder /** * @brief The type of the batch domain (obtained by removing the dimension of interest * from the whole domain). + * + * Example: For batched_interpolation_domain_type = DiscreteDomain and a dimension of interest Y, this is DiscreteDomain */ using batch_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain and a dimension of interest Y (associated to a B-splines tag BSplinesY), this is DiscreteDomain */ using batched_spline_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain and a dimension of interest Y (associated to a B-splines tag BSplinesY), this is DiscreteDomain */ using batched_spline_tr_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain and a dimension of interest Y, this is DiscreteDomain,Z> */ using batched_derivs_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain Date: Tue, 30 Apr 2024 13:49:13 +0200 Subject: [PATCH 75/89] Emily's review --- include/ddc/kernels/splines/spline_builder.hpp | 6 ++++-- include/ddc/kernels/splines/spline_builder_2d.hpp | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index 9d4e1dfd1..0b4bc476f 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -119,7 +119,8 @@ class SplineBuilder * @brief The type of the whole spline domain (cartesian product of 1D spline domain * and batch domain) preserving the underlying memory layout (order of dimensions). * - * Example: For batched_interpolation_domain_type = DiscreteDomain and a dimension of interest Y (associated to a B-splines tag BSplinesY), this is DiscreteDomain + * Example: For batched_interpolation_domain_type = DiscreteDomain and a dimension of interest Y + * (associated to a B-splines tag BSplinesY), this is DiscreteDomain. */ using batched_spline_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain and a dimension of interest Y (associated to a B-splines tag BSplinesY), this is DiscreteDomain + * Example: For batched_interpolation_domain_type = DiscreteDomain and a dimension of interest Y + * (associated to a B-splines tag BSplinesY), this is DiscreteDomain. */ using batched_spline_tr_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain and dimensions of interest X and Y, + * this is DiscreteDomain. */ using batch_domain_type = ddc::detail::convert_type_seq_to_discrete_domain and dimensions of interest X and Y + * (associated to B-splines tags BSplinesX and BSplinesY), this is DiscreteDomain */ using batched_spline_domain_type = ddc::detail::convert_type_seq_to_discrete_domain and dimensions of interest X and Y, + * this is DiscreteDomain, Y, Z>. */ using batched_derivs_domain_type1 = typename builder_type1::batched_derivs_domain_type; @@ -143,6 +152,9 @@ class SplineBuilder2D * @brief The type of the whole Derivs domain (cartesian product of the 1D Deriv domain * and the associated batch domain) in the second dimension, preserving the underlying * memory layout (order of dimensions). + * + * Example: For batched_interpolation_domain_type = DiscreteDomain and dimensions of interest X and Y, + * this is DiscreteDomain, Z>. */ using batched_derivs_domain_type2 = ddc::detail::convert_type_seq_to_discrete_domain and dimensions of interest X and Y, + * this is DiscreteDomain, Deriv, Z>. */ using batched_derivs_domain_type = ddc::detail::convert_type_seq_to_discrete_domain Date: Tue, 30 Apr 2024 13:52:03 +0200 Subject: [PATCH 76/89] minor --- include/ddc/kernels/splines/spline_builder.hpp | 4 ++++ include/ddc/kernels/splines/spline_builder_2d.hpp | 13 +++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index 0b4bc476f..ac4347a13 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -190,8 +190,12 @@ class SplineBuilder * @param cols_per_chunk A hyperparameter used by the slicer (internal to the solver) to define the size * of a chunk of right-and-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. * @param preconditionner_max_block_size A hyperparameter 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. * * @see MatrixSparse */ diff --git a/include/ddc/kernels/splines/spline_builder_2d.hpp b/include/ddc/kernels/splines/spline_builder_2d.hpp index 912f23860..02bb89a88 100644 --- a/include/ddc/kernels/splines/spline_builder_2d.hpp +++ b/include/ddc/kernels/splines/spline_builder_2d.hpp @@ -186,10 +186,15 @@ class SplineBuilder2D * @brief Create a new SplineBuilder2D. * * @param batched_interpolation_domain The domain on which the interpolation points are defined. - * @param cols_per_chunk A hyperparameter used by the slicer (internal to the solver) to define - * the size of a chunk of right-and-sides of the linear problem to be computed in parallel. - * @param preconditionner_max_block_size A hyperparameter used by the slicer (internal to the solver) - * to define the size of a block used by the Block-Jacobi preconditioner. + * @param cols_per_chunk A hyperparameter used by the slicer (internal to the solver) to define the size + * of a chunk of right-and-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. + * @param preconditionner_max_block_size A hyperparameter 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. * * @see MatrixSparse */ From 127a22be35b15ba79474c2fb6d11b8007d63eb02 Mon Sep 17 00:00:00 2001 From: blegouix Date: Tue, 30 Apr 2024 13:57:11 +0200 Subject: [PATCH 77/89] ident --- .../ddc/kernels/splines/spline_builder.hpp | 34 +++++++++--------- .../ddc/kernels/splines/spline_builder_2d.hpp | 36 +++++++++---------- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index ac4347a13..3943908b2 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -116,12 +116,12 @@ class SplineBuilder ddc::detail::TypeSeq>>; /** - * @brief The type of the whole spline domain (cartesian product of 1D spline domain - * and batch domain) preserving the underlying memory layout (order of dimensions). - * - * Example: For batched_interpolation_domain_type = DiscreteDomain and a dimension of interest Y - * (associated to a B-splines tag BSplinesY), this is DiscreteDomain. - */ + * @brief The type of the whole spline domain (cartesian product of 1D spline domain + * and batch domain) preserving the underlying memory layout (order of dimensions). + * + * Example: For batched_interpolation_domain_type = DiscreteDomain and a dimension of interest Y + * (associated to a B-splines tag BSplinesY), this is DiscreteDomain. + */ using batched_spline_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, @@ -129,12 +129,12 @@ class SplineBuilder ddc::detail::TypeSeq>>; /** - * @brief The type of the whole spline domain (cartesian product of the 1D spline domain - * and the batch domain) with 1D spline dimension being the leading dimension. - * - * Example: For batched_interpolation_domain_type = DiscreteDomain and a dimension of interest Y - * (associated to a B-splines tag BSplinesY), this is DiscreteDomain. - */ + * @brief The type of the whole spline domain (cartesian product of the 1D spline domain + * and the batch domain) with 1D spline dimension being the leading dimension. + * + * Example: For batched_interpolation_domain_type = DiscreteDomain and a dimension of interest Y + * (associated to a B-splines tag BSplinesY), this is DiscreteDomain. + */ using batched_spline_tr_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, @@ -143,11 +143,11 @@ class SplineBuilder ddc::detail::TypeSeq>>>; /** - * @brief The type of the whole Deriv domain (cartesian product of 1D Deriv domain - * and batch domain) preserving the underlying memory layout (order of dimensions). - * - * Example: For batched_interpolation_domain_type = DiscreteDomain and a dimension of interest Y, this is DiscreteDomain,Z> - */ + * @brief The type of the whole Deriv domain (cartesian product of 1D Deriv domain + * and batch domain) preserving the underlying memory layout (order of dimensions). + * + * Example: For batched_interpolation_domain_type = DiscreteDomain and a dimension of interest Y, this is DiscreteDomain,Z> + */ using batched_derivs_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, diff --git a/include/ddc/kernels/splines/spline_builder_2d.hpp b/include/ddc/kernels/splines/spline_builder_2d.hpp index 02bb89a88..823be2777 100644 --- a/include/ddc/kernels/splines/spline_builder_2d.hpp +++ b/include/ddc/kernels/splines/spline_builder_2d.hpp @@ -114,12 +114,12 @@ class SplineBuilder2D using batched_interpolation_domain_type = ddc::DiscreteDomain; /** - * @brief The type of the batch domain (obtained by removing the dimensions of interest - * from the whole domain). - * - * Example: For batched_interpolation_domain_type = DiscreteDomain and dimensions of interest X and Y, - * this is DiscreteDomain. - */ + * @brief The type of the batch domain (obtained by removing the dimensions of interest + * from the whole domain). + * + * Example: For batched_interpolation_domain_type = DiscreteDomain and dimensions of interest X and Y, + * this is DiscreteDomain. + */ using batch_domain_type = ddc::detail::convert_type_seq_to_discrete_domain, @@ -128,9 +128,9 @@ class SplineBuilder2D /** * @brief The type of the whole spline domain (cartesian product of 2D spline domain * and batch domain) preserving the underlying memory layout (order of dimensions). - * - * Example: For batched_interpolation_domain_type = DiscreteDomain and dimensions of interest X and Y - * (associated to B-splines tags BSplinesX and BSplinesY), this is DiscreteDomain + * + * Example: For batched_interpolation_domain_type = DiscreteDomain and dimensions of interest X and Y + * (associated to B-splines tags BSplinesX and BSplinesY), this is DiscreteDomain */ using batched_spline_domain_type = ddc::detail::convert_type_seq_to_discrete_domain and dimensions of interest X and Y, - * this is DiscreteDomain, Y, Z>. + * + * Example: For batched_interpolation_domain_type = DiscreteDomain and dimensions of interest X and Y, + * this is DiscreteDomain, Y, Z>. */ using batched_derivs_domain_type1 = typename builder_type1::batched_derivs_domain_type; @@ -152,9 +152,9 @@ class SplineBuilder2D * @brief The type of the whole Derivs domain (cartesian product of the 1D Deriv domain * and the associated batch domain) in the second dimension, preserving the underlying * memory layout (order of dimensions). - * - * Example: For batched_interpolation_domain_type = DiscreteDomain and dimensions of interest X and Y, - * this is DiscreteDomain, Z>. + * + * Example: For batched_interpolation_domain_type = DiscreteDomain and dimensions of interest X and Y, + * this is DiscreteDomain, Z>. */ using batched_derivs_domain_type2 = ddc::detail::convert_type_seq_to_discrete_domain and dimensions of interest X and Y, - * this is DiscreteDomain, Deriv, Z>. + * + * Example: For batched_interpolation_domain_type = DiscreteDomain and dimensions of interest X and Y, + * this is DiscreteDomain, Deriv, Z>. */ using batched_derivs_domain_type = ddc::detail::convert_type_seq_to_discrete_domain Date: Tue, 30 Apr 2024 13:59:39 +0200 Subject: [PATCH 78/89] ident --- include/ddc/kernels/splines/spline_builder.hpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index 3943908b2..28ee23f1c 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -188,14 +188,14 @@ class SplineBuilder * * @param batched_interpolation_domain The domain on which the interpolation points are defined. * @param cols_per_chunk A hyperparameter used by the slicer (internal to the solver) to define the size - * of a chunk of right-and-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. + * of a chunk of right-and-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. * @param preconditionner_max_block_size A hyperparameter 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. + * 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. * * @see MatrixSparse */ From d734870731cea555600f89f558c8fb19d0ec5e37 Mon Sep 17 00:00:00 2001 From: blegouix Date: Tue, 30 Apr 2024 14:51:57 +0200 Subject: [PATCH 79/89] minor --- include/ddc/kernels/splines/spline_builder.hpp | 2 +- include/ddc/kernels/splines/spline_builder_2d.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index 28ee23f1c..c05816f5b 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -188,7 +188,7 @@ class SplineBuilder * * @param batched_interpolation_domain The domain on which the interpolation points are defined. * @param cols_per_chunk A hyperparameter used by the slicer (internal to the solver) to define the size - * of a chunk of right-and-sides of the linear problem to be computed in parallel (chunks are treated + * 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. diff --git a/include/ddc/kernels/splines/spline_builder_2d.hpp b/include/ddc/kernels/splines/spline_builder_2d.hpp index 823be2777..4ebc0e648 100644 --- a/include/ddc/kernels/splines/spline_builder_2d.hpp +++ b/include/ddc/kernels/splines/spline_builder_2d.hpp @@ -187,7 +187,7 @@ class SplineBuilder2D * * @param batched_interpolation_domain The domain on which the interpolation points are defined. * @param cols_per_chunk A hyperparameter used by the slicer (internal to the solver) to define the size - * of a chunk of right-and-sides of the linear problem to be computed in parallel (chunks are treated + * 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. From 68b639e63ac40339c8a5167062af3cae9ab451a2 Mon Sep 17 00:00:00 2001 From: blegouix Date: Tue, 30 Apr 2024 15:13:23 +0200 Subject: [PATCH 80/89] transform -> approximate --- include/ddc/kernels/splines/spline_builder.hpp | 8 ++++---- .../ddc/kernels/splines/spline_builder_2d.hpp | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index c05816f5b..cfacdc4df 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -53,13 +53,13 @@ constexpr bool is_spline_interpolation_mesh_uniform( * of B-splines. 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. - * @tparam ExecSpace The Kokkos execution space on which the spline transform is performed. + * @tparam ExecSpace The Kokkos execution space on which the spline approximation is performed. * @tparam MemorySpace The Kokkos memory space on which the data (interpolation function and splines coefficients) is stored. * @tparam BSplines The discrete dimension representing the B-splines. * @tparam InterpolationMesh The discrete dimension on which interpolation points are defined. * @tparam BcXmin The lower boundary condition. * @tparam BcXmax The upper boundary condition. - * @tparam Solver The SplineSolver giving the backend used to perform the spline transform. + * @tparam Solver The SplineSolver giving the backend used to perform the spline approximation. * @tparam IDimX A variadic template of all the discrete dimensions forming the full space (InterpolationMesh + batched dimensions). */ template < @@ -300,7 +300,7 @@ class SplineBuilder /** * @brief Get the whole domain on which spline coefficients are defined, preserving memory layout. * - * Spline-transformed functions are computed on this domain. + * Spline approximations (spline-transformed functions) are computed on this domain. * * @return The domain for the spline coefficients. */ @@ -362,7 +362,7 @@ class SplineBuilder * one to print the matrix) or for more complex quadrature schemes. * * Warning: the returned detail::Matrix class is not supposed to be exposed - * to user, which means its usage is not supported out of the scope of DDC spline transforms. + * to user, which means its usage is not supported out of the scope of current class. * Use at your own risk. * * @return A reference to the interpolation matrix. diff --git a/include/ddc/kernels/splines/spline_builder_2d.hpp b/include/ddc/kernels/splines/spline_builder_2d.hpp index 4ebc0e648..a1b77e4c6 100644 --- a/include/ddc/kernels/splines/spline_builder_2d.hpp +++ b/include/ddc/kernels/splines/spline_builder_2d.hpp @@ -38,7 +38,7 @@ class SplineBuilder2D /// @brief The type of the Kokkos memory space used by this class. using memory_space = MemorySpace; - /// @brief The type of the SplineBuilder used by this class to spline-transform along first dimension. + /// @brief The type of the SplineBuilder used by this class to spline-approximate along first dimension. using builder_type1 = ddc::SplineBuilder< ExecSpace, MemorySpace, @@ -49,7 +49,7 @@ class SplineBuilder2D Solver, IDimX...>; - /// @brief The type of the SplineBuilder used by this class to spline-transform along second dimension. + /// @brief The type of the SplineBuilder used by this class to spline-approximate along second dimension. using builder_type2 = ddc::SplineBuilder< ExecSpace, MemorySpace, @@ -60,7 +60,7 @@ class SplineBuilder2D Solver, std::conditional_t, BSpline1, IDimX>...>; - /// @brief The type of the SplineBuilder used by this class to spline-transform the second-dimension-derivatives along first dimension. + /// @brief The type of the SplineBuilder used by this class to spline-approximate the second-dimension-derivatives along first dimension. using builder_deriv_type1 = ddc::SplineBuilder< ExecSpace, MemorySpace, @@ -297,7 +297,7 @@ class SplineBuilder2D /** * @brief Get the whole domain on which spline coefficients are defined, preserving memory layout. * - * Spline-transformed functions are computed on this domain. + * Spline approximations (spline-transformed functions) are computed on this domain. * * @return The domain for the spline coefficients. */ @@ -474,7 +474,7 @@ operator()( memory_space>> const mixed_derivs_max1_max2) const { // TODO: perform computations along dimension 1 on different streams ? - // Spline1-transform derivs_min2 (to spline1_deriv_min) + // Spline1-approximate derivs_min2 (to spline1_deriv_min) ddc::Chunk spline1_deriv_min_alloc( m_spline_builder_deriv1.batched_spline_domain(), ddc::KokkosAllocator()); @@ -490,7 +490,7 @@ operator()( spline1_deriv_min_opt = std::nullopt; } - // Spline1-transform vals (to spline1) + // Spline1-approximate vals (to spline1) ddc::Chunk spline1_alloc( m_spline_builder1.batched_spline_domain(), ddc::KokkosAllocator()); @@ -498,7 +498,7 @@ operator()( m_spline_builder1(spline1, vals, derivs_min1, derivs_max1); - // Spline1-transform derivs_max2 (to spline1_deriv_max) + // Spline1-approximate derivs_max2 (to spline1_deriv_max) ddc::Chunk spline1_deriv_max_alloc( m_spline_builder_deriv1.batched_spline_domain(), ddc::KokkosAllocator()); @@ -514,7 +514,7 @@ operator()( spline1_deriv_max_opt = std::nullopt; } - // Spline2-transform spline1 + // Spline2-approximate spline1 m_spline_builder2(spline, spline1.span_cview(), spline1_deriv_min_opt, spline1_deriv_max_opt); } } // namespace ddc From 095635e1a8e5fe364ad00f71752fadd3419171c8 Mon Sep 17 00:00:00 2001 From: blegouix Date: Fri, 3 May 2024 17:18:09 +0200 Subject: [PATCH 81/89] Emily's review --- .../ddc/kernels/splines/spline_builder.hpp | 10 ++++--- .../ddc/kernels/splines/spline_builder_2d.hpp | 26 +++++++++---------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index cfacdc4df..9df081cde 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -108,7 +108,8 @@ class SplineBuilder * @brief The type of the batch domain (obtained by removing the dimension of interest * from the whole domain). * - * Example: For batched_interpolation_domain_type = DiscreteDomain and a dimension of interest Y, this is DiscreteDomain + * Example: For batched_interpolation_domain_type = DiscreteDomain and a dimension of interest Y, + * this is DiscreteDomain */ using batch_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain and a dimension of interest Y, this is DiscreteDomain,Z> + * Example: For batched_interpolation_domain_type = DiscreteDomain and a dimension of interest Y, + * this is DiscreteDomain,Z> */ using batched_derivs_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain; @@ -186,15 +186,15 @@ class SplineBuilder2D * @brief Create a new SplineBuilder2D. * * @param batched_interpolation_domain The domain on which the interpolation points are defined. - * @param cols_per_chunk A hyperparameter 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. + * @param cols_per_chunk A hyperparameter 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. * @param preconditionner_max_block_size A hyperparameter 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. + * 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. * * @see MatrixSparse */ @@ -316,8 +316,8 @@ class SplineBuilder2D * Use the values of a function (defined on * SplineBuilder2D::batched_interpolation_domain) and the derivatives of the * function at the boundaries (in the case of BoundCond::HERMITE only) - * to calculate a 2D spline approximation of this function. - * + * to calculate a 2D spline approximation of this function. + * * The spline approximation is stored as a ChunkSpan of coefficients * associated with B-splines. * From dc4d3f6f0a5de68b1982735e6830ef0bbf34ce2e Mon Sep 17 00:00:00 2001 From: Baptiste Legouix Date: Fri, 3 May 2024 17:18:36 +0200 Subject: [PATCH 82/89] Update include/ddc/kernels/splines/spline_builder.hpp Co-authored-by: EmilyBourne --- include/ddc/kernels/splines/spline_builder.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index 9df081cde..cc30765cf 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -189,14 +189,14 @@ class SplineBuilder * @brief Build a SplineBuilder acting on batched_interpolation_domain. * * @param batched_interpolation_domain The domain on which the interpolation points are defined. + * * @param cols_per_chunk A hyperparameter 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. + * * @param preconditionner_max_block_size A hyperparameter 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. * * @see MatrixSparse From 927343200e51f427b57fa59524d22071268b016f Mon Sep 17 00:00:00 2001 From: blegouix Date: Mon, 6 May 2024 08:55:16 +0200 Subject: [PATCH 83/89] Emily's review --- include/ddc/kernels/splines/spline_builder.hpp | 10 +++++----- include/ddc/kernels/splines/spline_builder_2d.hpp | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index cc30765cf..b47ae5d1f 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -105,12 +105,12 @@ class SplineBuilder using batched_interpolation_domain_type = ddc::DiscreteDomain; /** - * @brief The type of the batch domain (obtained by removing the dimension of interest - * from the whole domain). - * - * Example: For batched_interpolation_domain_type = DiscreteDomain and a dimension of interest Y, + * @brief The type of the batch domain (obtained by removing the dimension of interest + * from the whole domain). + * + * Example: For batched_interpolation_domain_type = DiscreteDomain and a dimension of interest Y, * this is DiscreteDomain - */ + */ using batch_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, diff --git a/include/ddc/kernels/splines/spline_builder_2d.hpp b/include/ddc/kernels/splines/spline_builder_2d.hpp index ba8666803..a40e38266 100644 --- a/include/ddc/kernels/splines/spline_builder_2d.hpp +++ b/include/ddc/kernels/splines/spline_builder_2d.hpp @@ -183,17 +183,17 @@ class SplineBuilder2D public: /** - * @brief Create a new SplineBuilder2D. - * + * @brief Build a SplineBuilder2D acting on batched_interpolation_domain. + * * @param batched_interpolation_domain The domain on which the interpolation points are defined. + * * @param cols_per_chunk A hyperparameter 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. + * * @param preconditionner_max_block_size A hyperparameter 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. * * @see MatrixSparse From 0ddd898cc695ba6f5c75a392b5c4b4fe7d79e88f Mon Sep 17 00:00:00 2001 From: blegouix Date: Mon, 6 May 2024 09:02:51 +0200 Subject: [PATCH 84/89] minor --- include/ddc/kernels/splines/spline_builder_2d.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ddc/kernels/splines/spline_builder_2d.hpp b/include/ddc/kernels/splines/spline_builder_2d.hpp index a40e38266..a6aaf571f 100644 --- a/include/ddc/kernels/splines/spline_builder_2d.hpp +++ b/include/ddc/kernels/splines/spline_builder_2d.hpp @@ -183,7 +183,7 @@ class SplineBuilder2D public: /** - * @brief Build a SplineBuilder2D acting on batched_interpolation_domain. + * @brief Build a SplineBuilder2D acting on batched_interpolation_domain. * * @param batched_interpolation_domain The domain on which the interpolation points are defined. * From eef77b965b68896c80b6cb687450ae0bfb248638 Mon Sep 17 00:00:00 2001 From: blegouix Date: Tue, 14 May 2024 18:27:34 +0200 Subject: [PATCH 85/89] hyperparameter -> parameter --- include/ddc/kernels/splines/spline_builder.hpp | 4 ++-- include/ddc/kernels/splines/spline_builder_2d.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index b47ae5d1f..04d93497b 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -190,12 +190,12 @@ class SplineBuilder * * @param batched_interpolation_domain The domain on which the interpolation points are defined. * - * @param cols_per_chunk A hyperparameter used by the slicer (internal to the solver) to define the size + * @param 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. * - * @param preconditionner_max_block_size A hyperparameter used by the slicer (internal to the solver) to + * @param preconditionner_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. * diff --git a/include/ddc/kernels/splines/spline_builder_2d.hpp b/include/ddc/kernels/splines/spline_builder_2d.hpp index a6aaf571f..6eb4f38b8 100644 --- a/include/ddc/kernels/splines/spline_builder_2d.hpp +++ b/include/ddc/kernels/splines/spline_builder_2d.hpp @@ -187,12 +187,12 @@ class SplineBuilder2D * * @param batched_interpolation_domain The domain on which the interpolation points are defined. * - * @param cols_per_chunk A hyperparameter used by the slicer (internal to the solver) to define the size + * @param 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. * - * @param preconditionner_max_block_size A hyperparameter used by the slicer (internal to the solver) to + * @param preconditionner_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. * From 932620e9c93df2773c69f0cf7f9d320267023c99 Mon Sep 17 00:00:00 2001 From: Baptiste Legouix Date: Mon, 27 May 2024 11:17:23 +0200 Subject: [PATCH 86/89] Apply suggestions from code review Co-authored-by: Thomas Padioleau --- include/ddc/kernels/splines/spline_builder.hpp | 5 ++--- include/ddc/kernels/splines/spline_builder_2d.hpp | 15 ++++++--------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index bacf17e48..1bd618f5d 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -15,8 +15,7 @@ namespace ddc { /** * @brief An enum determining the backend solver of a SplineBuilder or SplineBuilder2d. * - * An enum determining the backend solver of a SplineBuilder or SplineBuilder2d. Only GINKGO is available at the moment, - * other solvers will be implemented in the future. + * An enum determining the backend solver of a SplineBuilder or SplineBuilder2d. */ enum class SplineSolver { GINKGO ///< Enum member to identify the Ginkgo-based solver (iterative method) @@ -192,7 +191,7 @@ class SplineBuilder * @param batched_interpolation_domain The domain on which the interpolation points are defined. * * @param 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 + * 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. * diff --git a/include/ddc/kernels/splines/spline_builder_2d.hpp b/include/ddc/kernels/splines/spline_builder_2d.hpp index d9b041cc7..7b635675b 100644 --- a/include/ddc/kernels/splines/spline_builder_2d.hpp +++ b/include/ddc/kernels/splines/spline_builder_2d.hpp @@ -127,7 +127,7 @@ class SplineBuilder2D /** * @brief The type of the whole spline domain (cartesian product of 2D spline domain - * and batch domain) preserving the underlying memory layout (order of dimensions). + * and batch domain) preserving the order of dimensions. * * Example: For batched_interpolation_domain_type = DiscreteDomain and dimensions of interest X and Y * (associated to B-splines tags BSplinesX and BSplinesY), this is DiscreteDomain @@ -140,8 +140,7 @@ class SplineBuilder2D /** * @brief The type of the whole Derivs domain (cartesian product of the 1D Deriv domain - * and the associated batch domain) in the first dimension, preserving the underlying - * memory layout (order of dimensions). + * and the associated batch domain) in the first dimension, preserving the order of dimensions. * * Example: For batched_interpolation_domain_type = DiscreteDomain and dimensions of interest X and Y, * this is DiscreteDomain, Y, Z>. @@ -150,8 +149,7 @@ class SplineBuilder2D /** * @brief The type of the whole Derivs domain (cartesian product of the 1D Deriv domain - * and the associated batch domain) in the second dimension, preserving the underlying - * memory layout (order of dimensions). + * and the associated batch domain) in the second dimension, preserving the order of dimensions. * * Example: For batched_interpolation_domain_type = DiscreteDomain and dimensions of interest X and Y, * this is DiscreteDomain, Z>. @@ -164,8 +162,7 @@ class SplineBuilder2D /** * @brief The type of the whole Derivs domain (cartesian product of the 2D Deriv domain - * and the batch domain) in the second dimension, preserving the underlying - * memory layout (order of dimensions). + * and the batch domain) in the second dimension, preserving the order of dimensions. * * Example: For batched_interpolation_domain_type = DiscreteDomain and dimensions of interest X and Y, * this is DiscreteDomain, Deriv, Z>. @@ -196,7 +193,7 @@ class SplineBuilder2D * 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. * - * @see MatrixSparse + * @see SplinesLinearProblemSparse */ explicit SplineBuilder2D( batched_interpolation_domain_type const& batched_interpolation_domain, @@ -295,7 +292,7 @@ class SplineBuilder2D } /** - * @brief Get the whole domain on which spline coefficients are defined, preserving memory layout. + * @brief Get the whole domain on which spline coefficients are defined. * * Spline approximations (spline-transformed functions) are computed on this domain. * From b3d9c544a1f55391d997a8c9322d7976f369dc43 Mon Sep 17 00:00:00 2001 From: blegouix Date: Mon, 27 May 2024 11:24:30 +0200 Subject: [PATCH 87/89] privatize transposed-domain functions --- include/ddc/kernels/splines/spline_builder.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index 1bd618f5d..4bdfe7583 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -129,6 +129,7 @@ class SplineBuilder ddc::detail::TypeSeq, ddc::detail::TypeSeq>>; +private: /** * @brief The type of the whole spline domain (cartesian product of the 1D spline domain * and the batch domain) with 1D spline dimension being the leading dimension. @@ -143,6 +144,7 @@ class SplineBuilder ddc::detail::TypeSeq, ddc::detail::TypeSeq>>>; +public: /** * @brief The type of the whole Deriv domain (cartesian product of 1D Deriv domain * and batch domain) preserving the underlying memory layout (order of dimensions). @@ -313,6 +315,7 @@ class SplineBuilder bsplines_type>(batched_interpolation_domain(), spline_domain()); } +private: /** * @brief Get the whole domain on which spline coefficients are defined, with the dimension of interest being the leading dimension. * @@ -325,6 +328,7 @@ class SplineBuilder return batched_spline_tr_domain_type(spline_domain(), batch_domain()); } +public: /** * @brief Get the whole domain on which derivatives on lower boundary are defined. * From bc8ce54720d29fe55b6513ef4933554e8204a6be Mon Sep 17 00:00:00 2001 From: Baptiste Legouix Date: Mon, 27 May 2024 11:27:07 +0200 Subject: [PATCH 88/89] Update include/ddc/kernels/splines/spline_builder.hpp Co-authored-by: Thomas Padioleau --- include/ddc/kernels/splines/spline_builder.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index 4bdfe7583..001c49069 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -302,7 +302,7 @@ class SplineBuilder } /** - * @brief Get the whole domain on which spline coefficients are defined, preserving memory layout. + * @brief Get the whole domain on which spline coefficients are defined. * * Spline approximations (spline-transformed functions) are computed on this domain. * From bf1d5862e1cf202b7a522c9b1dd41c907b8470c0 Mon Sep 17 00:00:00 2001 From: Thomas Padioleau Date: Fri, 7 Jun 2024 09:37:21 +0200 Subject: [PATCH 89/89] Apply suggestions from code review --- include/ddc/kernels/splines/spline_builder.hpp | 2 +- include/ddc/kernels/splines/spline_builder_2d.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/ddc/kernels/splines/spline_builder.hpp b/include/ddc/kernels/splines/spline_builder.hpp index 4fac848af..7d79a5520 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -248,7 +248,7 @@ class SplineBuilder /** @brief Move-assigns * * @param x An rvalue to another SplineBuilder. - * @return A reference to the moved SplineBuilder + * @return A reference to this object. */ SplineBuilder& operator=(SplineBuilder&& x) = default; diff --git a/include/ddc/kernels/splines/spline_builder_2d.hpp b/include/ddc/kernels/splines/spline_builder_2d.hpp index 7b635675b..342d9340d 100644 --- a/include/ddc/kernels/splines/spline_builder_2d.hpp +++ b/include/ddc/kernels/splines/spline_builder_2d.hpp @@ -234,7 +234,7 @@ class SplineBuilder2D /** @brief Move-assigns * * @param x An rvalue to another SplineBuilder. - * @return A reference to the moved SplineBuilder + * @return A reference to this object. */ SplineBuilder2D& operator=(SplineBuilder2D&& x) = default;