25 #ifndef NIHU_LAPLACE_KERNEL_HPP_INCLUDED
26 #define NIHU_LAPLACE_KERNEL_HPP_INCLUDED
31 #include "../core/global_definitions.hpp"
32 #include "../core/gaussian_quadrature.hpp"
34 #include <boost/math/constants/constants.hpp>
44 template <
class Space>
47 namespace distance_dependent_kernel_traits_ns
49 template <
class Space>
52 template <
class Space>
55 typedef typename Space::scalar_t type;
58 template <
class Space>
61 template <
class Space>
64 template <
class Space>
69 template <
class Space>
71 : std::integral_constant<unsigned, 7> {};
73 template <
class Scalar>
77 template <
class Scalar>
81 template <
class Scalar>
85 template <
class Scalar>
93 template <
class scalar>
99 void eval_impl(std::integral_constant<unsigned, 0>,
scalar r,
scalar *f)
const
101 using namespace boost::math::double_constants;
102 *f = -std::log(r) / two_pi;
106 void eval_impl(std::integral_constant<unsigned, 1>,
scalar r,
scalar *f)
const
108 using namespace boost::math::double_constants;
109 *f = -1.0 / r / two_pi;
113 void eval_impl(std::integral_constant<unsigned, 2>,
scalar r,
scalar *f)
const
115 using namespace boost::math::double_constants;
116 f[1] = -1.0 / (r*r) / two_pi;
120 void eval_impl(std::integral_constant<unsigned, 3>,
scalar r,
scalar *f)
const
122 using namespace boost::math::double_constants;
123 auto g = 1. / (r*r*r) / two_pi;
137 template <
unsigned order>
140 this->eval_impl(std::integral_constant<unsigned, order>(), r, f);
147 template <
class scalar>
152 void eval_impl(std::integral_constant<unsigned, 0>,
scalar r,
scalar *f)
const
154 using namespace boost::math::double_constants;
155 *f = 1. / r / (4. * pi);
159 void eval_impl(std::integral_constant<unsigned, 1>,
scalar r,
scalar *f)
const
161 using namespace boost::math::double_constants;
162 *f = -1. / (r*r) / (4. * pi);
166 void eval_impl(std::integral_constant<unsigned, 2>,
scalar r,
scalar *f)
const
168 using namespace boost::math::double_constants;
169 auto g = 1./(r*r*r)/(4. * pi);
174 void eval_impl(std::integral_constant<unsigned, 3>,
scalar r,
scalar *f)
const
176 using namespace boost::math::double_constants;
177 auto g = 1. / (r*r*r*r) / (4. * pi);
191 template <
unsigned order>
194 this->eval_impl(std::integral_constant<unsigned, order>(), r, f);
200 namespace kernel_traits_ns
202 template <
class Scalar>
206 laplace_kernel<space_2d<Scalar> >
209 template <
class Scalar>
213 laplace_kernel<space_2d<Scalar> >
216 template <
class Scalar>
221 template <
class Scalar>
226 template <
class Scalar>
231 template <
class Scalar>
236 template <
class Scalar>
241 template <
class Scalar>
247 namespace kernel_traits_ns
249 template <
class Scalar,
int Nx,
int Ny>
254 template <
class Scalar,
int Nx,
int Ny>
261 template <
class Scalar>
268 template <
class Scalar>
301 template <
class Scalar>
307 template <
class guiggiani>
310 using namespace boost::math::double_constants;
312 auto g1vec = obj.get_rvec_series(
_1()) * (
313 obj.get_rvec_series(
_2()).dot(obj.get_Jvec_series(
_0()))
314 + obj.get_rvec_series(
_1()).dot(obj.get_Jvec_series(
_1()))
317 auto b0vec = -obj.get_Jvec_series(
_0());
318 auto b1vec = 3. * g1vec - obj.get_Jvec_series(
_1());
320 auto a0 = b0vec.dot(obj.get_n0()) * obj.get_shape_series(
_0());
321 auto a1 = b1vec.dot(obj.get_n0()) * obj.get_shape_series(
_0())
322 + b0vec.dot(obj.get_n0()) * obj.get_shape_series(
_1());
324 auto Sm2 = -3. * obj.get_rvec_series(
_1()).dot(obj.get_rvec_series(
_2()));
326 obj.set_laurent_coeff(
_m1(), -(Sm2 * a0 + a1) / (4. * pi));
327 obj.set_laurent_coeff(
_m2(), -a0 / (4. * pi));
333 #endif // NIHU_LAPLACE_KERNEL_HPP_INCLUDED