dune-grid-glue  2.3.0
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:
10 #ifndef DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH
11 #define DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH
12 
14 
15 namespace Dune {
16  namespace GridGlue {
17 
19  template<typename P0, typename P1, int inside, int outside>
20  class IntersectionIterator :
21  public Dune::ForwardIteratorFacade< IntersectionIterator<P0,P1,inside,outside>,
22  const Intersection<P0,P1,inside,outside> >
23  {
24  public:
25 
26  typedef ::Dune::GridGlue::GridGlue<P0, P1> GridGlue;
27  typedef ::Dune::GridGlue::Intersection<P0,P1,inside,outside> Intersection;
28 
29  IntersectionIterator(const GridGlue * glue, unsigned int i)
30  : glue_(glue),
31  index_(i),
32  intersection_(glue_, & glue_->intersections_[index_])
33  {}
34 
35  const Intersection& dereference() const
36  {
37  assert(("never dereference the end iterator" &&
38  index_ != glue_->index__sz));
39  return intersection_;
40  }
41 
42  void increment()
43  {
44  intersection_ = Intersection(glue_, & glue_->intersections_[++index_]);
45  }
46 
47  bool equals(const IntersectionIterator& iter) const
48  {
49  return iter.index_ == index_;
50  }
51 
52  private:
53 
54  const GridGlue* glue_;
55  unsigned int index_;
56 
57  Intersection intersection_;
58  };
59 
60  } // end namespace GridGlue
61 } // end namespace Dune
62 
63 #endif // DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH
void increment()
Definition: intersectioniterator.hh:42
Definition: gridglue.hh:34
Central component of the module implementing the coupling of two grids.
::Dune::GridGlue::Intersection< P0, P1, inside, outside > Intersection
Definition: intersectioniterator.hh:27
IntersectionIterator(const GridGlue *glue, unsigned int i)
Definition: intersectioniterator.hh:29
bool equals(const IntersectionIterator &iter) const
Definition: intersectioniterator.hh:47
Definition: gridglue.hh:54
const Intersection & dereference() const
Definition: intersectioniterator.hh:35
::Dune::GridGlue::GridGlue< P0, P1 > GridGlue
Definition: intersectioniterator.hh:26