5#include <ginkgo/ginkgo.hpp>
8#include <ginkgo/kernels/kernel_launch.hpp>
12using namespace gko::kernels::GKO_DEVICE_NAMESPACE;
17template <
typename ValueType,
typename EvalFunctionType>
20 ValueType *targetPoints, EvalFunctionType f,
const RadialBasisParameters rbf_params,
const std::size_t inputRowLength,
const std::size_t outputRowLength,
const bool addPolynomial,
const unsigned int extraDims = 0)
24 GKO_KERNEL(
auto i,
auto j,
auto N,
auto dataDimensionality,
auto activeAxis,
auto mtx,
auto supportPoints,
auto targetPoints,
auto f,
auto rbf_params,
auto inputRowLength,
auto outputRowLength,
auto addPolynomial,
auto extraDims) {
25 const unsigned int rowLength = N + extraDims;
30 mtx[i * rowLength + j] = 0;
33#if defined(__NVCC__) || defined(__HIPCC__)
36 for (
size_t k = 0; k < dataDimensionality; ++k) {
37 y = supportPoints[k * inputRowLength + j] - targetPoints[k * outputRowLength + i];
38 dist = fma(y, y, dist);
44 const unsigned int supportPointOffset = dataDimensionality * j;
45 const unsigned int targetPointOffset = dataDimensionality * i;
47 for (
size_t k = 0; k < dataDimensionality; ++k) {
48 dist += pow_int<2>(supportPoints[supportPointOffset + k] - targetPoints[targetPointOffset + k]) *
static_cast<int>(activeAxis.
at(k));
54 mtx[i * rowLength + j] = f(dist, rbf_params);
56 gko::dim<2>{n1, n2}, n2, dataDimensionality, activeAxis, mtx, supportPoints, targetPoints, f, rbf_params, inputRowLength, outputRowLength, addPolynomial, extraDims);
105template <
typename ValueType>
111 GKO_KERNEL(
auto i,
auto j,
auto N1,
auto N2,
auto mtx,
auto x,
auto supportPointsRowLength,
auto dims) {
112#if defined(__NVCC__) || defined(__HIPCC__)
114 mtx[i * dims + j] = x[j * supportPointsRowLength + i];
116 mtx[i * dims + j] = 1;
119 const unsigned int supportPointOffset = (dims - 1) * i;
121 mtx[i * dims + j] = x[supportPointOffset + j];
123 mtx[i * dims + j] = 1;
127 gko::dim<2>{n1, n2}, n1, n2, mtx, x, supportPointsRowLength, dims);
Wendland radial basis function with compact support.
Wendland radial basis function with compact support.
Wendland radial basis function with compact support.
Wendland radial basis function with compact support.
Wendland radial basis function with compact support.
Radial basis function with compact support.
Radial basis function with global and compact support.
Radial basis function with global support.
Radial basis function with global support.
Radial basis function with global support.
Radial basis function with global support.
template void create_rbf_system_matrix< double, precice::mapping::Gaussian >(std::shared_ptr< const DefaultExecutor >, const std::size_t, const std::size_t, const std::size_t, const std::array< bool, 3 >, double *, double *, double *, precice::mapping::Gaussian, const RadialBasisParameters, const std::size_t, const std::size_t, const bool, const unsigned int)
template void create_rbf_system_matrix< double, precice::mapping::ThinPlateSplines >(std::shared_ptr< const DefaultExecutor >, const std::size_t, const std::size_t, const std::size_t, const std::array< bool, 3 >, double *, double *, double *, precice::mapping::ThinPlateSplines, const RadialBasisParameters, const std::size_t, const std::size_t, const bool, const unsigned int)
template void create_rbf_system_matrix< double, precice::mapping::VolumeSplines >(std::shared_ptr< const DefaultExecutor >, const std::size_t, const std::size_t, const std::size_t, const std::array< bool, 3 >, double *, double *, double *, precice::mapping::VolumeSplines, const RadialBasisParameters, const std::size_t, const std::size_t, const bool, const unsigned int)
template void create_rbf_system_matrix< double, precice::mapping::CompactPolynomialC2 >(std::shared_ptr< const DefaultExecutor >, const std::size_t, const std::size_t, const std::size_t, const std::array< bool, 3 >, double *, double *, double *, precice::mapping::CompactPolynomialC2, const RadialBasisParameters, const std::size_t, const std::size_t, const bool, const unsigned int)
template void create_rbf_system_matrix< double, precice::mapping::InverseMultiquadrics >(std::shared_ptr< const DefaultExecutor >, const std::size_t, const std::size_t, const std::size_t, const std::array< bool, 3 >, double *, double *, double *, precice::mapping::InverseMultiquadrics, const RadialBasisParameters, const std::size_t, const std::size_t, const bool, const unsigned int)
void fill_polynomial_matrix(std::shared_ptr< const DefaultExecutor > exec, const std::size_t n1, const std::size_t n2, ValueType *mtx, ValueType *x, const std::size_t supportPointsRowLength, const unsigned int dims=4)
void create_rbf_system_matrix(std::shared_ptr< const DefaultExecutor > exec, const std::size_t n1, const std::size_t n2, const std::size_t dataDimensionality, const std::array< bool, 3 > activeAxis, ValueType *mtx, ValueType *supportPoints, ValueType *targetPoints, EvalFunctionType f, const RadialBasisParameters rbf_params, const std::size_t inputRowLength, const std::size_t outputRowLength, const bool addPolynomial, const unsigned int extraDims=0)
template void create_rbf_system_matrix< double, precice::mapping::CompactThinPlateSplinesC2 >(std::shared_ptr< const DefaultExecutor >, const std::size_t, const std::size_t, const std::size_t, const std::array< bool, 3 >, double *, double *, double *, precice::mapping::CompactThinPlateSplinesC2, const RadialBasisParameters, const std::size_t, const std::size_t, const bool, const unsigned int)
template void create_rbf_system_matrix< double, precice::mapping::CompactPolynomialC8 >(std::shared_ptr< const DefaultExecutor >, const std::size_t, const std::size_t, const std::size_t, const std::array< bool, 3 >, double *, double *, double *, precice::mapping::CompactPolynomialC8, const RadialBasisParameters, const std::size_t, const std::size_t, const bool, const unsigned int)
template void fill_polynomial_matrix< double >(std::shared_ptr< const DefaultExecutor >, const std::size_t, const std::size_t, double *, double *, const std::size_t, const unsigned int)
template void create_rbf_system_matrix< double, precice::mapping::CompactPolynomialC6 >(std::shared_ptr< const DefaultExecutor >, const std::size_t, const std::size_t, const std::size_t, const std::array< bool, 3 >, double *, double *, double *, precice::mapping::CompactPolynomialC6, const RadialBasisParameters, const std::size_t, const std::size_t, const bool, const unsigned int)
template void create_rbf_system_matrix< double, precice::mapping::CompactPolynomialC0 >(std::shared_ptr< const DefaultExecutor >, const std::size_t, const std::size_t, const std::size_t, const std::array< bool, 3 >, double *, double *, double *, precice::mapping::CompactPolynomialC0, const RadialBasisParameters, const std::size_t, const std::size_t, const bool, const unsigned int)
template void create_rbf_system_matrix< double, precice::mapping::Multiquadrics >(std::shared_ptr< const DefaultExecutor >, const std::size_t, const std::size_t, const std::size_t, const std::array< bool, 3 >, double *, double *, double *, precice::mapping::Multiquadrics, const RadialBasisParameters, const std::size_t, const std::size_t, const bool, const unsigned int)
template void create_rbf_system_matrix< double, precice::mapping::CompactPolynomialC4 >(std::shared_ptr< const DefaultExecutor >, const std::size_t, const std::size_t, const std::size_t, const std::array< bool, 3 >, double *, double *, double *, precice::mapping::CompactPolynomialC4, const RadialBasisParameters, const std::size_t, const std::size_t, const bool, const unsigned int)
constexpr T pow_int(const T x)
Computes the power of a given number by an integral exponent given at compile time,...
Wrapper struct that is used to transfer RBF-specific parameters to the GPU.