Reference documentation for deal.II version GIT relicensing-422-gb369f187d8 2024-04-17 18:10:02+00:00
\(\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// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2009 - 2021 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15#ifndef dealii_synchronous_iterator_h
16#define dealii_synchronous_iterator_h
17
18
19#include <deal.II/base/config.h>
20
22
23#include <iterator>
24#include <tuple>
25
27
48template <typename Iterators>
50{
54 SynchronousIterators(const Iterators &i);
55
60 const Iterators &
61 operator*() const;
62
67 Iterators &
68 operator*();
69
70private:
74 Iterators iterators;
75};
76
77
78
79template <typename Iterators>
81 : iterators(i)
82{}
83
84
85
86template <typename Iterators>
87inline const Iterators &
89{
90 return iterators;
91}
92
93
94
95template <typename Iterators>
96inline Iterators &
98{
99 return iterators;
100}
101
102
103
112template <typename Iterators>
113inline bool
116{
117 return std::get<0>(*a) < std::get<0>(*b);
118}
119
120
121
129template <typename Iterators>
130inline std::size_t
133{
134 Assert(std::distance(std::get<0>(*b), std::get<0>(*a)) >= 0,
136 return std::distance(std::get<0>(*b), std::get<0>(*a));
137}
138
139
145template <typename I1, typename I2>
146inline void
147advance(std::tuple<I1, I2> &t, const unsigned int n)
148{
149 std::advance(std::get<0>(t), n);
150 std::advance(std::get<1>(t), n);
151}
152
158template <typename I1, typename I2, typename I3>
159inline void
160advance(std::tuple<I1, I2, I3> &t, const unsigned int n)
161{
162 std::advance(std::get<0>(t), n);
163 std::advance(std::get<1>(t), n);
164 std::advance(std::get<2>(t), n);
165}
166
172template <typename I1, typename I2, typename I3, typename I4>
173inline void
174advance(std::tuple<I1, I2, I3, I4> &t, const unsigned int n)
175{
176 std::advance(std::get<0>(t), n);
177 std::advance(std::get<1>(t), n);
178 std::advance(std::get<2>(t), n);
179 std::advance(std::get<3>(t), n);
180}
181
182
183
189template <typename I1, typename I2>
190inline void
191advance_by_one(std::tuple<I1, I2> &t)
192{
193 ++std::get<0>(t);
194 ++std::get<1>(t);
195}
196
202template <typename I1, typename I2, typename I3>
203inline void
204advance_by_one(std::tuple<I1, I2, I3> &t)
205{
206 ++std::get<0>(t);
207 ++std::get<1>(t);
208 ++std::get<2>(t);
209}
210
216template <typename I1, typename I2, typename I3, typename I4>
217inline void
218advance_by_one(std::tuple<I1, I2, I3, I4> &t)
219{
220 ++std::get<0>(t);
221 ++std::get<1>(t);
222 ++std::get<2>(t);
223 ++std::get<3>(t);
224}
225
226
227
233template <typename Iterators>
235operator+(const SynchronousIterators<Iterators> &a, const std::size_t n)
236{
238 ::advance(*x, n);
239 return x;
240}
241
247template <typename Iterators>
254
255
262template <typename Iterators>
263inline bool
266{
267 return (std::get<0>(*a) != std::get<0>(*b));
268}
269
271
272#endif
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:502
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:503
#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)