5#include <cuda_runtime.h>
6#define BOOST_PP_VARIADICS 1
7#define PRECICE_HOST_DEVICE __host__ __device__
8#define PRECICE_MEMORY_SPACE __device__
11#elif defined(__HIPCC__)
14#include <hip/hip_runtime.h>
15#define PRECICE_HOST_DEVICE __host__ __device__
16#define PRECICE_MEMORY_SPACE __device__
21#define PRECICE_HOST_DEVICE
22#define PRECICE_MEMORY_SPACE
80template <
bool isDefinite>
129 :
_cPow2(math::pow_int<2>(c))
142 return std::sqrt(cPow2 + math::pow_int<2>(radius));
167 :
_cPow2(math::pow_int<2>(c))
169#if !defined(__NVCC__) || !defined(__HIPCC__)
172 "Shape parameter for radial-basis-function inverse multiquadric has to be larger than zero. Please update the \"shape-parameter\" attribute.");
185 return 1.0 /
std::sqrt(cPow2 + math::pow_int<2>(radius));
216 return std::abs(radius);
243#if !defined(__NVCC__) || !defined(__HIPCC__)
246 "Shape parameter for radial-basis-function gaussian has to be larger than zero. Please update the \"shape-parameter\" attribute.");
248 "Support radius for radial-basis-function gaussian has to be larger than zero. Please update the \"support-radius\" attribute.");
278 if (radius > supportRadius)
280 return std::exp(-math::pow_int<2>(shape * radius)) - deltaY;
319#if !defined(__NVCC__) || !defined(__HIPCC__)
322 "Support radius for radial-basis-function compact thin-plate-splines c2 has to be larger than zero. Please update the \"support-radius\" attribute.");
324 _r_inv = 1. / supportRadius;
341 const double p = radius * r_inv;
344 return 1.0 - 30.0 * math::pow_int<2>(p) - 10.0 * math::pow_int<3>(p) + 45.0 * math::pow_int<4>(p) - 6.0 * math::pow_int<5>(p) - math::pow_int<3>(p) * 60.0 *
std::log(
std::max(p,
NUMERICAL_ZERO_DIFFERENCE));
372#if !defined(__NVCC__) || !defined(__HIPCC__)
375 "Support radius for radial-basis-function compact polynomial c0 has to be larger than zero. Please update the \"support-radius\" attribute.");
377 _r_inv = 1. / supportRadius;
394 const double p = radius * r_inv;
397 return math::pow_int<2>(1.0 - p);
425#if !defined(__NVCC__) || !defined(__HIPCC__)
428 "Support radius for radial-basis-function compact polynomial c2 has to be larger than zero. Please update the \"support-radius\" attribute.");
431 _r_inv = 1. / supportRadius;
448 const double p = radius * r_inv;
451 return math::pow_int<4>(1.0 - p) *
FMA(4, p, 1);
479#if !defined(__NVCC__) || !defined(__HIPCC__)
482 "Support radius for radial-basis-function compact polynomial c4 has to be larger than zero. Please update the \"support-radius\" attribute.");
485 _r_inv = 1. / supportRadius;
502 const double p = radius * r_inv;
505 return math::pow_int<6>(1.0 - p) * (35 * math::pow_int<2>(p) +
FMA(18, p, 3));
533#if !defined(__NVCC__) || !defined(__HIPCC__)
536 "Support radius for radial-basis-function compact polynomial c6 has to be larger than zero. Please update the \"support-radius\" attribute.");
538 _r_inv = 1. / supportRadius;
555 const double p = radius * r_inv;
558 return math::pow_int<8>(1.0 - p) * (32.0 * math::pow_int<3>(p) + 25.0 * math::pow_int<2>(p) +
FMA(8.0, p, 1.0));
586#if !defined(__NVCC__) || !defined(__HIPCC__)
589 "Support radius for radial-basis-function compact polynomial c6 has to be larger than zero. Please update the \"support-radius\" attribute.");
591 _r_inv = 1. / supportRadius;
608 const double p = radius * r_inv;
611 return math::pow_int<10>(1.0 - p) * (1287.0 * math::pow_int<4>(p) + 1350.0 * math::pow_int<3>(p) + 630.0 * math::pow_int<2>(p) + 150.0 * p + 15);
#define PRECICE_HOST_DEVICE
#define PRECICE_MEMORY_SPACE
PRECICE_MEMORY_SPACE const double NUMERICAL_ZERO_DIFFERENCE
#define PRECICE_CHECK(check,...)
This class provides a lightweight logger.
Wendland radial basis function with compact support.
PRECICE_HOST_DEVICE double operator()(const double radius, const RadialBasisParameters params) const
double getSupportRadius() const
RadialBasisParameters getFunctionParameters()
double evaluate(double radius) const
CompactPolynomialC0(double supportRadius)
RadialBasisParameters _params
Wendland radial basis function with compact support.
CompactPolynomialC2(double supportRadius)
PRECICE_HOST_DEVICE double operator()(const double radius, const RadialBasisParameters params) const
RadialBasisParameters _params
RadialBasisParameters getFunctionParameters()
double getSupportRadius() const
double evaluate(double radius) const
Wendland radial basis function with compact support.
CompactPolynomialC4(double supportRadius)
double evaluate(double radius) const
PRECICE_HOST_DEVICE double operator()(const double radius, const RadialBasisParameters params) const
double getSupportRadius() const
RadialBasisParameters _params
RadialBasisParameters getFunctionParameters()
Wendland radial basis function with compact support.
PRECICE_HOST_DEVICE double operator()(const double radius, const RadialBasisParameters params) const
RadialBasisParameters _params
double getSupportRadius() const
CompactPolynomialC6(double supportRadius)
double evaluate(double radius) const
const RadialBasisParameters getFunctionParameters()
Wendland radial basis function with compact support.
CompactPolynomialC8(double supportRadius)
const RadialBasisParameters getFunctionParameters()
double getSupportRadius() const
double evaluate(double radius) const
RadialBasisParameters _params
PRECICE_HOST_DEVICE double operator()(const double radius, const RadialBasisParameters params) const
Radial basis function with compact support.
double getSupportRadius() const
RadialBasisParameters _params
double evaluate(double radius) const
RadialBasisParameters getFunctionParameters()
CompactThinPlateSplinesC2(double supportRadius)
PRECICE_HOST_DEVICE double operator()(const double radius, const RadialBasisParameters params) const
Radial basis function with global and compact support.
double getSupportRadius() const
RadialBasisParameters _params
PRECICE_HOST_DEVICE double operator()(const double radius, const RadialBasisParameters params) const
Gaussian(const double shape, const double supportRadius=std::numeric_limits< double >::infinity())
double evaluate(const double radius) const
static constexpr double cutoffThreshold
Below that value the function is supposed to be zero. Defines the support radius if not explicitly gi...
RadialBasisParameters getFunctionParameters()
double _supportRadius
Either explicitly set (from cutoffThreshold) or computed supportRadius.
Radial basis function with global support.
double evaluate(double radius) const
InverseMultiquadrics(double c)
PRECICE_HOST_DEVICE double operator()(const double radius, const RadialBasisParameters params) const
RadialBasisParameters getFunctionParameters()
RadialBasisParameters _params
Radial basis function with global support.
PRECICE_HOST_DEVICE double operator()(const double radius, const RadialBasisParameters params) const
double evaluate(double radius) const
RadialBasisParameters getFunctionParameters()
RadialBasisParameters _params
Radial basis function with global support.
double evaluate(double radius) const
PRECICE_HOST_DEVICE double operator()(const double radius, const RadialBasisParameters params) const
RadialBasisParameters _params
RadialBasisParameters getFunctionParameters()
Radial basis function with global support.
RadialBasisParameters _params
PRECICE_HOST_DEVICE double operator()(const double radius, const RadialBasisParameters params) const
double evaluate(double radius) const
RadialBasisParameters getFunctionParameters()
std::enable_if< std::is_arithmetic< Scalar >::value, bool >::type greater(Scalar A, Scalar B, Scalar tolerance=NUMERICAL_ZERO_DIFFERENCE)
Main namespace of the precice library.
static precice::logging::Logger _log("precicec")
Base class for RBF with compact support.
static constexpr bool hasCompactSupport()
Base class for RBF functions to distinguish positive definite functions.
static constexpr bool isStrictlyPositiveDefinite()
Base class for RBF without compact support.
static constexpr double getSupportRadius()
static constexpr bool hasCompactSupport()
Wrapper struct that is used to transfer RBF-specific parameters to the GPU.