PACMAN 0.1.0
Portable Algorithms for Coupling, Mapping, and Adaptive iNterpolation
Loading...
Searching...
No Matches
FTInterpNearest.hpp
Go to the documentation of this file.
1//
2// This file is subject to the terms and conditions defined in
3// file 'LICENSE', which is part of this source code package.
4//
5
6#pragma once
7
8#include "common/transfer.hxx"
11
12namespace PACMAN {
13namespace FiniteElements {
14
27template <typename ExecSpace, int_t Dim>
29 Kokkos::Profiling::pushRegion("FTInterpNearest");
30
31 using MemorySpace = typename ExecSpace::memory_space;
32 using Box = ::ArborX::Box<Dim, coordinates_t>;
33
35
36 auto sourcePointsPtr = transfer.sourcePoints;
37 auto sourceValuesPtr = transfer.sourceValues;
38
39 auto targetPointsPtr = transfer.targetPoints;
40 auto targetValuesPtr = transfer.targetValues;
41 auto targetStatusPtr = transfer.targetStatus;
42 auto nbtargetPoints = targetPointsPtr.extent(0);
43
44 ::ArborX::BoundingVolumeHierarchy bvhPoints(
45 execSpace, ::ArborX::Experimental::attach_indices(sourcePointsPtr));
46 Kokkos::Profiling::pushRegion("Compute nearest points");
47 auto nearestPointValues = Kokkos::View<int_t *, MemorySpace>(
48 Kokkos::view_alloc(execSpace, Kokkos::WithoutInitializing,
49 "nearestPointValues"),
50 0);
51 auto nearestPointOffsets = Kokkos::View<int_t *, MemorySpace>(
52 Kokkos::view_alloc(execSpace, Kokkos::WithoutInitializing,
53 "nearestPointOffsets"),
54 0);
58 Kokkos::Profiling::popRegion();
59
60 Kokkos::Profiling::pushRegion("Compute target point FE intersection");
62 Kokkos::Profiling::popRegion();
63
64 // Assign nearest node source value for target points outside the mesh
65 Kokkos::Profiling::pushRegion("Get Nearest");
66 Kokkos::parallel_for(
67 "Get Nearest functor",
68 Kokkos::RangePolicy<ExecSpace>(execSpace, 0, nbtargetPoints),
69 KOKKOS_LAMBDA(const int_t &i) {
74 }
75 });
76 Kokkos::Profiling::popRegion();
77
78 Kokkos::Profiling::popRegion();
79 return;
80}
81} // namespace FiniteElements
82} // namespace PACMAN
ArborX predicate/callback helpers for PACMAN finite-elements kernels.
void FTInterpNearest(Transfer< ExecSpace, Dim > &transfer)
Interpolate target points from FE cells and fallback to nearest source-node value outside the source ...
Generic callback extracting index from ArborX query values.