Reference documentation for deal.II version 8.5.1
synchronous_iterator.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2008 - 2016 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE at
12 // the top level of the deal.II distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii__synchronous_iterator_h
17 #define dealii__synchronous_iterator_h
18 
19 
20 #include <deal.II/base/config.h>
21 #include <deal.II/base/exceptions.h>
22 
23 #include <deal.II/base/std_cxx11/tuple.h>
24 
25 #include <iterator>
26 
27 DEAL_II_NAMESPACE_OPEN
28 
50 template <typename Iterators>
52 {
56  SynchronousIterators (const Iterators &i);
57 
62 
67  const Iterators &operator* () const;
68 
73  Iterators &operator* ();
74 
78  Iterators iterators;
79 };
80 
81 
82 
83 template <typename Iterators>
84 inline
86 SynchronousIterators (const Iterators &i)
87  :
88  iterators (i)
89 {}
90 
91 
92 template <typename Iterators>
93 inline
96  :
97  iterators (i.iterators)
98 {}
99 
100 
101 
102 template <typename Iterators>
103 inline
104 const Iterators &
106 {
107  return iterators;
108 }
109 
110 
111 
112 template <typename Iterators>
113 inline
114 Iterators &
116 {
117  return iterators;
118 }
119 
120 
121 
130 template <typename Iterators>
131 inline
132 bool
133 operator< (const SynchronousIterators<Iterators> &a,
135 {
136  return std_cxx11::get<0>(*a) < std_cxx11::get<0>(*b);
137 }
138 
139 
140 
148 template <typename Iterators>
149 inline
150 std::size_t
153 {
154  Assert (std::distance (std_cxx11::get<0>(*b),
155  std_cxx11::get<0>(*a)) >= 0,
156  ExcInternalError());
157  return std::distance (std_cxx11::get<0>(*b),
158  std_cxx11::get<0>(*a));
159 }
160 
161 
167 template <typename I1, typename I2>
168 inline
169 void advance (std_cxx11::tuple<I1,I2> &t,
170  const unsigned int n)
171 {
172  std::advance (std_cxx11::get<0>(t), n);
173  std::advance (std_cxx11::get<1>(t), n);
174 }
175 
181 template <typename I1, typename I2, typename I3>
182 inline
183 void advance (std_cxx11::tuple<I1,I2,I3> &t,
184  const unsigned int n)
185 {
186  std::advance (std_cxx11::get<0>(t), n);
187  std::advance (std_cxx11::get<1>(t), n);
188  std::advance (std_cxx11::get<2>(t), n);
189 }
190 
196 template <typename I1, typename I2,
197  typename I3, typename I4>
198 inline
199 void advance (std_cxx11::tuple<I1,I2,I3, I4> &t,
200  const unsigned int n)
201 {
202  std::advance (std_cxx11::get<0>(t), n);
203  std::advance (std_cxx11::get<1>(t), n);
204  std::advance (std_cxx11::get<2>(t), n);
205  std::advance (std_cxx11::get<3>(t), n);
206 }
207 
208 
209 
215 template <typename I1, typename I2>
216 inline
217 void advance_by_one (std_cxx11::tuple<I1,I2> &t)
218 {
219  ++std_cxx11::get<0>(t);
220  ++std_cxx11::get<1>(t);
221 }
222 
228 template <typename I1, typename I2, typename I3>
229 inline
230 void advance_by_one (std_cxx11::tuple<I1,I2,I3> &t)
231 {
232  ++std_cxx11::get<0>(t);
233  ++std_cxx11::get<1>(t);
234  ++std_cxx11::get<2>(t);
235 }
236 
242 template <typename I1, typename I2,
243  typename I3, typename I4>
244 inline
245 void advance_by_one (std_cxx11::tuple<I1,I2,I3,I4> &t)
246 {
247  ++std_cxx11::get<0>(t);
248  ++std_cxx11::get<1>(t);
249  ++std_cxx11::get<2>(t);
250  ++std_cxx11::get<3>(t);
251 }
252 
253 
254 
260 template <typename Iterators>
261 inline
264  const std::size_t n)
265 {
267  ::advance (*x, n);
268  return x;
269 }
270 
276 template <typename Iterators>
277 inline
280 {
281  ::advance_by_one (*a);
282  return a;
283 }
284 
285 
292 template <typename Iterators>
293 inline
294 bool
297 {
298  return (std_cxx11::get<0>(*a) !=
299  std_cxx11::get<0>(*b));
300 }
301 
302 DEAL_II_NAMESPACE_CLOSE
303 
304 #endif
Tensor< rank, dim, typename ProductType< Number, OtherNumber >::type > operator+(const SymmetricTensor< rank, dim, Number > &left, const Tensor< rank, dim, OtherNumber > &right)
void advance_by_one(std_cxx11::tuple< I1, I2, I3 > &t)
#define Assert(cond, exc)
Definition: exceptions.h:313
Tensor< rank, dim, typename ProductType< Number, OtherNumber >::type > operator-(const SymmetricTensor< rank, dim, Number > &left, const Tensor< rank, dim, OtherNumber > &right)
SynchronousIterators(const Iterators &i)
void advance(std_cxx11::tuple< I1, I2, I3, I4 > &t, const unsigned int n)
void advance(std_cxx11::tuple< I1, I2, I3 > &t, const unsigned int n)
void advance_by_one(std_cxx11::tuple< I1, I2 > &t)
SynchronousIterators< Iterators > operator++(SynchronousIterators< Iterators > &a)
void advance(std_cxx11::tuple< I1, I2 > &t, const unsigned int n)
bool operator!=(const AlignedVector< T > &lhs, const AlignedVector< T > &rhs)
const Iterators & operator*() const
void advance_by_one(std_cxx11::tuple< I1, I2, I3, I4 > &t)
static ::ExceptionBase & ExcInternalError()