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

DiFfRG: /home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/physics/integration/finiteT/integrator_fT_p2.hh Source File
DiFfRG
integrator_fT_p2.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
12 {
13 public:
14 using ctype = typename get_type::ctype<NT>;
15 static constexpr int sdim = dim - 1; // spatial dimension
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
20 template <typename... T>
21 static KOKKOS_FORCEINLINE_FUNCTION NT kernel(const ctype q, const ctype q0, const T &...t)
22 {
23 using namespace DiFfRG::compute;
24
25 const ctype int_element = powr<sdim - 1>(q); // from p integral
26 const NT result = KERNEL::kernel(q, q0, t...);
27
28 return int_prefactor * int_element * result;
29 }
30
31 template <typename... T> static KOKKOS_FORCEINLINE_FUNCTION NT constant(const T &...t)
32 {
33 return KERNEL::constant(t...);
34 }
35 };
36
37 } // namespace internal
38
39 template <int dim, typename NT, typename KERNEL, typename ExecutionSpace>
41 : public QuadratureIntegrator_fT<2, NT, internal::Transform_fT_p2<dim, NT, KERNEL>, ExecutionSpace>
42 {
44
45 public:
49 using ctype = typename get_type::ctype<NT>;
53 using execution_space = ExecutionSpace;
54
61
68
70 {
71 this->x_extent = x_extent;
72 Base::set_grid_extents({0}, {std::sqrt(x_extent) * k});
73 }
74
76 {
77 this->k = k;
78 Base::set_grid_extents({0}, {std::sqrt(x_extent) * k});
79 Base::set_typical_E(k); // update typical energy
80 }
81
83
84 private:
87 };
88} // namespace DiFfRG
Definition integrator_fT_p2.hh:42
Integrator_fT_p2(QuadratureProvider &quadrature_provider, const std::array< size_t, 1 > grid_size, ctype x_extent=2., ctype T=1, ctype typical_E=1)
Definition integrator_fT_p2.hh:62
ExecutionSpace execution_space
Execution space to be used for the integration, e.g. GPU_exec, TBB_exec.
Definition integrator_fT_p2.hh:53
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.hh:49
void set_k(ctype k)
Definition integrator_fT_p2.hh:75
ctype x_extent
Definition integrator_fT_p2.hh:85
ctype k
Definition integrator_fT_p2.hh:86
void set_x_extent(ctype x_extent)
Definition integrator_fT_p2.hh:69
Integrator_fT_p2(QuadratureProvider &quadrature_provider, const JSONValue &json)
Definition integrator_fT_p2.hh:55
void set_typical_E(ctype typical_E)
Definition integrator_fT_p2.hh:82
A wrapper around the boost json value class.
Definition json.hh:19
Definition quadrature_integrator_fT.hh:19
QuadratureProvider & quadrature_provider
Definition quadrature_integrator_fT.hh:353
void set_typical_E(const ctype typical_E)
Definition quadrature_integrator_fT.hh:82
void set_grid_extents(const std::array< ctype, sdim > grid_min, const std::array< ctype, sdim > grid_max)
Definition quadrature_integrator_fT.hh:59
device::array< size_t, dim > grid_size
Definition quadrature_integrator_fT.hh:358
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.hh:12
typename get_type::ctype< NT > ctype
Definition integrator_fT_p2.hh:14
static KOKKOS_FORCEINLINE_FUNCTION NT kernel(const ctype q, const ctype q0, const T &...t)
Definition integrator_fT_p2.hh:21
static constexpr ctype int_prefactor
Definition integrator_fT_p2.hh:17
static constexpr int sdim
Definition integrator_fT_p2.hh:15
static KOKKOS_FORCEINLINE_FUNCTION NT constant(const T &...t)
Definition integrator_fT_p2.hh:31
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