Loading [MathJax]/extensions/tex2jax.js

DUNE MultiDomainGrid (2.9)

iterator.hh
1#ifndef DUNE_GRID_MULTIDOMAINGRID_ITERATOR_HH
2#define DUNE_GRID_MULTIDOMAINGRID_ITERATOR_HH
3
4#include <utility>
5
6#include <dune/grid/common/gridenums.hh>
7
8#include "entity.hh"
9
10namespace Dune {
11
12namespace mdgrid {
13
14template<int codim, int dim, typename GridImp>
15class EntityWrapper;
16
17template<typename HostGridView, int codim, PartitionIteratorType pitype, typename GridImp>
18class IteratorWrapper
19{
20
21 template<typename, typename>
22 friend class MultiDomainGrid;
23
24 template< int cd, class Grid, class IteratorImp >
25 friend class Dune::EntityIterator;
26
27 static const int codimension = codim;
28
29 using HostIterator = typename HostGridView::template Codim<codim>::template Partition<pitype>::Iterator;
30
31public:
32
33 // Entity must be public for iterator traits
34 using Entity = typename GridImp::template Codim<codim>::Entity;
35
36private:
37 using EntityWrapper = Dune::mdgrid::EntityWrapper<codim,GridImp::dimension,GridImp>;
38
39 IteratorWrapper() = default;
40
41 explicit IteratorWrapper(const HostIterator& hostIterator)
42 : _hostIterator(hostIterator)
43 {}
44
45 explicit IteratorWrapper(HostIterator&& hostIterator)
46 : _hostIterator(std::move(hostIterator))
47 {}
48
49 void increment() {
50 ++_hostIterator;
51 }
52
53 bool equals(const IteratorWrapper& r) const
54 {
55 return _hostIterator == r._hostIterator;
56 }
57
58 Entity dereference() const
59 {
60 return {EntityWrapper(*_hostIterator)};
61 }
62
63 int level() const
64 {
65 return _hostIterator.level();
66 }
67
68public:
69
70private:
71
72 HostIterator _hostIterator;
73
74};
75
76} // namespace mdgrid
77
78} // namespace Dune
79
80#endif // DUNE_GRID_MULTIDOMAINGRID_ITERATOR_HH
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden & Uni Heidelberg  |  generated with Hugo v0.111.3 (Apr 6, 22:49, 2025)