dune-grid  2.6-git
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 >
24  class AlbertaGridLeafIntersectionIterator
25  {
26  typedef AlbertaGridLeafIntersectionIterator< GridImp > This;
27 
28  public:
30 
31  static const int dimension = Intersection::Entity::dimension;
32 
33  struct Begin {};
34  struct End {};
35 
36  private:
38 
39  public:
41  {}
42 
43  template< class EntityImp >
44  AlbertaGridLeafIntersectionIterator ( const EntityImp &entity, Begin )
45  : intersection_( IntersectionImp( entity, 0 ) )
46  {}
47 
48  template< class EntityImp >
49  AlbertaGridLeafIntersectionIterator ( const EntityImp &entity, End )
50  : intersection_( IntersectionImp( entity, dimension+1 ) )
51  {}
52 
54  : intersection_( other.intersectionImp() )
55  {}
56 
57  This &operator= ( const This &other )
58  {
59  intersectionImp() = other.intersectionImp();
60  return *this;
61  }
62 
63  const Intersection &dereference () const
64  {
65  return intersection_;
66  }
67 
68  bool equals ( const This &other ) const
69  {
70  return (intersectionImp() == other.intersectionImp());
71  }
72 
73  void increment ()
74  {
75  intersectionImp().next();
76  }
77 
78  private:
79  const IntersectionImp &intersectionImp () const
80  {
81  return GridImp::getRealImplementation( intersection_ );
82  }
83 
84  IntersectionImp &intersectionImp ()
85  {
86  return GridImp::getRealImplementation( intersection_ );
87  }
88 
89  Intersection intersection_;
90  };
91 
92 }
93 
94 #endif // #if HAVE_ALBERTA
95 
96 #endif // #ifndef DUNE_ALBERTA_INTERSECTIONITERATOR_HH
AlbertaGridLeafIntersectionIterator()
Definition: albertagrid/intersectioniterator.hh:40
Include standard header files.
Definition: agrid.hh:58
Intersection of a mesh entity of codimension 0 ("element") with a "neighboring" element or with the d...
Definition: albertagrid/dgfparser.hh:26
This & operator=(const This &other)
Definition: albertagrid/intersectioniterator.hh:57
AlbertaGridLeafIntersectionIterator(const EntityImp &entity, End)
Definition: albertagrid/intersectioniterator.hh:49
Definition: albertagrid/entity.hh:27
Definition: albertagrid/intersectioniterator.hh:34
AlbertaGridLeafIntersectionIterator(const This &other)
Definition: albertagrid/intersectioniterator.hh:53
static const int dimension
Definition: albertagrid/intersectioniterator.hh:31
Definition: albertagrid/intersectioniterator.hh:33
void increment()
Definition: albertagrid/intersectioniterator.hh:73
Dune::Intersection< GridImp, AlbertaGridLeafIntersection< GridImp > > Intersection
Definition: albertagrid/intersectioniterator.hh:29
AlbertaGridLeafIntersectionIterator(const EntityImp &entity, Begin)
Definition: albertagrid/intersectioniterator.hh:44
bool equals(const This &other) const
Definition: albertagrid/intersectioniterator.hh:68
const Intersection & dereference() const
Definition: albertagrid/intersectioniterator.hh:63