24template <KokkosViewRank<2> SourceType, KokkosViewRank<1> TargetType,
26static inline void FillPoints(
const SourceType &sourceView,
27 TargetType &targetView) {
28 assert(Dim == sourceView.extent(1));
29 using ExecSpace =
typename SourceType::execution_space;
30 const auto K = sourceView.extent(0);
33 Kokkos::RangePolicy<ExecSpace>(ExecSpace{}, 0, K),
34 KOKKOS_LAMBDA(
const std::size_t k) {
35 ::ArborX::Point<Dim, coordinates_t> point{};
36 for (
int_t axis = 0; axis < Dim; ++axis) {
37 point[axis] = sourceView(k, axis);
39 targetView(k) = point;
49PACMAN_MLS_FULL_TEMPLATE
50PACMAN_MLS_CLASSNAME::MLSInterpolator(Transfer<ExecSpace, Dim> &rTransfer) {
51 const std::string _region_name =
"MLSInterpolator::MLSInterpolator";
52 Kokkos::Profiling::ScopedRegion region(_region_name);
54 const ExecSpace execspace{};
55 using Point = ::ArborX::Point<Dim, coordinates_t>;
56 using MemSpace =
typename ExecSpace::memory_space;
59 static_cast<int_t>(rTransfer.targetPoints.extent(0));
61 auto tgtPoints = Kokkos::View<Point *, MemSpace>(
62 Kokkos::view_alloc(execspace, Kokkos::WithoutInitializing,
63 "MLSInterpolator::tgtPoints"),
65 FillPoints<
decltype(rTransfer.targetPoints),
decltype(tgtPoints), Dim>(
66 rTransfer.targetPoints, tgtPoints);
70 this->out = rTransfer.targetValues;
73 ::ArborX::Interpolation::MovingLeastSquares<MemSpace> MLS(
74 execspace, rTransfer.sourcePoints, tgtPoints);
76 component < rTransfer.sourceValues.extent(1); ++component) {
78 Kokkos::subview(rTransfer.sourceValues, Kokkos::ALL(), component);
79 auto target_values = Kokkos::subview(this->out, Kokkos::ALL(), component);
80 MLS.interpolate(execspace, source_values, target_values);
static void FillPoints(const SourceType &sourceView, TargetType &targetView)
Convert a 2-D [N × Dim] coordinate view into a 1-D view of ArborX::Point<Dim, coordinates_t>.