diff --git a/benchmarks/splines.cpp b/benchmarks/splines.cpp index e73d68489..18b61a10b 100644 --- a/benchmarks/splines.cpp +++ b/benchmarks/splines.cpp @@ -132,11 +132,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>()); diff --git a/examples/characteristics_advection.cpp b/examples/characteristics_advection.cpp index 98fd86d77..77ad725fc 100644 --- a/examples/characteristics_advection.cpp +++ b/examples/characteristics_advection.cpp @@ -239,13 +239,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 eed9dfeea..6d47dec57 100644 --- a/include/ddc/kernels/splines/spline_builder.hpp +++ b/include/ddc/kernels/splines/spline_builder.hpp @@ -78,27 +78,27 @@ 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, ddc::detail::TypeSeq>>; - using spline_domain_type = + 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 = + 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, @@ -148,7 +148,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; @@ -161,10 +161,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()) @@ -208,9 +208,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; } /** @@ -223,15 +223,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 { return ddc::discrete_space().full_domain(); } @@ -244,31 +244,31 @@ class SplineBuilder * * @return The domain for the splines. */ - 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 + 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 + 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 + 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))); @@ -305,15 +305,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: @@ -634,12 +639,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); @@ -714,7 +725,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..eebaf1f98 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_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_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 d422d5678..c4dbe858f 100644 --- a/include/ddc/kernels/splines/spline_evaluator.hpp +++ b/include/ddc/kernels/splines/spline_evaluator.hpp @@ -49,16 +49,16 @@ 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 spline_domain_type = ddc::DiscreteDomain; using batch_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq>>; - using spline_domain_type = + using batched_spline_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, @@ -87,7 +87,7 @@ class SplineEvaluator ddc::Coordinate, ddc::ChunkSpan< double const, - bsplines_domain_type, + spline_domain_type, std::experimental::layout_right, memory_space>>, "LeftExtrapolationRule::operator() has to be callable with usual arguments."); @@ -98,7 +98,7 @@ class SplineEvaluator ddc::Coordinate, ddc::ChunkSpan< double const, - bsplines_domain_type, + spline_domain_type, std::experimental::layout_right, memory_space>>, "RightExtrapolationRule::operator() has to be callable with usual arguments."); @@ -134,7 +134,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); @@ -142,13 +142,14 @@ 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 + ddc::ChunkSpan const spline_coef) const { interpolation_domain_type const interpolation_domain(spline_eval.domain()); @@ -170,7 +171,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); @@ -178,13 +179,14 @@ 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 + ddc::ChunkSpan const spline_coef) const { interpolation_domain_type const interpolation_domain(spline_eval.domain()); @@ -207,7 +209,7 @@ class SplineEvaluator template void integrate( ddc::ChunkSpan const integrals, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { batch_domain_type const batch_domain(integrals.domain()); @@ -224,7 +226,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 spline_domain_type::discrete_element_type const i : values.domain()) { integrals(j) += spline_coef(i, j) * values(i); } @@ -235,7 +237,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 @@ -265,7 +267,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 a8bb9b011..1381ebb39 100644 --- a/include/ddc/kernels/splines/spline_evaluator_2d.hpp +++ b/include/ddc/kernels/splines/spline_evaluator_2d.hpp @@ -66,18 +66,18 @@ 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 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, ddc::detail::TypeSeq>>; - using spline_domain_type = + using batched_spline_domain_type = typename ddc::detail::convert_type_seq_to_discrete_domain, ddc::detail::TypeSeq, @@ -118,7 +118,7 @@ class SplineEvaluator2D ddc::Coordinate, ddc::ChunkSpan< double const, - bsplines_domain_type, + spline_domain_type, std::experimental::layout_right, memory_space>>, "LeftExtrapolationRule1::operator() has to be callable " @@ -130,7 +130,7 @@ class SplineEvaluator2D ddc::Coordinate, ddc::ChunkSpan< double const, - bsplines_domain_type, + spline_domain_type, std::experimental::layout_right, memory_space>>, "RightExtrapolationRule1::operator() has to be callable " @@ -142,7 +142,7 @@ class SplineEvaluator2D ddc::Coordinate, ddc::ChunkSpan< double const, - bsplines_domain_type, + spline_domain_type, std::experimental::layout_right, memory_space>>, "LeftExtrapolationRule2::operator() has to be callable " @@ -154,7 +154,7 @@ class SplineEvaluator2D ddc::Coordinate, ddc::ChunkSpan< double const, - bsplines_domain_type, + spline_domain_type, std::experimental::layout_right, memory_space>>, "RightExtrapolationRule2::operator() has to be callable " @@ -265,7 +265,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); @@ -273,13 +273,14 @@ 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 + ddc::ChunkSpan const spline_coef) const { batch_domain_type batch_domain(coords_eval.domain()); @@ -313,7 +314,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); @@ -332,7 +333,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); @@ -351,7 +352,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); @@ -360,7 +361,7 @@ class SplineEvaluator2D template KOKKOS_FUNCTION double deriv( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { static_assert( @@ -383,7 +384,7 @@ class SplineEvaluator2D template KOKKOS_FUNCTION double deriv2( ddc::Coordinate const& coord_eval, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { static_assert( @@ -410,13 +411,14 @@ 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 + ddc::ChunkSpan const spline_coef) const { batch_domain_type batch_domain(coords_eval.domain()); @@ -451,13 +453,14 @@ 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 + ddc::ChunkSpan const spline_coef) const { batch_domain_type batch_domain(coords_eval.domain()); @@ -492,13 +495,14 @@ 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 + ddc::ChunkSpan const spline_coef) const { batch_domain_type batch_domain(coords_eval.domain()); @@ -523,13 +527,14 @@ 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 + ddc::ChunkSpan const spline_coef) const { static_assert( @@ -557,13 +562,14 @@ 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 + ddc::ChunkSpan const spline_coef) const { static_assert( @@ -588,7 +594,7 @@ class SplineEvaluator2D template void integrate( ddc::ChunkSpan const integrals, - ddc::ChunkSpan const + ddc::ChunkSpan const spline_coef) const { batch_domain_type batch_domain(integrals.domain()); @@ -612,9 +618,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 spline_domain_type1::discrete_element_type const i1 : values1.domain()) { - for (typename bsplines_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); } @@ -645,7 +651,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; @@ -714,7 +720,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 680257f04..b0ea9c9f7 100644 --- a/tests/splines/batched_2d_spline_builder.cpp +++ b/tests/splines/batched_2d_spline_builder.cpp @@ -287,7 +287,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 44c4d76ee..a714b3660 100644 --- a/tests/splines/batched_spline_builder.cpp +++ b/tests/splines/batched_spline_builder.cpp @@ -238,7 +238,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 e89b41e00..db7a4b035 100644 --- a/tests/splines/extrapolation_rule.cpp +++ b/tests/splines/extrapolation_rule.cpp @@ -244,7 +244,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 7a04c8431..b21093b0b 100644 --- a/tests/splines/periodicity_spline_builder.cpp +++ b/tests/splines/periodicity_spline_builder.cpp @@ -147,7 +147,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(