/home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/physics/integration/vacuum/integrator_p2_1ang.hh Source File#

DiFfRG: /home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/physics/integration/vacuum/integrator_p2_1ang.hh Source File
DiFfRG
integrator_p2_1ang.hh
Go to the documentation of this file.
1#pragma once
2
3// DiFfRG
6
7// standard libraries
8#include <array>
9
10namespace DiFfRG
11{
12 namespace internal
13 {
14 template <int dim, typename NT, typename KERNEL> class Transform_p2_1ang
15 {
16 public:
17 using ctype = typename get_type::ctype<NT>;
18
19 static constexpr ctype int_prefactor = S_d_prec<ctype>(dim) // solid nd angle
20 / powr<dim>(2 * (ctype)M_PI) // fourier factor
21 * (1 / (ctype)2); // divide the cos integral out
22
23 template <typename... T>
24 static KOKKOS_FORCEINLINE_FUNCTION NT kernel(const ctype q, const ctype cos, const T &...t)
25 requires provides_kernel<NT, KERNEL, ctype, 2, T...>
26 {
27 using namespace DiFfRG::compute;
28
29 const ctype int_element = powr<dim - 1>(q); // from p integral
30 const NT result = KERNEL::kernel(q, cos, t...);
31
32 return int_prefactor * int_element * result;
33 }
34
35 template <typename... T>
36 static KOKKOS_FORCEINLINE_FUNCTION NT constant(const T &...t)
37 requires provides_constant<NT, KERNEL, T...>
38 {
39 return KERNEL::constant(t...);
40 }
41 };
42
43 } // namespace internal
44
58 template <int dim, typename NT, typename KERNEL, typename ExecutionSpace>
60 : public QuadratureIntegrator<2, NT, internal::Transform_p2_1ang<dim, NT, KERNEL>, ExecutionSpace>
61 {
63
64 public:
68 using ctype = typename get_type::ctype<NT>;
72 using execution_space = ExecutionSpace;
73
80
88
90 {
91 this->x_extent = x_extent;
92 Base::set_grid_extents({0, -1.}, {std::sqrt(x_extent) * k, 1.});
93 }
94
96 {
97 this->k = k;
98 Base::set_grid_extents({0, -1.}, {std::sqrt(x_extent) * k, 1.});
99 }
100
101 private:
104 };
105} // namespace DiFfRG
Integrator_p2_1ang integrates a kernel depending on the radial momentum and a single angle on as $...
Definition integrator_p2_1ang.hh:61
void set_x_extent(ctype x_extent)
Definition integrator_p2_1ang.hh:89
Integrator_p2_1ang(QuadratureProvider &quadrature_provider, const JSONValue &json)
Definition integrator_p2_1ang.hh:74
typename get_type::ctype< NT > ctype
Numerical type to be used for integration tasks e.g. the argument or possible jacobians.
Definition integrator_p2_1ang.hh:68
ctype k
Definition integrator_p2_1ang.hh:103
ctype x_extent
Definition integrator_p2_1ang.hh:102
Integrator_p2_1ang(QuadratureProvider &quadrature_provider, const std::array< size_t, 2 > grid_size, ctype x_extent=2.)
Definition integrator_p2_1ang.hh:81
ExecutionSpace execution_space
Execution space to be used for the integration, e.g. GPU_exec, TBB_exec.
Definition integrator_p2_1ang.hh:72
void set_k(ctype k)
Definition integrator_p2_1ang.hh:95
A wrapper around the boost json value class.
Definition json.hh:19
This class performs numerical integration over a d-dimensional hypercube using quadrature rules.
Definition quadrature_integrator.hh:27
void set_grid_extents(const std::array< ctype, dim > &grid_min, const std::array< ctype, dim > &grid_max)
Definition quadrature_integrator.hh:54
device::array< size_t, dim > grid_size
Definition quadrature_integrator.hh:294
A class that provides quadrature points and weights, in host and device memory. The quadrature points...
Definition quadrature_provider.hh:137
Definition integrator_p2_1ang.hh:15
static KOKKOS_FORCEINLINE_FUNCTION NT kernel(const ctype q, const ctype cos, const T &...t)
Definition integrator_p2_1ang.hh:24
static constexpr ctype int_prefactor
Definition integrator_p2_1ang.hh:19
typename get_type::ctype< NT > ctype
Definition integrator_p2_1ang.hh:17
static KOKKOS_FORCEINLINE_FUNCTION NT constant(const T &...t)
Definition integrator_p2_1ang.hh:36
Definition abstract_integrator.hh:46
Definition abstract_integrator.hh:42
Definition abstract_integrator.hh:28
Definition math.hh:220
typename internal::_ctype< CT >::value ctype
Definition types.hh:134
std::array< size_t, dim > make_int_grid(const JSONValue &json, const std::array< std::string, dim > &names)
Definition abstract_integrator.hh:13
Definition complex_math.hh:10
constexpr KOKKOS_INLINE_FUNCTION NumberType powr(const NumberType x)
A compile-time evaluatable power function for whole number exponents.
Definition math.hh:41
consteval NT S_d_prec(uint d)
Surface of a d-dimensional sphere (precompiled)
Definition math.hh:112
double optimize_x_extent(const JSONValue &json)
Definition optimize.hh:8
@ legendre
Definition quadrature.hh:45