17 #ifndef __TBB_blocked_rangeNd_H 18 #define __TBB_blocked_rangeNd_H 20 #if ! TBB_PREVIEW_BLOCKED_RANGE_ND 21 #error Set TBB_PREVIEW_BLOCKED_RANGE_ND to include blocked_rangeNd.h 27 #if __TBB_CPP11_PRESENT && __TBB_CPP11_ARRAY_PRESENT && __TBB_CPP11_TEMPLATE_ALIASES_PRESENT 33 #include <type_traits> 53 template<
typename Value,
unsigned int N,
typename = make_index_sequence<N>>
54 class blocked_rangeNd_impl;
56 template<
typename Value,
unsigned int N, std::size_t... Is>
57 class blocked_rangeNd_impl<Value, N, index_sequence<Is...>> {
60 using value_type = Value;
69 blocked_rangeNd_impl() =
delete;
72 blocked_rangeNd_impl(
const dim_type_helper<Is>&... args) : my_dims{ {args...} } {}
75 static constexpr
unsigned int ndims() {
return N; }
80 return my_dims[dimension];
95 bool is_divisible()
const {
97 return d.is_divisible();
101 #if __TBB_USE_PROPORTIONAL_SPLIT_IN_BLOCKED_RANGES 102 static const bool is_splittable_in_proportion =
true;
105 blocked_rangeNd_impl(blocked_rangeNd_impl& r, proportional_split proportion) : my_dims(r.my_dims) {
106 do_split(r, proportion);
110 blocked_rangeNd_impl(blocked_rangeNd_impl& r, split proportion) : my_dims(r.my_dims) {
111 do_split(r, proportion);
118 std::array<tbb::blocked_range<value_type>, N> my_dims;
120 template<
typename split_type>
121 void do_split(blocked_rangeNd_impl& r, split_type proportion) {
124 "type of split object is incorrect");
125 __TBB_ASSERT(r.is_divisible(),
"can't split not divisible range");
128 return (
first.size() * second.grainsize() < second.size() *
first.grainsize());
131 auto r_it = r.my_dims.begin() + (my_it - my_dims.begin());
137 __TBB_ASSERT(!(my_it->my_begin < r_it->my_end) && !(r_it->my_end < my_it->my_begin),
138 "blocked_range has been split incorrectly");
144 template<
typename Value,
unsigned int N>
145 using blocked_rangeNd = internal::blocked_rangeNd_impl<Value, N>;
#define __TBB_STATIC_ASSERT(condition, msg)
static Value do_split(blocked_range &r, split)
Auxiliary function used by the splitting constructor.
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d
auto first(Container &c) -> decltype(begin(c))
A range over which to iterate.
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.