Reference documentation for deal.II version 9.3.3
\(\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 - 2020 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
49template <typename Iterators>
51{
55 SynchronousIterators(const Iterators &i);
56
61 const Iterators &operator*() const;
62
67 Iterators &operator*();
68
69private:
73 Iterators iterators;
74};
75
76
77
78template <typename Iterators>
80 : iterators(i)
81{}
82
83
84
85template <typename Iterators>
86inline const Iterators &SynchronousIterators<Iterators>::operator*() const
87{
88 return iterators;
89}
90
91
92
93template <typename Iterators>
95{
96 return iterators;
97}
98
99
100
109template <typename Iterators>
110inline bool
113{
114 return std::get<0>(*a) < std::get<0>(*b);
115}
116
117
118
126template <typename Iterators>
127inline std::size_t
130{
131 Assert(std::distance(std::get<0>(*b), std::get<0>(*a)) >= 0,
133 return std::distance(std::get<0>(*b), std::get<0>(*a));
134}
135
136
142template <typename I1, typename I2>
143inline void
144advance(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
155template <typename I1, typename I2, typename I3>
156inline void
157advance(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
169template <typename I1, typename I2, typename I3, typename I4>
170inline void
171advance(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
186template <typename I1, typename I2>
187inline void
188advance_by_one(std::tuple<I1, I2> &t)
189{
190 ++std::get<0>(t);
191 ++std::get<1>(t);
192}
193
199template <typename I1, typename I2, typename I3>
200inline void
201advance_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
213template <typename I1, typename I2, typename I3, typename I4>
214inline void
215advance_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
230template <typename Iterators>
232operator+(const SynchronousIterators<Iterators> &a, const std::size_t n)
233{
235 ::advance(*x, n);
236 return x;
237}
238
244template <typename Iterators>
247{
249 return a;
250}
251
252
259template <typename Iterators>
260inline bool
263{
264 return (std::get<0>(*a) != std::get<0>(*b));
265}
266
268
269#endif
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:402
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:403
#define Assert(cond, exc)
Definition: exceptions.h:1465
static ::ExceptionBase & ExcInternalError()
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
void advance_by_one(std::tuple< I1, I2, I3 > &t)
bool operator!=(const SynchronousIterators< Iterators > &a, const SynchronousIterators< Iterators > &b)
SynchronousIterators< Iterators > operator++(SynchronousIterators< Iterators > &a)
void advance(std::tuple< I1, I2, I3, I4 > &t, const unsigned int n)
SynchronousIterators< Iterators > operator+(const SynchronousIterators< Iterators > &a, const std::size_t n)
std::size_t operator-(const SynchronousIterators< Iterators > &a, const SynchronousIterators< Iterators > &b)
void advance(std::tuple< I1, I2, I3 > &t, const unsigned int n)
SynchronousIterators(const Iterators &i)
bool operator<(const SynchronousIterators< Iterators > &a, const SynchronousIterators< Iterators > &b)
void advance(std::tuple< I1, I2 > &t, const unsigned int n)
void advance_by_one(std::tuple< I1, I2 > &t)
const Iterators & operator*() const
void advance_by_one(std::tuple< I1, I2, I3, I4 > &t)
void advance(std::tuple< I1, I2 > &t, const unsigned int n)