28 const ArborX::Point<2, coordinates_t> &
a,
29 const ArborX::Point<2, coordinates_t> &
b) {
30 const auto ab =
b -
a;
31 const auto ap =
p -
a;
34 auto tclamp = Kokkos::max(0.0, Kokkos::min(1.0,
t));
35 ArborX::Point<2, coordinates_t>
ret = {
a[0] +
ab[0] *
tclamp,
54 Kokkos::Profiling::pushRegion(
"FiniteElements::ComputeProjectionOn3DSkin");
55 using MemorySpace =
typename ExecSpace::memory_space;
56 using Triangle = ArborX::Triangle<3, coordinates_t>;
57 using Point = ArborX::Point<3, coordinates_t>;
67 auto targetPointsPtr = transfer.targetPoints;
75 auto nbTri = transfer.skinFaces.extent_int(0);
77 Kokkos::view_alloc(
execSpace, Kokkos::WithoutInitializing,
78 "Skin ArborX Triangles"),
81 "Fill ArborX triangles",
90 ArborX::BoundingVolumeHierarchy
skinBVH(
92 Kokkos::Profiling::popRegion();
94 Kokkos::Profiling::pushRegion(
"Compute query of nearest skin");
96 Kokkos::View<int_t *, MemorySpace>
values(
"values", 0);
97 Kokkos::View<offset_t *, MemorySpace>
offsets(
"offsets", 0);
100 Kokkos::view_alloc(
execSpace, Kokkos::WithoutInitializing,
104 Kokkos::Profiling::pushRegion(
"Point projection on triangle");
118 Kokkos::Profiling::popRegion();
123 Kokkos::Profiling::pushRegion(
124 "Compute projection and interpolation coefficient");
125 Kokkos::parallel_for(
126 "Compute projection values ",
130 Kokkos::Array<fp_t, MaxNodesPerElt>
warr;
131 Kokkos::Array<coordinates_t, MaxNodesPerElt * 3>
Xarr;
132 Kokkos::Array<coordinates_t, 3>
tpa;
133 Kokkos::View<coordinates_t *, ExecSpace>
tp(
tpa.data(), 3);
146 Kokkos::View<coordinates_t **, ExecSpace>
Xcoor(
Xarr.data(),
150 for (
int_t k = 0; k < 3; ++k) {
163 Kokkos::Profiling::popRegion();
181 Kokkos::Profiling::pushRegion(
"FiniteElements::ComputeProjectionOn2DSkin");
182 using MemorySpace =
typename ExecSpace::memory_space;
183 using Point = ArborX::Point<2, coordinates_t>;
193 auto targetPointsPtr = transfer.targetPoints;
205 Kokkos::view_alloc(
execSpace, Kokkos::WithoutInitializing,
209 Kokkos::Profiling::pushRegion(
210 "Compute projection and interpolation coefficient");
211 Kokkos::parallel_for(
212 "Retrieve closest bar",
213 Kokkos::RangePolicy<ExecSpace>(
execSpace, 0,
214 targetPointsPtr.extent_int(0)),
217 Kokkos::Array<fp_t, MaxNodesPerElt>
warr;
218 Kokkos::Array<coordinates_t, MaxNodesPerElt * 2>
Xarr;
219 Kokkos::Array<coordinates_t, 2>
tpa;
220 Kokkos::View<coordinates_t *, ExecSpace>
tp(
tpa.data(), 2);
221 const Point
target = {targetPointsPtr(
i, 0), targetPointsPtr(
i, 1)};
243 tp(
j) = targetPointsPtr(
i,
j);
254 Kokkos::View<coordinates_t **, ExecSpace>
Xcoor(
Xarr.data(),
258 for (
int_t k = 0; k < 2; ++k) {
262 auto isInside = FiniteElements::ApplyNewtonOnElement<ExecSpace, 2>(
271 Kokkos::Profiling::popRegion();
289 Kokkos::Profiling::pushRegion(
"FiniteElement::ComputeProjectionOn1DSkin");
290 using MemorySpace =
typename ExecSpace::memory_space;
291 using Point = ArborX::Point<1, coordinates_t>;
301 auto targetPointsPtr = transfer.targetPoints;
313 Kokkos::view_alloc(
execSpace, Kokkos::WithoutInitializing,
317 Kokkos::Profiling::pushRegion(
318 "Compute projection and interpolation coefficient");
319 Kokkos::parallel_for(
320 "Retrieve closest point",
321 Kokkos::RangePolicy<ExecSpace>(
execSpace, 0,
322 targetPointsPtr.extent_int(0)),
325 Kokkos::Array<fp_t, MaxNodesPerElt>
warr;
326 Kokkos::Array<coordinates_t, MaxNodesPerElt>
Xarr;
327 Kokkos::Array<coordinates_t, 1>
tpa;
328 Kokkos::View<coordinates_t *, ExecSpace>
tp(
tpa.data(), 1);
329 const Point
target = {targetPointsPtr(
i, 0)};
346 tp(
j) = targetPointsPtr(
i,
j);
356 Kokkos::View<coordinates_t **, ExecSpace>
Xcoor(
Xarr.data(),
360 for (
int_t k = 0; k < 1; ++k) {
373 Kokkos::Profiling::popRegion();
KOKKOS_INLINE_FUNCTION ArborX::Point< 2, coordinates_t > closest_point_to_edge(const ArborX::Point< 2, coordinates_t > &p, const ArborX::Point< 2, coordinates_t > &a, const ArborX::Point< 2, coordinates_t > &b)
Compute the closest point on a 2D edge segment.