DiFfRG
Loading...
Searching...
No Matches
integrator_constant.hh
Go to the documentation of this file.
1#pragma once
2
3// standard library
4#include <future>
5
6// DiFfRG
8
9namespace DiFfRG
10{
11 template <int d, typename NT, typename KERNEL> class IntegratorConstant
12 {
13 public:
17 using ctype = typename get_type::ctype<NT>;
18 IntegratorConstant(QuadratureProvider &quadrature_provider, const std::array<uint, 1> grid_size,
19 const ctype x_extent, const uint max_block_size = 0)
20 : IntegratorConstant(quadrature_provider, grid_size[0], x_extent, max_block_size)
21 {
22 }
23
24 IntegratorConstant(QuadratureProvider &quadrature_provider, const std::array<uint, 1> grid_size,
25 const ctype x_extent, const JSONValue &)
26 : IntegratorConstant(quadrature_provider, grid_size[0], x_extent)
27 {
28 }
29
30 IntegratorConstant(QuadratureProvider &quadrature_provider, const uint grid_size, const ctype x_extent,
31 const uint max_block_size = 0)
33 {
34 (void)quadrature_provider;
35 (void)grid_size;
36 (void)x_extent;
37 (void)max_block_size;
38 }
39
41
52 template <typename... T> NT get(const ctype k, const T &...t) const
53 {
54 constexpr ctype S_d = S_d_prec<ctype>(d);
55
56 return KERNEL::constant(k, t...) + KERNEL::kernel(k, t...) * S_d / powr<d>(2. * M_PI);
57 }
58
69 template <typename... T> std::future<NT> request(const ctype k, const T &...t) const
70 {
71 return std::async(std::launch::deferred, [=, this]() { return get(k, t...); });
72 }
73 };
74} // namespace DiFfRG
Definition integrator_constant.hh:12
typename get_type::ctype< NT > ctype
Numerical type to be used for integration tasks e.g. the argument or possible jacobians.
Definition integrator_constant.hh:17
IntegratorConstant()
Definition integrator_constant.hh:40
NT get(const ctype k, const T &...t) const
Get the integral of the kernel.
Definition integrator_constant.hh:52
IntegratorConstant(QuadratureProvider &quadrature_provider, const std::array< uint, 1 > grid_size, const ctype x_extent, const uint max_block_size=0)
Definition integrator_constant.hh:18
IntegratorConstant(QuadratureProvider &quadrature_provider, const uint grid_size, const ctype x_extent, const uint max_block_size=0)
Definition integrator_constant.hh:30
std::future< NT > request(const ctype k, const T &...t) const
Request a future for the integral of the kernel.
Definition integrator_constant.hh:69
IntegratorConstant(QuadratureProvider &quadrature_provider, const std::array< uint, 1 > grid_size, const ctype x_extent, const JSONValue &)
Definition integrator_constant.hh:24
A wrapper around the boost json value class.
Definition json.hh:19
A class that provides quadrature points and weights, in host and device memory. The quadrature points...
Definition quadrature_provider.hh:139
typename internal::_ctype< CT >::value ctype
Definition types.hh:106
Definition complex_math.hh:14
constexpr __forceinline__ __host__ __device__ NumberType powr(const NumberType x)
A compile-time evaluatable power function for whole number exponents.
Definition math.hh:45
constexpr __forceinline__ __host__ __device__ double S_d(NT d)
Surface of a d-dimensional sphere.
Definition math.hh:91
consteval NT S_d_prec(uint d)
Surface of a d-dimensional sphere (precompiled)
Definition math.hh:104
unsigned int uint
Definition utils.hh:22