8 #ifndef NORMAL_DERIVATIVE_KERNEL_HPP_INCLUDED
9 #define NORMAL_DERIVATIVE_KERNEL_HPP_INCLUDED
25 template <
class DistanceKernel,
int Nx,
int Ny>
29 namespace kernel_traits_ns
32 template <
class DK,
int Nx,
int Ny>
37 template <
class DK,
int Nx,
int Ny>
42 template <
class DK,
int Nx,
int Ny>
47 template <
class DK,
int Nx,
int Ny>
52 template <
class DK,
int Nx,
int Ny>
57 template <
class DK,
int Nx,
int Ny>
66 template <
class DK,
int Nx,
int Ny>
68 : std::integral_constant<bool, Nx == Ny> {};
71 template <
class DK,
int Nx,
int Ny>
78 template <
class DK,
int Ny>
85 template <
class DK,
int Nx,
int Ny>
92 template <
class DK,
int Nx>
114 template <
class DistanceKernel>
116 :
public kernel_base<normal_derivative_kernel<DistanceKernel, 0, 0> >
117 ,
public DistanceKernel
127 : DistanceKernel(dk.derived())
135 DistanceKernel::template eval<0>(rvec.norm(), &g);
139 result_t operator()(test_input_t
const &x, trial_input_t
const &y)
const
141 return (*
this)(x.get_x(), y.get_x());
149 template <
class DistanceKernel>
151 :
public kernel_base<normal_derivative_kernel<DistanceKernel, 0, 1> >
152 ,
public DistanceKernel
163 : DistanceKernel(dk.derived())
167 result_t operator()(x_t
const &x, x_t
const &y, x_t
const &ny)
const
170 scalar_t r = rvec.norm();
171 scalar_t rdny = rvec.dot(ny) / r;
173 DistanceKernel::template eval<1>(r, &f);
177 result_t operator()(test_input_t
const &x, trial_input_t
const &y)
const
179 return (*
this)(x.get_x(), y.get_x(), y.get_unit_normal());
186 template <
class DistanceKernel>
188 :
public kernel_base<normal_derivative_kernel<DistanceKernel, 1, 0> >
189 ,
public DistanceKernel
200 : DistanceKernel(dk.derived())
204 result_t operator()(x_t
const &x, x_t
const &y, x_t
const &nx)
const
207 scalar_t r = rvec.norm();
208 scalar_t rdnx = -rvec.dot(nx) / r;
210 DistanceKernel::template eval<1>(r, &f);
214 result_t operator()(test_input_t
const &x, trial_input_t
const &y)
const
216 return (*
this)(x.get_x(), y.get_x(), x.get_unit_normal());
224 template <
class DistanceKernel>
226 :
public kernel_base<normal_derivative_kernel<DistanceKernel, 1, 1> >
227 ,
public DistanceKernel
238 : DistanceKernel(dk.derived())
242 result_t operator()(x_t
const &x, x_t
const &y, x_t
const &nx, x_t
const &ny)
const
245 scalar_t r = rvec.norm();
246 scalar_t rdny = rvec.dot(ny) / r;
247 scalar_t rdnx = -rvec.dot(nx) / r;
249 DistanceKernel::template eval<2>(r, f);
250 return f[0] * rdnx * rdny - f[1] * nx.dot(ny);
253 result_t operator()(test_input_t
const &x, trial_input_t
const &y)
const
255 return (*
this)(x.get_x(), y.get_x(), x.get_unit_normal(), y.get_unit_normal());
262 template <
class DistanceKernel>
264 :
public kernel_base<normal_derivative_kernel<DistanceKernel, 2, 0> >
265 ,
public DistanceKernel
276 : DistanceKernel(dk.derived())
280 result_t operator()(x_t
const &x, x_t
const &y, x_t
const &nx)
const
283 scalar_t r = rvec.norm();
284 scalar_t rdnx = -rvec.dot(nx) / r;
286 DistanceKernel::template eval<2>(r, f);
287 return f[0] * rdnx * rdnx + f[1];
290 result_t operator()(test_input_t
const &x, trial_input_t
const &y)
const
292 return (*
this)(x.get_x(), y.get_x(), x.get_unit_normal());