40 json.get_double(
"/discretization/integration/qx_min", -M_PI),
41 json.get_double(
"/discretization/integration/qy_min", -M_PI),
42 json.get_double(
"/discretization/integration/qx_max", M_PI),
43 json.get_double(
"/discretization/integration/qy_max", M_PI))
111 template <
typename... T> NT
get(
const ctype k,
const T &...t)
const
116 const auto constant = KERNEL::constant(k, t...);
117 return constant + tbb::parallel_reduce(
119 [&](
const tbb::blocked_range2d<uint, uint> &r, NT value) -> NT {
120 for (
uint idx_x = r.rows().begin(); idx_x != r.rows().end(); ++idx_x) {
122 for (
uint idx_y = r.cols().begin(); idx_y != r.cols().end(); ++idx_y) {
127 value += int_element * weight * KERNEL::kernel(qx, qy, k, t...);
132 [&](NT x, NT y) -> NT {
return x + y; });
142 template <
typename... T> std::future<NT>
request(
const ctype k,
const T &...t)
const
144 return std::async(std::launch::deferred, [=,
this]() {
return get(k, t...); });
Integration of an arbitrary 2D function from (qx_min, qy_min) to (qx_max, qy_max) using TBB.
Definition integrator_2D_cartesian_cpu.hh:21
const std::vector< ctype > & x_quadrature_w
Definition integrator_2D_cartesian_cpu.hh:156
NT get(const ctype k, const T &...t) const
Get the value of the integral.
Definition integrator_2D_cartesian_cpu.hh:111
void set_qx_min(const ctype qx_min)
Set the minimum value of the qx integration range.
Definition integrator_2D_cartesian_cpu.hh:79
ctype qx_extent
Definition integrator_2D_cartesian_cpu.hh:152
std::future< NT > request(const ctype k, const T &...t) const
Get the value of the integral asynchronously.
Definition integrator_2D_cartesian_cpu.hh:142
typename get_type::ctype< NT > ctype
Numerical type to be used for integration tasks e.g. the argument or possible jacobians.
Definition integrator_2D_cartesian_cpu.hh:26
void set_qx_max(const ctype qx_max)
Set the maximum value of the qx integration range.
Definition integrator_2D_cartesian_cpu.hh:97
Integrator2DCartesianTBB(QuadratureProvider &quadrature_provider, const std::array< uint, 2 > grid_sizes, const ctype x_extent, const JSONValue &json)
Construct a new Integrator2DCartesianTBB object.
Definition integrator_2D_cartesian_cpu.hh:37
const std::vector< ctype > & y_quadrature_p
Definition integrator_2D_cartesian_cpu.hh:157
const std::array< uint, 2 > grid_sizes
Definition integrator_2D_cartesian_cpu.hh:148
const std::vector< ctype > & y_quadrature_w
Definition integrator_2D_cartesian_cpu.hh:158
Integrator2DCartesianTBB(QuadratureProvider &quadrature_provider, std::array< uint, 2 > grid_sizes, const ctype x_extent, const uint max_block_size=0, const ctype qx_min=-M_PI, const ctype qy_min=-M_PI, const ctype qx_max=M_PI, const ctype qy_max=M_PI)
Construct a new Integrator2DCartesianTBB object.
Definition integrator_2D_cartesian_cpu.hh:61
void set_qy_min(const ctype qy_min)
Set the minimum value of the qy integration range.
Definition integrator_2D_cartesian_cpu.hh:88
void set_qy_max(const ctype qy_max)
Set the maximum value of the qy integration range.
Definition integrator_2D_cartesian_cpu.hh:102
ctype qy_extent
Definition integrator_2D_cartesian_cpu.hh:153
ctype qx_min
Definition integrator_2D_cartesian_cpu.hh:150
ctype qy_min
Definition integrator_2D_cartesian_cpu.hh:151
const std::vector< ctype > & x_quadrature_p
Definition integrator_2D_cartesian_cpu.hh:155
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