Reference documentation for deal.II version Git 11de1224af 2020-11-24 16:17:24 -0500
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
synchronous_iterator.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2008 - 2018 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.md at
12 // the top level directory of deal.II.
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 
23 
24 #include <iterator>
25 #include <tuple>
26 
28 
49 template <typename Iterators>
51 {
55  SynchronousIterators(const Iterators &i);
56 
61  const Iterators &operator*() const;
62 
67  Iterators &operator*();
68 
69 private:
73  Iterators iterators;
74 };
75 
76 
77 
78 template <typename Iterators>
80  : iterators(i)
81 {}
82 
83 
84 
85 template <typename Iterators>
86 inline const Iterators &SynchronousIterators<Iterators>::operator*() const
87 {
88  return iterators;
89 }
90 
91 
92 
93 template <typename Iterators>
95 {
96  return iterators;
97 }
98 
99 
100 
109 template <typename Iterators>
110 inline bool
111 operator<(const SynchronousIterators<Iterators> &a,
113 {
114  return std::get<0>(*a) < std::get<0>(*b);
115 }
116 
117 
118 
126 template <typename Iterators>
127 inline std::size_t
130 {
131  Assert(std::distance(std::get<0>(*b), std::get<0>(*a)) >= 0,
132  ExcInternalError());
133  return std::distance(std::get<0>(*b), std::get<0>(*a));
134 }
135 
136 
142 template <typename I1, typename I2>
143 inline void
144 advance(std::tuple<I1, I2> &t, const unsigned int n)
145 {
146  std::advance(std::get<0>(t), n);
147  std::advance(std::get<1>(t), n);
148 }
149 
155 template <typename I1, typename I2, typename I3>
156 inline void
157 advance(std::tuple<I1, I2, I3> &t, const unsigned int n)
158 {
159  std::advance(std::get<0>(t), n);
160  std::advance(std::get<1>(t), n);
161  std::advance(std::get<2>(t), n);
162 }
163 
169 template <typename I1, typename I2, typename I3, typename I4>
170 inline void
171 advance(std::tuple<I1, I2, I3, I4> &t, const unsigned int n)
172 {
173  std::advance(std::get<0>(t), n);
174  std::advance(std::get<1>(t), n);
175  std::advance(std::get<2>(t), n);
176  std::advance(std::get<3>(t), n);
177 }
178 
179 
180 
186 template <typename I1, typename I2>
187 inline void
188 advance_by_one(std::tuple<I1, I2> &t)
189 {
190  ++std::get<0>(t);
191  ++std::get<1>(t);
192 }
193 
199 template <typename I1, typename I2, typename I3>
200 inline void
201 advance_by_one(std::tuple<I1, I2, I3> &t)
202 {
203  ++std::get<0>(t);
204  ++std::get<1>(t);
205  ++std::get<2>(t);
206 }
207 
213 template <typename I1, typename I2, typename I3, typename I4>
214 inline void
215 advance_by_one(std::tuple<I1, I2, I3, I4> &t)
216 {
217  ++std::get<0>(t);
218  ++std::get<1>(t);
219  ++std::get<2>(t);
220  ++std::get<3>(t);
221 }
222 
223 
224 
230 template <typename Iterators>
232 operator+(const SynchronousIterators<Iterators> &a, const std::size_t n)
233 {
235  ::advance(*x, n);
236  return x;
237 }
238 
244 template <typename Iterators>
247 {
248  ::advance_by_one(*a);
249  return a;
250 }
251 
252 
259 template <typename Iterators>
260 inline bool
263 {
264  return (std::get<0>(*a) != std::get<0>(*b));
265 }
266 
268 
269 #endif
std::size_t operator-(const SynchronousIterators< Iterators > &a, const SynchronousIterators< Iterators > &b)
void advance_by_one(std::tuple< I1, I2 > &t)
#define Assert(cond, exc)
Definition: exceptions.h:1466
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:372
SynchronousIterators(const Iterators &i)
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
SynchronousIterators< Iterators > operator+(const SynchronousIterators< Iterators > &a, const std::size_t n)
bool operator!=(const SynchronousIterators< Iterators > &a, const SynchronousIterators< Iterators > &b)
SynchronousIterators< Iterators > operator++(SynchronousIterators< Iterators > &a)
void advance(std::tuple< I1, I2 > &t, const unsigned int n)
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:371
const Iterators & operator*() const
void advance(std::tuple< I1, I2 > &t, const unsigned int n)
static ::ExceptionBase & ExcInternalError()