Reference documentation for deal.II version 9.5.0
\(\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\}}\)
Loading...
Searching...
No Matches
synchronous_iterator.h
Go to the documentation of this file.
1// ---------------------------------------------------------------------
2//
3// Copyright (C) 2008 - 2021 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 &
62 operator*() const;
63
68 Iterators &
69 operator*();
70
71private:
75 Iterators iterators;
76};
77
78
79
80template <typename Iterators>
82 : iterators(i)
83{}
84
85
86
87template <typename Iterators>
88inline const Iterators &
90{
91 return iterators;
92}
93
94
95
96template <typename Iterators>
97inline Iterators &
99{
100 return iterators;
101}
102
103
104
113template <typename Iterators>
114inline bool
117{
118 return std::get<0>(*a) < std::get<0>(*b);
119}
120
121
122
130template <typename Iterators>
131inline std::size_t
134{
135 Assert(std::distance(std::get<0>(*b), std::get<0>(*a)) >= 0,
137 return std::distance(std::get<0>(*b), std::get<0>(*a));
138}
139
140
146template <typename I1, typename I2>
147inline void
148advance(std::tuple<I1, I2> &t, const unsigned int n)
149{
150 std::advance(std::get<0>(t), n);
151 std::advance(std::get<1>(t), n);
152}
153
159template <typename I1, typename I2, typename I3>
160inline void
161advance(std::tuple<I1, I2, I3> &t, const unsigned int n)
162{
163 std::advance(std::get<0>(t), n);
164 std::advance(std::get<1>(t), n);
165 std::advance(std::get<2>(t), n);
166}
167
173template <typename I1, typename I2, typename I3, typename I4>
174inline void
175advance(std::tuple<I1, I2, I3, I4> &t, const unsigned int n)
176{
177 std::advance(std::get<0>(t), n);
178 std::advance(std::get<1>(t), n);
179 std::advance(std::get<2>(t), n);
180 std::advance(std::get<3>(t), n);
181}
182
183
184
190template <typename I1, typename I2>
191inline void
192advance_by_one(std::tuple<I1, I2> &t)
193{
194 ++std::get<0>(t);
195 ++std::get<1>(t);
196}
197
203template <typename I1, typename I2, typename I3>
204inline void
205advance_by_one(std::tuple<I1, I2, I3> &t)
206{
207 ++std::get<0>(t);
208 ++std::get<1>(t);
209 ++std::get<2>(t);
210}
211
217template <typename I1, typename I2, typename I3, typename I4>
218inline void
219advance_by_one(std::tuple<I1, I2, I3, I4> &t)
220{
221 ++std::get<0>(t);
222 ++std::get<1>(t);
223 ++std::get<2>(t);
224 ++std::get<3>(t);
225}
226
227
228
234template <typename Iterators>
236operator+(const SynchronousIterators<Iterators> &a, const std::size_t n)
237{
239 ::advance(*x, n);
240 return x;
241}
242
248template <typename Iterators>
251{
253 return a;
254}
255
256
263template <typename Iterators>
264inline bool
267{
268 return (std::get<0>(*a) != std::get<0>(*b));
269}
270
272
273#endif
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:472
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:473
#define Assert(cond, exc)
static ::ExceptionBase & ExcInternalError()
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)
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)
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)