Skip to content

Commit

Permalink
Deriving MemorySpace from source points
Browse files Browse the repository at this point in the history
  • Loading branch information
mrlag31 committed Dec 27, 2023
1 parent fcaefb0 commit c38f97f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/interpolation/ArborX_InterpMovingLeastSquares.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ class MovingLeastSquares
auto const source_view = getSourceView(space, source_points);

// Compute the moving least squares coefficients
_coeffs = Details::movingLeastSquaresCoefficients<
CRBFunc, PolynomialDegree, FloatingCalculationType, MemorySpace>(
_coeffs = Details::movingLeastSquaresCoefficients<CRBFunc, PolynomialDegree,
FloatingCalculationType>(
space, source_view, target_points);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ namespace ArborX::Interpolation::Details
{

template <typename CRBFunc, typename PolynomialDegree,
typename CoefficientsType, typename MemorySpace,
typename ExecutionSpace, typename SourcePoints, typename TargetPoints>
Kokkos::View<CoefficientsType **, MemorySpace>
typename CoefficientsType, typename ExecutionSpace,
typename SourcePoints, typename TargetPoints>
Kokkos::View<CoefficientsType **, typename SourcePoints::memory_space>
movingLeastSquaresCoefficients(ExecutionSpace const &space,
SourcePoints const &source_points,
TargetPoints const &target_points)
Expand All @@ -39,6 +39,7 @@ movingLeastSquaresCoefficients(ExecutionSpace const &space,

namespace KokkosExt = ::ArborX::Details::KokkosExt;

using MemorySpace = typename SourcePoints::memory_space;
static_assert(
KokkosExt::is_accessible_from<MemorySpace, ExecutionSpace>::value,
"Memory space must be accessible from the execution space");
Expand Down
12 changes: 4 additions & 8 deletions test/tstInterpDetailsMLSCoefficients.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(mls_coefficients, DeviceType, ARBORX_DEVICE_TYPES)
});
auto coeffs0 = ArborX::Interpolation::Details::movingLeastSquaresCoefficients<
ArborX::Interpolation::CRBF::Wendland<0>,
ArborX::Interpolation::PolynomialDegree<1>, double, MemorySpace>(
space, srcp0, tgtp0);
ArborX::Interpolation::PolynomialDegree<1>, double>(space, srcp0, tgtp0);
auto eval0 = interpolate(space, srcv0, coeffs0);
ARBORX_MDVIEW_TEST_TOL(eval0, tgtv0, Kokkos::Experimental::epsilon_v<float>);

Expand Down Expand Up @@ -117,8 +116,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(mls_coefficients, DeviceType, ARBORX_DEVICE_TYPES)
});
auto coeffs1 = ArborX::Interpolation::Details::movingLeastSquaresCoefficients<
ArborX::Interpolation::CRBF::Wendland<2>,
ArborX::Interpolation::PolynomialDegree<2>, double, MemorySpace>(
space, srcp1, tgtp1);
ArborX::Interpolation::PolynomialDegree<2>, double>(space, srcp1, tgtp1);
auto eval1 = interpolate(space, srcv1, coeffs1);
ARBORX_MDVIEW_TEST_TOL(eval1, tgtv1, Kokkos::Experimental::epsilon_v<float>);
}
Expand Down Expand Up @@ -152,8 +150,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(mls_coefficients_edge_cases, DeviceType,
});
auto coeffs0 = ArborX::Interpolation::Details::movingLeastSquaresCoefficients<
ArborX::Interpolation::CRBF::Wendland<0>,
ArborX::Interpolation::PolynomialDegree<1>, double, MemorySpace>(
space, srcp0, tgtp0);
ArborX::Interpolation::PolynomialDegree<1>, double>(space, srcp0, tgtp0);
auto eval0 = interpolate(space, srcv0, coeffs0);
ARBORX_MDVIEW_TEST_TOL(eval0, tgtv0, Kokkos::Experimental::epsilon_v<float>);

Expand Down Expand Up @@ -189,8 +186,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(mls_coefficients_edge_cases, DeviceType,
});
auto coeffs1 = ArborX::Interpolation::Details::movingLeastSquaresCoefficients<
ArborX::Interpolation::CRBF::Wendland<2>,
ArborX::Interpolation::PolynomialDegree<2>, double, MemorySpace>(
space, srcp1, tgtp1);
ArborX::Interpolation::PolynomialDegree<2>, double>(space, srcp1, tgtp1);
auto eval1 = interpolate(space, srcv1, coeffs1);
ARBORX_MDVIEW_TEST_TOL(eval1, tgtv1, Kokkos::Experimental::epsilon_v<float>);
}

0 comments on commit c38f97f

Please sign in to comment.