/home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/physics/integration/finiteT/integrator_fT_p2_1ang.hh Source File#

DiFfRG: /home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/physics/integration/finiteT/integrator_fT_p2_1ang.hh Source File
DiFfRG
integrator_fT_p2_1ang.hh
Go to the documentation of this file.
1#pragma once
2
3// DiFfRG
6
7namespace DiFfRG
8{
9 namespace internal
10 {
11 template <int dim, typename NT, typename KERNEL> class Transform_fT_p2_1ang
12 {
13 public:
14 static constexpr int sdim = dim - 1; // spatial dimension
15 using ctype = typename get_type::ctype<NT>;
16
17 static constexpr ctype int_prefactor = S_d_prec<ctype>(sdim) // solid nd angle
18 / powr<sdim>(2 * (ctype)M_PI) // fourier factor
19 * (1 / (ctype)2); // divide the cos integral out
20
21 template <typename... T>
22 static KOKKOS_FORCEINLINE_FUNCTION NT kernel(const ctype q, const ctype cos, const ctype q0, const T &...t)
23 {
24 using namespace DiFfRG::compute;
25
26 const ctype int_element = powr<sdim - 1>(q); // from p integral
27 const NT result = KERNEL::kernel(q, cos, q0, t...);
28
29 return int_prefactor * int_element * result;
30 }
31
32 template <typename... T> static KOKKOS_FORCEINLINE_FUNCTION NT constant(const T &...t)
33 {
34 return KERNEL::constant(t...);
35 }
36 };
37
38 } // namespace internal
39
40 template <int dim, typename NT, typename KERNEL, typename ExecutionSpace>
41 requires(dim >= 3)
43 : public QuadratureIntegrator_fT<3, NT, internal::Transform_fT_p2_1ang<dim, NT, KERNEL>, ExecutionSpace>
44 {
46
47 public:
51 using ctype = typename get_type::ctype<NT>;
52 using execution_space = ExecutionSpace;
53
54 Integrator_fT_p2_1ang(QuadratureProvider &quadrature_provider, const JSONValue &json)
56 : Integrator_fT_p2_1ang(quadrature_provider, internal::make_int_grid<2, NT>(json, {"x_order", "cos1_order"}),
57 optimize_x_extent<typename KERNEL::Regulator>(json), json.get_double("T", 1.0))
58 {
59 }
60
61 Integrator_fT_p2_1ang(QuadratureProvider &quadrature_provider, const std::array<size_t, 2> grid_size,
62 ctype x_extent = 2., ctype T = 1, ctype typical_E = 1)
63 : Base(quadrature_provider, grid_size, {0, -1.}, {std::sqrt(x_extent), 1.},
65 x_extent(x_extent), k(1.)
66 {
67 }
68
69 void set_x_extent(ctype x_extent)
70 {
71 this->x_extent = x_extent;
72 Base::set_grid_extents({0, -1.}, {std::sqrt(x_extent) * k, 1.});
73 }
74
75 void set_k(ctype k)
76 {
77 this->k = k;
78 Base::set_grid_extents({0, -1.}, {std::sqrt(x_extent) * k, 1.});
79 Base::set_typical_E(k); // update typical energy
80 }
81
82 void set_typical_E(ctype typical_E) { Base::set_typical_E(typical_E); }
83
84 private:
87 };
88} // namespace DiFfRG
Definition integrator_fT_p2_1ang.hh:44
void set_x_extent(ctype x_extent)
Definition integrator_fT_p2_1ang.hh:69
void set_k(ctype k)
Definition integrator_fT_p2_1ang.hh:75
ExecutionSpace execution_space
Definition integrator_fT_p2_1ang.hh:52
ctype k
Definition integrator_fT_p2_1ang.hh:86
Integrator_fT_p2_1ang(QuadratureProvider &quadrature_provider, const JSONValue &json)
Definition integrator_fT_p2_1ang.hh:54
Integrator_fT_p2_1ang(QuadratureProvider &quadrature_provider, const std::array< size_t, 2 > grid_size, ctype x_extent=2., ctype T=1, ctype typical_E=1)
Definition integrator_fT_p2_1ang.hh:61
typename get_type::ctype< NT > ctype
Numerical type to be used for integration tasks e.g. the argument or possible jacobians.
Definition integrator_fT_p2_1ang.hh:51
void set_typical_E(ctype typical_E)
Definition integrator_fT_p2_1ang.hh:82
ctype x_extent
Definition integrator_fT_p2_1ang.hh:85
A wrapper around the boost json value class.
Definition json.hh:19
Definition quadrature_integrator_fT.hh:19
A class that provides quadrature points and weights, in host and device memory. The quadrature points...
Definition quadrature_provider.hh:137
Definition integrator_fT_p2_1ang.hh:12
static constexpr ctype int_prefactor
Definition integrator_fT_p2_1ang.hh:17
typename get_type::ctype< NT > ctype
Definition integrator_fT_p2_1ang.hh:15
static KOKKOS_FORCEINLINE_FUNCTION NT constant(const T &...t)
Definition integrator_fT_p2_1ang.hh:32
static KOKKOS_FORCEINLINE_FUNCTION NT kernel(const ctype q, const ctype cos, const ctype q0, const T &...t)
Definition integrator_fT_p2_1ang.hh:22
static constexpr int sdim
Definition integrator_fT_p2_1ang.hh:14
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