1
1
#ifndef DASH__HALO_HALOCOORDINATEACCESS_H
2
2
#define DASH__HALO_HALOCOORDINATEACCESS_H
3
3
4
- #include < dash/halo/Halo.h>
4
+ #include < dash/halo/Halo.h>
5
5
6
6
namespace dash {
7
7
@@ -37,7 +37,7 @@ class DataInnerAccess {
37
37
template <dim_t _CurrentDimension = CurrentDimension + 1 >
38
38
std::enable_if_t <(_CurrentDimension != NumDimensions), DataInnerAccess<CoordinateInnerAccessT, CurrentDimension+1 >>
39
39
operator [](index_t pos) {
40
-
40
+
41
41
return DataInnerAccess<CoordinateInnerAccessT, CurrentDimension+1 >(_offsets, _mem + pos * (*_offsets)[CurrentDimension]);
42
42
}
43
43
@@ -137,14 +137,14 @@ class DataAccess {
137
137
if (pos < 0 ) {
138
138
return DataAccess<CoordinateAccessT, CurrentDimension+1 >(_access, _mem + pos * _access->_offsets [CurrentDimension], _coords, _reg_index, true );
139
139
}
140
-
140
+
141
141
if (pos >= static_cast <index_t >(_access->_view_local ->extent (CurrentDimension))) {
142
142
return DataAccess<CoordinateAccessT, CurrentDimension+1 >(_access, _mem + pos * _access->_offsets [CurrentDimension], _coords, _reg_index + 2 , true );
143
143
}
144
144
145
145
return DataAccess<CoordinateAccessT, CurrentDimension+1 >(_access, _mem + pos * _access->_offsets [CurrentDimension], _coords, _reg_index + 1 , true );
146
146
}
147
-
147
+
148
148
return DataAccess<CoordinateAccessT, CurrentDimension+1 >(_access, _mem + pos * _access->_offsets [CurrentDimension], _coords, _reg_index + 1 , false );
149
149
}
150
150
@@ -153,11 +153,11 @@ class DataAccess {
153
153
operator [](index_t pos) {
154
154
if (_halo || pos < 0 || pos >= static_cast <index_t >(_access->_view_local ->extent (CurrentDimension))) {
155
155
_reg_index *= REGION_INDEX_BASE;
156
-
156
+
157
157
if (pos >= 0 ) {
158
158
++_reg_index;
159
- }
160
-
159
+ }
160
+
161
161
if (pos >= static_cast <index_t >(_access->_view_local ->extent (CurrentDimension))) {
162
162
++_reg_index;
163
163
}
@@ -169,7 +169,7 @@ class DataAccess {
169
169
return *(halo_memory->first_element_at (_reg_index)
170
170
+ halo_memory->offset (_reg_index, _coords));
171
171
}
172
-
172
+
173
173
return _mem[pos];
174
174
}
175
175
@@ -185,7 +185,7 @@ template<typename CoordinateAccessT>
185
185
class CoordinateHaloAccess {
186
186
private:
187
187
using Self_t = CoordinateHaloAccess<CoordinateAccessT>;
188
-
188
+
189
189
static constexpr auto NumDimensions = CoordinateAccessT::ndim();
190
190
static constexpr auto MemoryArrange = CoordinateAccessT::memory_order();
191
191
@@ -236,7 +236,7 @@ class CoordinateHaloAccess {
236
236
for (const auto & view : bnd_views) {
237
237
AllViewRanges_t ranges;
238
238
for (dim_t d = 0 ; d < NumDimensions; ++d) {
239
- ranges[d] = {static_cast <index_t >(view.offset (d)),
239
+ ranges[d] = {static_cast <index_t >(view.offset (d)),
240
240
static_cast <index_t >(view.offset (d) + view.extent (d))};
241
241
}
242
242
all_ranges.push_back (ranges);
@@ -370,7 +370,7 @@ class CoordinateAccess {
370
370
AllViewRanges_t set_ranges (ViewSpec_t view) const {
371
371
AllViewRanges_t ranges;
372
372
for (dim_t d = 0 ; d < NumDimensions; ++d) {
373
- ranges[d] = {static_cast <index_t >(view.offset (d)),
373
+ ranges[d] = {static_cast <index_t >(view.offset (d)),
374
374
static_cast <index_t >(view.offset (d) + view.extent (d))};
375
375
}
376
376
@@ -380,8 +380,8 @@ class CoordinateAccess {
380
380
AllViewRanges_t set_ranges_halo (ViewSpec_t view) const {
381
381
AllViewRanges_t ranges;
382
382
for (dim_t d = 0 ; d < NumDimensions; ++d) {
383
- const auto & ext_max = _halo_block->halo_extension_max (d);
384
- ranges[d] = {static_cast <index_t >(view.offset (d)) - ext_max.first ,
383
+ const auto & ext_max = _halo_block->halo_spec (). halo_extension_max (d);
384
+ ranges[d] = {static_cast <index_t >(view.offset (d)) - ext_max.first ,
385
385
static_cast <index_t >(view.offset (d) + view.extent (d)) + ext_max.second };
386
386
}
387
387
0 commit comments