Skip to content

Commit 08c60e6

Browse files
committed
fix synch iterators
1 parent 58d1b7c commit 08c60e6

File tree

2 files changed

+37
-4
lines changed

2 files changed

+37
-4
lines changed

include/deal.II/base/parallel.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ namespace parallel
216216
SyncIterators(x_begin),
217217
SyncIterators(x_end),
218218
[function](const auto &it) {
219-
*std::get<1>(*it) = function(*std::get<0>(*it));
219+
*std::get<1>(it) = function(*std::get<0>(it));
220220
},
221221
grainsize);
222222

@@ -307,7 +307,7 @@ namespace parallel
307307
SyncIterators(x_begin),
308308
SyncIterators(x_end),
309309
[function](const auto &it) {
310-
*std::get<2>(*it) = function(*std::get<0>(*it), *std::get<1>(*it));
310+
*std::get<2>(it) = function(*std::get<0>(it), *std::get<1>(it));
311311
},
312312
grainsize);
313313

@@ -409,8 +409,8 @@ namespace parallel
409409
SyncIterators(x_begin),
410410
SyncIterators(x_end),
411411
[function](const auto &it) {
412-
*std::get<3>(*it) =
413-
function(*std::get<0>(*it), *std::get<1>(*it), *std::get<2>(*it));
412+
*std::get<3>(it) =
413+
function(*std::get<0>(it), *std::get<1>(it), *std::get<2>(it));
414414
},
415415
grainsize);
416416

include/deal.II/base/synchronous_iterator.h

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ struct SynchronousIterators
6767
Iterators &
6868
operator*();
6969

70+
using difference_type = std::size_t;
71+
using iterator_category = std::bidirectional_iterator_tag;
72+
using value_type = int;
73+
using pointer = int *;
74+
using reference = int &;
75+
7076
private:
7177
/**
7278
* Storage for the iterators represented by the current class.
@@ -181,6 +187,23 @@ advance(std::tuple<I1, I2, I3, I4> &t, const unsigned int n)
181187

182188

183189

190+
template <typename I1, typename I2>
191+
inline void
192+
prev(std::tuple<I1, I2> &t)
193+
{
194+
--std::get<0>(t);
195+
--std::get<1>(t);
196+
}
197+
198+
template <typename I1, typename I2, typename I3>
199+
inline void
200+
prev(std::tuple<I1, I2, I3> &t)
201+
{
202+
--std::get<0>(t);
203+
--std::get<1>(t);
204+
--std::get<2>(t);
205+
}
206+
184207
/**
185208
* Advance a tuple of iterators by 1.
186209
*
@@ -252,6 +275,16 @@ operator++(SynchronousIterators<Iterators> &a)
252275
return a;
253276
}
254277

278+
279+
template <typename Iterators>
280+
inline SynchronousIterators<Iterators> &
281+
operator--(SynchronousIterators<Iterators> &a)
282+
{
283+
dealii::prev(*a);
284+
return a;
285+
}
286+
287+
255288
/**
256289
* Advance the elements of this iterator by 1 (post-increment).
257290
*

0 commit comments

Comments
 (0)