11/*
2- Copyright (c) 2005-2017 Intel Corporation
2+ Copyright (c) 2005-2019 Intel Corporation
33
44 Licensed under the Apache License, Version 2.0 (the "License");
55 you may not use this file except in compliance with the License.
1212 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313 See the License for the specific language governing permissions and
1414 limitations under the License.
15-
16-
17-
18-
1915*/
2016
2117#ifndef __TBB_blocked_range3d_H
@@ -49,21 +45,19 @@ class blocked_range3d {
4945 my_pages (page_begin,page_end),
5046 my_rows (row_begin,row_end),
5147 my_cols (col_begin,col_end)
52- {
53- }
48+ {}
5449
5550 blocked_range3d ( PageValue page_begin, PageValue page_end, typename page_range_type::size_type page_grainsize,
5651 RowValue row_begin, RowValue row_end, typename row_range_type::size_type row_grainsize,
5752 ColValue col_begin, ColValue col_end, typename col_range_type::size_type col_grainsize ) :
5853 my_pages (page_begin,page_end,page_grainsize),
5954 my_rows (row_begin,row_end,row_grainsize),
6055 my_cols (col_begin,col_end,col_grainsize)
61- {
62- }
56+ {}
6357
6458 // ! True if range is empty
6559 bool empty () const {
66- // Yes, it is a logical OR here, not AND .
60+ // Range is empty if at least one dimension is empty .
6761 return my_pages.empty () || my_rows.empty () || my_cols.empty ();
6862 }
6963
@@ -94,6 +88,17 @@ class blocked_range3d {
9488 }
9589#endif /* __TBB_USE_PROPORTIONAL_SPLIT_IN_BLOCKED_RANGES */
9690
91+ // ! The pages of the iteration space
92+ const page_range_type& pages () const {return my_pages;}
93+
94+ // ! The rows of the iteration space
95+ const row_range_type& rows () const {return my_rows;}
96+
97+ // ! The columns of the iteration space
98+ const col_range_type& cols () const {return my_cols;}
99+
100+ private:
101+
97102 template <typename Split>
98103 void do_split ( blocked_range3d& r, Split& split_obj)
99104 {
@@ -103,24 +108,14 @@ class blocked_range3d {
103108 } else {
104109 my_rows.my_begin = row_range_type::do_split (r.my_rows , split_obj);
105110 }
106- } else {
111+ } else {
107112 if ( my_pages.size ()*double (my_cols.grainsize ()) < my_cols.size ()*double (my_pages.grainsize ()) ) {
108113 my_cols.my_begin = col_range_type::do_split (r.my_cols , split_obj);
109114 } else {
110115 my_pages.my_begin = page_range_type::do_split (r.my_pages , split_obj);
111116 }
112117 }
113118 }
114-
115- // ! The pages of the iteration space
116- const page_range_type& pages () const {return my_pages;}
117-
118- // ! The rows of the iteration space
119- const row_range_type& rows () const {return my_rows;}
120-
121- // ! The columns of the iteration space
122- const col_range_type& cols () const {return my_cols;}
123-
124119};
125120
126121} // namespace tbb
0 commit comments