dune-grid  2.2.0
albertagrid/intersectioniterator.hh
Go to the documentation of this file.
1 #ifndef DUNE_ALBERTA_INTERSECTIONITERATOR_HH
2 #define DUNE_ALBERTA_INTERSECTIONITERATOR_HH
3 
5 
7 
13 #if HAVE_ALBERTA
14 
15 namespace Dune
16 {
17 
18  // AlbertaGridLeafIntersectionIterator
19  // -----------------------------------
20 
21  template< class GridImp >
23  {
25 
26  public:
28 
29  static const int dimension = Intersection::dimension;
30 
31  struct Begin {};
32  struct End {};
33 
34  private:
36 
37  public:
38  template< class EntityImp >
39  AlbertaGridLeafIntersectionIterator ( const EntityImp &entity, Begin )
40  : intersection_( IntersectionImp( entity, 0 ) )
41  {}
42 
43  template< class EntityImp >
44  AlbertaGridLeafIntersectionIterator ( const EntityImp &entity, End )
45  : intersection_( IntersectionImp( entity, dimension+1 ) )
46  {}
47 
49  : intersection_( other.intersectionImp() )
50  {}
51 
52  This &operator= ( const This &other )
53  {
54  intersectionImp() = other.intersectionImp();
55  return *this;
56  }
57 
58  const Intersection &dereference () const
59  {
60  return intersection_;
61  }
62 
63  bool equals ( const This &other ) const
64  {
65  return (intersectionImp() == other.intersectionImp());
66  }
67 
68  void increment ()
69  {
70  intersectionImp().next();
71  }
72 
73  private:
74  const IntersectionImp &intersectionImp () const
75  {
76  return GridImp::getRealImplementation( intersection_ );
77  }
78 
79  IntersectionImp &intersectionImp ()
80  {
81  return GridImp::getRealImplementation( intersection_ );
82  }
83 
84  Intersection intersection_;
85  };
86 
87 }
88 
89 #endif // #if HAVE_ALBERTA
90 
91 #endif // #ifndef DUNE_ALBERTA_INTERSECTIONITERATOR_HH