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