21 #ifndef __TBB_blocked_rangeNd_H 22 #define __TBB_blocked_rangeNd_H 24 #if ! TBB_PREVIEW_BLOCKED_RANGE_ND 25 #error Set TBB_PREVIEW_BLOCKED_RANGE_ND to include blocked_rangeNd.h 31 #if __TBB_CPP11_PRESENT && __TBB_CPP11_ARRAY_PRESENT && __TBB_CPP11_TEMPLATE_ALIASES_PRESENT 37 #include <type_traits> 57 template<
typename Value,
unsigned int N,
typename = make_index_sequence<N>>
58 class blocked_rangeNd_impl;
60 template<
typename Value,
unsigned int N, std::size_t... Is>
61 class blocked_rangeNd_impl<Value, N, index_sequence<Is...>> {
64 using value_type = Value;
73 blocked_rangeNd_impl() =
delete;
76 blocked_rangeNd_impl(
const dim_type_helper<Is>&... args) : my_dims{ {args...} } {}
79 static constexpr
unsigned int ndims() {
return N; }
84 return my_dims[dimension];
99 bool is_divisible()
const {
101 return d.is_divisible();
105 #if __TBB_USE_PROPORTIONAL_SPLIT_IN_BLOCKED_RANGES 106 static const bool is_splittable_in_proportion =
true;
109 blocked_rangeNd_impl(blocked_rangeNd_impl& r, proportional_split proportion) : my_dims(r.my_dims) {
110 do_split(r, proportion);
114 blocked_rangeNd_impl(blocked_rangeNd_impl& r, split proportion) : my_dims(r.my_dims) {
115 do_split(r, proportion);
122 std::array<tbb::blocked_range<value_type>, N> my_dims;
124 template<
typename split_type>
125 void do_split(blocked_rangeNd_impl& r, split_type proportion) {
128 "type of split object is incorrect");
129 __TBB_ASSERT(r.is_divisible(),
"can't split not divisible range");
132 return (
first.size() * second.grainsize() < second.size() *
first.grainsize());
135 auto r_it = r.my_dims.begin() + (my_it - my_dims.begin());
141 __TBB_ASSERT(!(my_it->my_begin < r_it->my_end) && !(r_it->my_end < my_it->my_begin),
142 "blocked_range has been split incorrectly");
148 template<
typename Value,
unsigned int N>
149 using blocked_rangeNd = internal::blocked_rangeNd_impl<Value, N>;
A range over which to iterate.
#define __TBB_STATIC_ASSERT(condition, msg)
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
auto first(Container &c) -> decltype(begin(c))
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
static Value do_split(blocked_range &r, split)
Auxiliary function used by the splitting constructor.