dune-grid  2.2.1
common/intersectioniterator.hh
Go to the documentation of this file.
1 #ifndef DUNE_GRID_INTERSECTIONITERATOR_HH
2 #define DUNE_GRID_INTERSECTIONITERATOR_HH
3 
4 #include <dune/common/iteratorfacades.hh>
5 
7 
8 namespace Dune
9 {
10 
87 template<class GridImp, template<class> class IntersectionIteratorImp, template<class> class IntersectionImp>
89 {
90 #if DUNE_GRID_EXPERIMENTAL_GRID_EXTENSIONS
91 public:
92 #else
93 protected:
94  // give the GridDefaultImplementation class access to the realImp
95  friend class GridDefaultImplementation<
96  GridImp::dimension, GridImp::dimensionworld,
97  typename GridImp::ctype,
98  typename GridImp::GridFamily> ;
99 #endif
100  // type of underlying implementation, for internal use only
101  typedef IntersectionIteratorImp< const GridImp > Implementation;
102 
106  const Implementation &impl () const { return realIterator; }
107 
108 protected:
110 
111 public:
114 
115  //===========================================================
119  //===========================================================
120 
122  const Intersection & operator*() const
123  {
124  return this->realIterator.dereference();
125  }
126 
128  const Intersection * operator->() const
129  {
130  return & this->realIterator.dereference();
131  }
133 
134 
135  //===========================================================
139  //===========================================================
140 
146  bool operator==(const IntersectionIterator& rhs) const
147  {
148  return rhs.equals(*this);
149  }
150 
156  bool operator!=(const IntersectionIterator& rhs) const
157  {
158  return ! rhs.equals(*this);
159  }
161 
164  {
165  this->realIterator.increment();
166  return *this;
167  }
168 
169  //===========================================================
173  //===========================================================
174 
176  bool equals(const IntersectionIterator& rhs) const
177  {
178  return this->realIterator.equals(rhs.realIterator);
179  }
180 
182  IntersectionIterator(const IntersectionIteratorImp<const GridImp> & i) :
183  realIterator(i) {}
184 
189 
190  typedef typename remove_const<GridImp>::type mutableGridImp;
191 };
192 
193 } // namespace Dune
194 
195 #include "intersection.hh"
196 
197 #endif // DUNE_GRID_INTERSECTIONITERATOR_HH