From c1694aa6c5dc803b585d913eea081b4d7735f442 Mon Sep 17 00:00:00 2001 From: Thomas Padioleau Date: Thu, 9 Jan 2025 18:30:52 +0100 Subject: [PATCH] Align the constructors of the different DiscreteDomain --- include/ddc/discrete_domain.hpp | 7 +++---- tests/splines/batched_2d_spline_builder.cpp | 8 +++----- tests/splines/batched_spline_builder.cpp | 8 +++----- tests/splines/extrapolation_rule.cpp | 8 +++----- 4 files changed, 12 insertions(+), 19 deletions(-) diff --git a/include/ddc/discrete_domain.hpp b/include/ddc/discrete_domain.hpp index dafb17d8c..925e0edac 100644 --- a/include/ddc/discrete_domain.hpp +++ b/include/ddc/discrete_domain.hpp @@ -264,10 +264,9 @@ class DiscreteDomain<> KOKKOS_DEFAULTED_FUNCTION constexpr DiscreteDomain() = default; - // Construct a DiscreteDomain from a reordered copy of `domain` - template - KOKKOS_FUNCTION constexpr explicit DiscreteDomain( - [[maybe_unused]] DiscreteDomain const& domain) + /// Construct a DiscreteDomain by copies and merge of domains + template && ...)>> + KOKKOS_FUNCTION constexpr explicit DiscreteDomain([[maybe_unused]] DDoms const&... domains) { } diff --git a/tests/splines/batched_2d_spline_builder.cpp b/tests/splines/batched_2d_spline_builder.cpp index 9d5e42e10..54c97225a 100644 --- a/tests/splines/batched_2d_spline_builder.cpp +++ b/tests/splines/batched_2d_spline_builder.cpp @@ -186,11 +186,9 @@ void Batched2dSplineTest() = GrevillePoints>::template get_domain(); ddc::DiscreteDomain const interpolation_domain2 = GrevillePoints>::template get_domain(); - // The following line creates a discrete domain over all dimensions (DDims...) where we immediately - // remove the dimensions DDimI1 and DDimI2. - ddc::remove_dims_of_t, DDimI1, DDimI2> const dom_vals_tmp( - ddc::DiscreteDomain( - ddc::DiscreteDomain(DElem(0), DVect(ncells))...)); + // The following line creates a discrete domain over all dimensions (DDims...) except DDimI1 and DDimI2. + auto const dom_vals_tmp = ddc::remove_dims_of_t, DDimI1, DDimI2>( + ddc::DiscreteDomain(DElem(0), DVect(ncells))...); ddc::DiscreteDomain const dom_vals(dom_vals_tmp, interpolation_domain1, interpolation_domain2); diff --git a/tests/splines/batched_spline_builder.cpp b/tests/splines/batched_spline_builder.cpp index 3165c00a7..f0d3b5a2a 100644 --- a/tests/splines/batched_spline_builder.cpp +++ b/tests/splines/batched_spline_builder.cpp @@ -183,11 +183,9 @@ void BatchedSplineTest() // Create the values domain (mesh) ddc::DiscreteDomain const interpolation_domain = GrevillePoints>::template get_domain(); - // The following line creates a discrete domain over all dimensions (DDims...) where we immediately - // remove the dimension DDimI. - ddc::remove_dims_of_t, DDimI> const dom_vals_tmp( - ddc::DiscreteDomain( - ddc::DiscreteDomain(DElem(0), DVect(ncells))...)); + // The following line creates a discrete domain over all dimensions (DDims...) except DDimI. + auto const dom_vals_tmp = ddc::remove_dims_of_t, DDimI>( + ddc::DiscreteDomain(DElem(0), DVect(ncells))...); ddc::DiscreteDomain const dom_vals(dom_vals_tmp, interpolation_domain); #if defined(BC_HERMITE) diff --git a/tests/splines/extrapolation_rule.cpp b/tests/splines/extrapolation_rule.cpp index a91eac67a..86d217664 100644 --- a/tests/splines/extrapolation_rule.cpp +++ b/tests/splines/extrapolation_rule.cpp @@ -174,11 +174,9 @@ void ExtrapolationRuleSplineTest() ddc::DiscreteDomain const interpolation_domain( GrevillePoints1>::template get_domain(), GrevillePoints2>::template get_domain()); - // The following line creates a discrete domain over all dimensions (DDims...) where we immediately - // remove the dimensions DDimI1 and DDimI2. - ddc::remove_dims_of_t, DDimI1, DDimI2> const dom_vals_tmp( - ddc::DiscreteDomain( - ddc::DiscreteDomain(DElem(0), DVect(ncells))...)); + // The following line creates a discrete domain over all dimensions (DDims...) except DDimI1 and DDimI2. + auto const dom_vals_tmp = ddc::remove_dims_of_t, DDimI1, DDimI2>( + ddc::DiscreteDomain(DElem(0), DVect(ncells))...); ddc::DiscreteDomain const dom_vals(dom_vals_tmp, interpolation_domain); // Create a SplineBuilder over BSplines and batched along other dimensions using some boundary conditions