Reference documentation for deal.II version GIT c415589cf0 2022-08-14 18:50: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\}}\)
iterator_range.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2014 - 2022 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_iterator_range_h
17 #define dealii_iterator_range_h
18 
19 
20 #include <deal.II/base/config.h>
21 
23 
25 
26 
27 // Forward declaration
28 #ifndef DOXYGEN
29 template <typename Iterator>
31 #endif
32 
33 
125 template <typename Iterator>
127 {
128 public:
133 
134 
138  using iterator = Iterator;
139 
145  IteratorRange();
146 
154  IteratorRange(const iterator begin, const iterator end);
155 
160  begin();
161 
166  begin() const;
167 
173  end() const;
174 
180  end();
181 
182 private:
188 };
189 
190 
191 
196 template <typename Iterator>
198 {
199 public:
204  using BaseIterator = Iterator;
205 
212  explicit IteratorOverIterators(const BaseIterator &iterator);
213 
218  const BaseIterator &
219  operator*() const;
220 
225  const BaseIterator *
226  operator->() const;
227 
233  operator++();
234 
241  operator++(int);
242 
249  bool
250  operator!=(const IteratorOverIterators &i_o_i) const;
251 
265  operator const BaseIterator &() const;
266 
272  using iterator_category = std::forward_iterator_tag;
273  using value_type = Iterator;
274  using difference_type = typename Iterator::difference_type;
275  using pointer = Iterator *;
276  using reference = Iterator &;
277 
278 private:
283 };
284 
285 
286 
291 template <typename BaseIterator>
294  const typename identity<BaseIterator>::type &end)
295 {
297  return ir;
298 }
299 
300 
301 // ------------------- template member functions
302 
303 
304 template <typename Iterator>
306  const BaseIterator &iterator)
307  : element_of_iterator_collection(iterator)
308 {}
309 
310 
311 
312 template <typename Iterator>
313 inline const typename IteratorOverIterators<Iterator>::BaseIterator &
315 {
316  return element_of_iterator_collection;
317 }
318 
319 
320 
321 template <typename Iterator>
322 inline const typename IteratorOverIterators<Iterator>::BaseIterator *
324 {
325  return &element_of_iterator_collection;
326 }
327 
328 
329 
330 template <typename Iterator>
333 {
334  ++element_of_iterator_collection;
335  return *this;
336 }
337 
338 
339 
340 template <typename Iterator>
343 {
344  const IteratorOverIterators old_value = *this;
345  ++element_of_iterator_collection;
346  return *old_value;
347 }
348 
349 
350 
351 template <typename Iterator>
352 inline bool
354  const IteratorOverIterators &i_o_i) const
355 {
356  return element_of_iterator_collection != i_o_i.element_of_iterator_collection;
357 }
358 
359 
360 
361 template <typename Iterator>
363 {
364  return element_of_iterator_collection;
365 }
366 
367 
368 
369 template <typename Iterator>
371  : it_begin()
372  , it_end()
373 {}
374 
375 
376 
377 template <typename Iterator>
379  const iterator e)
380  : it_begin(b)
381  , it_end(e)
382 {}
383 
384 
385 template <typename Iterator>
388 {
389  return it_begin;
390 }
391 
392 
393 template <typename Iterator>
396 {
397  return it_begin;
398 }
399 
400 
401 template <typename Iterator>
404 {
405  return it_end;
406 }
407 
408 
409 template <typename Iterator>
412 {
413  return it_end;
414 }
415 
416 
418 
419 #endif
typename Iterator::difference_type difference_type
IteratorOverIterators(const BaseIterator &iterator)
BaseIterator element_of_iterator_collection
const BaseIterator & operator*() const
IteratorOverIterators & operator++()
const BaseIterator * operator->() const
std::forward_iterator_tag iterator_category
bool operator!=(const IteratorOverIterators &i_o_i) const
IteratorOverIterators end() const
IteratorOverIterators begin()
::IteratorOverIterators< Iterator > IteratorOverIterators
const IteratorOverIterators it_begin
Iterator iterator
const IteratorOverIterators it_end
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:442
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:443
IteratorRange< BaseIterator > make_iterator_range(const BaseIterator &begin, const typename identity< BaseIterator >::type &end)
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
VectorType::value_type * begin(VectorType &V)
VectorType::value_type * end(VectorType &V)