40 const ctype qx_max = M_PI)
59 json.get_double(
"/discretization/integration/qx_min", -M_PI),
60 json.get_double(
"/discretization/integration/qx_max", M_PI))
76 json.get_double(
"/discretization/integration/qx_min", -M_PI),
77 json.get_double(
"/discretization/integration/qx_max", M_PI))
121 template <
typename... T> NT
get(
const ctype k,
const T &...t)
const
126 return KERNEL::constant(k, t...) + tbb::parallel_reduce(
127 tbb::blocked_range<uint>(0,
grid_size), NT(0),
128 [&](
const tbb::blocked_range<uint> &r, NT value) -> NT {
129 for (
uint idx_x = r.begin(); idx_x != r.end(); ++idx_x) {
132 value += int_element * weight * KERNEL::kernel(q, k, t...);
136 [&](NT x, NT y) -> NT {
return x + y; });
147 template <
typename... T> std::future<NT>
request(
const ctype k,
const T &...t)
const
149 return std::async(std::launch::deferred, [=,
this]() {
return get(k, t...); });
Integration of an arbitrary 1D function from qx_min to qx_max using TBB.
Definition integrator_1D_cartesian_cpu.hh:21
void set_qx_max(const ctype qx_max)
Set the maximum value of the qx integration range.
Definition integrator_1D_cartesian_cpu.hh:111
const uint grid_size
Definition integrator_1D_cartesian_cpu.hh:153
Integrator1DCartesianTBB(QuadratureProvider &quadrature_provider, const uint grid_size, const ctype x_extent=0., const ctype qx_min=-M_PI, const ctype qx_max=M_PI)
Construct a new Integrator1DCartesianTBB object.
Definition integrator_1D_cartesian_cpu.hh:90
const std::vector< ctype > & x_quadrature_p
Definition integrator_1D_cartesian_cpu.hh:158
void set_qx_min(const ctype qx_min)
Set the minimum value of the qx integration range.
Definition integrator_1D_cartesian_cpu.hh:102
ctype qx_extent
Definition integrator_1D_cartesian_cpu.hh:156
const std::vector< ctype > & x_quadrature_w
Definition integrator_1D_cartesian_cpu.hh:159
Integrator1DCartesianTBB(QuadratureProvider &quadrature_provider, const std::array< uint, 1 > grid_size, const ctype x_extent, const JSONValue &json)
Construct a new Integrator1DCartesianTBB object.
Definition integrator_1D_cartesian_cpu.hh:73
Integrator1DCartesianTBB(QuadratureProvider &quadrature_provider, const std::array< uint, 1 > grid_size, const ctype x_extent=0., const uint max_block_size=0, const ctype qx_min=-M_PI, const ctype qx_max=M_PI)
Construct a new Integrator1DCartesianTBB object.
Definition integrator_1D_cartesian_cpu.hh:38
ctype qx_min
Definition integrator_1D_cartesian_cpu.hh:155
NT get(const ctype k, const T &...t) const
Get the integration result.
Definition integrator_1D_cartesian_cpu.hh:121
std::future< NT > request(const ctype k, const T &...t) const
Get the integration result asynchronously.
Definition integrator_1D_cartesian_cpu.hh:147
Integrator1DCartesianTBB(QuadratureProvider &quadrature_provider, const std::array< uint, 1 > grid_size, const JSONValue &json)
Construct a new Integrator1DCartesianTBB object.
Definition integrator_1D_cartesian_cpu.hh:56
typename get_type::ctype< NT > ctype
Numerical type to be used for integration tasks e.g. the argument or possible jacobians.
Definition integrator_1D_cartesian_cpu.hh:26
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
unsigned int uint
Definition utils.hh:22