8#include <ArborX_Point.hpp>
9#include <Kokkos_Core.hpp>
10#include <Kokkos_Profiling_ScopedRegion.hpp>
15#include "common/transfer.hxx"
18#include "rbf_pum/interpolator.hxx"
29using AvailableRbfFunctions =
33static AvailableRbfFunctions MakeRbfFunction(
unsigned char rbfFunction) {
34 switch (rbfFunction) {
47 throw std::invalid_argument(
"Unsupported RBF function selector: " +
48 std::to_string(rbfFunction));
53template <
typename ExecSpace,
typename RbfFuncType, PACMAN::
int_t Dim>
62 PACMAN::SetupTransferClass(transfer, nSourcePoints, 0, 0, nTargetPoints,
64 pSourcePoints, pSourceValues,
nullptr,
nullptr,
65 nullptr, pTargetPoints);
67 PACMAN::RbfPum::RbfPumInterpolator<ExecSpace, Dim, RbfFuncType> interpolator(
70 PACMAN::CopyToRowMajorHost(transfer.targetValues, pTargetValues);
73template <PACMAN::
int_t Dim>
75DispatchRbf(
unsigned char execSpace,
unsigned char rbfFunction,
81 [&](
auto execSpaceObj,
auto rbfFunctionObj) {
82 RunRbfInterpolate<decltype(execSpaceObj), decltype(rbfFunctionObj), Dim>(
83 pSourcePoints, nSourcePoints, pSourceValues, pTargetPoints,
84 nTargetPoints, nComponents, pTargetValues);
103 const std::string _region_name =
"PACMAN::rbf_interpolate";
104 const Kokkos::Profiling::ScopedRegion region(_region_name);
107 if (sourcePoints ==
nullptr && nSourcePoints > 0)
108 throw std::invalid_argument(
"sourcePoints is null but nSourcePoints > 0");
109 if (targetPoints ==
nullptr && nTargetPoints > 0)
110 throw std::invalid_argument(
"targetPoints is null but nTargetPoints > 0");
111 if (sourceValues ==
nullptr && nSourcePoints > 0)
112 throw std::invalid_argument(
"sourceValues is null but nSourcePoints > 0");
113 if (targetValues ==
nullptr && nTargetPoints > 0)
114 throw std::invalid_argument(
"targetValues is null but nTargetPoints > 0");
116 throw std::invalid_argument(
"nComponents must be greater than zero");
119 switch (spaceDimension) {
121 return DispatchRbf<1>(execSpace, rbfFunction, sourcePoints, nSourcePoints,
122 sourceValues, targetPoints, nTargetPoints,
123 nComponents, targetValues);
125 return DispatchRbf<2>(execSpace, rbfFunction, sourcePoints, nSourcePoints,
126 sourceValues, targetPoints, nTargetPoints,
127 nComponents, targetValues);
129 return DispatchRbf<3>(execSpace, rbfFunction, sourcePoints, nSourcePoints,
130 sourceValues, targetPoints, nTargetPoints,
131 nComponents, targetValues);
134 throw std::runtime_error(
135 "The dimension of the points can only be: 1, 2 or 3.\n");
A functor which computes a RBF function: WendlandC0 Each RBF function must have a host device method ...
A functor which computes a RBF function: WendlandC2 Each RBF function must have a host device method ...
A functor which computes a RBF function: WendlandC4 Each RBF function must have a host device method ...
A functor which computes a RBF function: WendlandC6 Each RBF function must have a host device method ...
A functor which computes a RBF function: WendlandC8 Each RBF function must have a host device method ...
void rbf_interpolate(int_t spaceDimension, unsigned char execSpace, unsigned char rbfFunction, coordinates_t *sourcePoints, int_t nSourcePoints, fp_t *sourceValues, coordinates_t *targetPoints, int_t nTargetPoints, fp_t *targetValues, int_t nComponents=1)
C++ interface for RBF-PUM interpolation.
static AvailableExecSpaces MakeExecSpace(const unsigned char s)
Converts an execution-space selector byte to a variant type.
static constexpr unsigned char WENDLANDC6
static constexpr unsigned char WENDLANDC8
static constexpr unsigned char WENDLANDC2
static constexpr unsigned char WENDLANDC0
static constexpr unsigned char WENDLANDC4