Warning, file /include/oneapi/tbb/blocked_range2d.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef __TBB_blocked_range2d_H
0018 #define __TBB_blocked_range2d_H
0019
0020 #include <cstddef>
0021
0022 #include "detail/_config.h"
0023 #include "detail/_namespace_injection.h"
0024 #include "detail/_range_common.h"
0025
0026 #include "blocked_range.h"
0027
0028 namespace tbb {
0029 namespace detail {
0030 namespace d1 {
0031
0032
0033
0034 template<typename RowValue, typename ColValue = RowValue>
0035 __TBB_requires(blocked_range_value<RowValue> &&
0036 blocked_range_value<ColValue>)
0037 class blocked_range2d {
0038 public:
0039
0040 using row_range_type = blocked_range<RowValue>;
0041 using col_range_type = blocked_range<ColValue>;
0042
0043 private:
0044 row_range_type my_rows;
0045 col_range_type my_cols;
0046
0047 public:
0048 blocked_range2d( RowValue row_begin, RowValue row_end, typename row_range_type::size_type row_grainsize,
0049 ColValue col_begin, ColValue col_end, typename col_range_type::size_type col_grainsize ) :
0050 my_rows(row_begin,row_end,row_grainsize),
0051 my_cols(col_begin,col_end,col_grainsize)
0052 {}
0053
0054 blocked_range2d( RowValue row_begin, RowValue row_end,
0055 ColValue col_begin, ColValue col_end ) :
0056 my_rows(row_begin,row_end),
0057 my_cols(col_begin,col_end)
0058 {}
0059
0060
0061 bool empty() const {
0062
0063 return my_rows.empty() || my_cols.empty();
0064 }
0065
0066
0067 bool is_divisible() const {
0068 return my_rows.is_divisible() || my_cols.is_divisible();
0069 }
0070
0071 blocked_range2d( blocked_range2d& r, split ) :
0072 my_rows(r.my_rows),
0073 my_cols(r.my_cols)
0074 {
0075 split split_obj;
0076 do_split(r, split_obj);
0077 }
0078
0079 blocked_range2d( blocked_range2d& r, proportional_split& proportion ) :
0080 my_rows(r.my_rows),
0081 my_cols(r.my_cols)
0082 {
0083 do_split(r, proportion);
0084 }
0085
0086
0087 const row_range_type& rows() const { return my_rows; }
0088
0089
0090 const col_range_type& cols() const { return my_cols; }
0091
0092 private:
0093 template <typename Split>
0094 void do_split( blocked_range2d& r, Split& split_obj ) {
0095 if ( my_rows.size()*double(my_cols.grainsize()) < my_cols.size()*double(my_rows.grainsize()) ) {
0096 my_cols.my_begin = col_range_type::do_split(r.my_cols, split_obj);
0097 } else {
0098 my_rows.my_begin = row_range_type::do_split(r.my_rows, split_obj);
0099 }
0100 }
0101 };
0102
0103 }
0104 }
0105
0106 inline namespace v1 {
0107 using detail::d1::blocked_range2d;
0108 }
0109 }
0110
0111 #endif