Reference documentation for deal.II version 9.2.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\}}\)
iterator_range.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2014 - 2019 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 
24 #include <iterator>
25 
26 
28 
29 
30 // Forward declaration
31 #ifndef DOXYGEN
32 template <typename Iterator>
34 #endif
35 
36 
128 template <typename Iterator>
130 {
131 public:
136 
137 
142 
148  IteratorRange();
149 
157  IteratorRange(const iterator begin, const iterator end);
158 
163  begin();
164 
169  begin() const;
170 
176  end() const;
177 
183  end();
184 
185 private:
191 };
192 
193 
194 
199 template <typename Iterator>
201 {
202 public:
208 
215  explicit IteratorOverIterators(const BaseIterator &iterator);
216 
221  const BaseIterator &operator*() const;
222 
227  const BaseIterator *operator->() const;
228 
234  operator++();
235 
242  operator++(int);
243 
250  bool
251  operator!=(const IteratorOverIterators &i_o_i) const;
252 
266  operator const BaseIterator &() const;
267 
273  using iterator_category = std::forward_iterator_tag;
275  using difference_type = typename Iterator::difference_type;
276  using pointer = Iterator *;
277  using reference = Iterator &;
278 
279 private:
284 };
285 
286 
287 
294 template <typename BaseIterator>
297  const typename identity<BaseIterator>::type &end)
298 {
300  return ir;
301 }
302 
303 
304 // ------------------- template member functions
305 
306 
307 template <typename Iterator>
309  const BaseIterator &iterator)
310  : element_of_iterator_collection(iterator)
311 {}
312 
313 
314 
315 template <typename Iterator>
316 inline const typename IteratorOverIterators<Iterator>::BaseIterator &
318 {
319  return element_of_iterator_collection;
320 }
321 
322 
323 
324 template <typename Iterator>
325 inline const typename IteratorOverIterators<Iterator>::BaseIterator *
327 {
328  return &element_of_iterator_collection;
329 }
330 
331 
332 
333 template <typename Iterator>
336 {
337  ++element_of_iterator_collection;
338  return *this;
339 }
340 
341 
342 
343 template <typename Iterator>
346 {
347  const IteratorOverIterators old_value = *this;
348  ++element_of_iterator_collection;
349  return *old_value;
350 }
351 
352 
353 
354 template <typename Iterator>
355 inline bool
358 {
359  return element_of_iterator_collection != i_o_i.element_of_iterator_collection;
360 }
361 
362 
363 
364 template <typename Iterator>
366 {
367  return element_of_iterator_collection;
368 }
369 
370 
371 
372 template <typename Iterator>
374  : it_begin()
375  , it_end()
376 {}
377 
378 
379 
380 template <typename Iterator>
382  const iterator e)
383  : it_begin(b)
384  , it_end(e)
385 {}
386 
387 
388 template <typename Iterator>
391 {
392  return it_begin;
393 }
394 
395 
396 template <typename Iterator>
399 {
400  return it_begin;
401 }
402 
403 
404 template <typename Iterator>
407 {
408  return it_end;
409 }
410 
411 
412 template <typename Iterator>
415 {
416  return it_end;
417 }
418 
419 
421 
422 #endif
identity::type
T type
Definition: template_constraints.h:270
IteratorRange::IteratorOverIterators
::IteratorOverIterators< Iterator > IteratorOverIterators
Definition: iterator_range.h:135
IteratorRange::iterator
Iterator iterator
Definition: iterator_range.h:141
IteratorRange::it_end
const IteratorOverIterators it_end
Definition: iterator_range.h:190
Physics::Elasticity::Kinematics::e
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
IteratorOverIterators
Definition: iterator_range.h:200
IteratorOverIterators::operator!=
bool operator!=(const IteratorOverIterators &i_o_i) const
Definition: iterator_range.h:357
IteratorRange::it_begin
const IteratorOverIterators it_begin
Definition: iterator_range.h:189
BaseIterator
IteratorRange::IteratorRange
IteratorRange()
Definition: iterator_range.h:373
TransposeTableIterators::Iterator
MatrixTableIterators::Iterator< TransposeTable< T >, Constness, MatrixTableIterators::Storage::column_major > Iterator
Definition: table.h:1913
TrilinosWrappers::internal::begin
VectorType::value_type * begin(VectorType &V)
Definition: trilinos_sparse_matrix.cc:51
IteratorRange
Definition: iterator_range.h:129
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
IteratorOverIterators::difference_type
typename Iterator::difference_type difference_type
Definition: iterator_range.h:275
Physics::Elasticity::Kinematics::b
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
IteratorOverIterators::operator->
const BaseIterator * operator->() const
Definition: iterator_range.h:326
IteratorOverIterators::pointer
Iterator * pointer
Definition: iterator_range.h:276
IteratorOverIterators::reference
Iterator & reference
Definition: iterator_range.h:277
TrilinosWrappers::internal::end
VectorType::value_type * end(VectorType &V)
Definition: trilinos_sparse_matrix.cc:65
IteratorOverIterators::IteratorOverIterators
IteratorOverIterators(const BaseIterator &iterator)
Definition: iterator_range.h:308
IteratorOverIterators::value_type
Iterator value_type
Definition: iterator_range.h:274
IteratorOverIterators::iterator_category
std::forward_iterator_tag iterator_category
Definition: iterator_range.h:273
IteratorRange::begin
IteratorOverIterators begin()
Definition: iterator_range.h:390
template_constraints.h
config.h
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
make_iterator_range
IteratorRange< BaseIterator > make_iterator_range(const BaseIterator &begin, const typename identity< BaseIterator >::type &end)
Definition: iterator_range.h:296
IteratorOverIterators::BaseIterator
Iterator BaseIterator
Definition: iterator_range.h:207
IteratorRange::end
IteratorOverIterators end() const
Definition: iterator_range.h:406
IteratorOverIterators::element_of_iterator_collection
BaseIterator element_of_iterator_collection
Definition: iterator_range.h:283
IteratorOverIterators::operator++
IteratorOverIterators & operator++()
Definition: iterator_range.h:335
IteratorOverIterators::operator*
const BaseIterator & operator*() const
Definition: iterator_range.h:317