dune-grid-dev-howto  2.2.0
identitygridintersectioniterator.hh
Go to the documentation of this file.
1 #ifndef DUNE_IDENTITYGRID_INTERSECTIONITERATOR_HH
2 #define DUNE_IDENTITYGRID_INTERSECTIONITERATOR_HH
3 
5 #include "identitygridentity.hh"
6 
7 #include <dune/grid/common/intersection.hh>
8 
13 namespace Dune {
14 
23 template<class GridImp>
25 {
26 
27  enum {dim=GridImp::dimension};
28 
29  enum {dimworld=GridImp::dimensionworld};
30 
31  // The type used to store coordinates
32  typedef typename GridImp::ctype ctype;
33 
34  typedef typename GridImp::HostGridType::template Codim<0>::Entity::LeafIntersectionIterator HostLeafIntersectionIterator;
35 
36 public:
37 
38  typedef Dune::Intersection<const GridImp, Dune::IdentityGridLeafIntersection> Intersection;
39 
40  IdentityGridLeafIntersectionIterator(const GridImp* identityGrid,
41  const HostLeafIntersectionIterator& hostIterator)
42  : intersection_(IdentityGridLeafIntersection<GridImp>(identityGrid, hostIterator))
43  {}
44 
47 
50  return GridImp::getRealImplementation(intersection_).hostIterator_
51  == GridImp::getRealImplementation(other.intersection_).hostIterator_;
52  }
53 
54 
56  void increment() {
57  ++GridImp::getRealImplementation(intersection_).hostIterator_;
58  }
59 
61  const Intersection & dereference() const {
62  return intersection_;
63  }
64 
65 private:
66  //**********************************************************
67  // private data
68  //**********************************************************
69 
72  mutable MakeableInterfaceObject<Intersection> intersection_;
73 };
74 
75 
76 
77 
79 template<class GridImp>
81 {
82  enum {dim=GridImp::dimension};
83 
84  enum {dimworld=GridImp::dimensionworld};
85 
86  // The type used to store coordinates
87  typedef typename GridImp::ctype ctype;
88 
89  typedef typename GridImp::HostGridType::template Codim<0>::Entity::LevelIntersectionIterator HostLevelIntersectionIterator;
90 
91  public:
92 
93  typedef Dune::Intersection<const GridImp, Dune::IdentityGridLevelIntersection> Intersection;
94 
95  IdentityGridLevelIntersectionIterator(const GridImp* identityGrid,
96  const HostLevelIntersectionIterator& hostIterator)
97  : intersection_(IdentityGridLevelIntersection<GridImp>(identityGrid,hostIterator))
98  {}
99 
102  return GridImp::getRealImplementation(intersection_).hostIterator_ == GridImp::getRealImplementation(other.intersection_).hostIterator_;
103  }
104 
105 
107  void increment() {
108  ++GridImp::getRealImplementation(intersection_).hostIterator_;
109  }
110 
112  const Intersection & dereference() const {
113  return intersection_;
114  }
115 
116 private:
117 
120  mutable MakeableInterfaceObject<Intersection> intersection_;
121 
122 };
123 
124 
125 } // namespace Dune
126 
127 #endif