dune-grid-glue  2.9
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 // SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
4 // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-GPL-2.0-only-with-dune-grid-glue-exception
12 #ifndef DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH
13 #define DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH
14 
16 
17 namespace Dune {
18  namespace GridGlue {
19 
21  template<typename P0, typename P1, int inside, int outside>
23  public Dune::ForwardIteratorFacade< IntersectionIterator<P0,P1,inside,outside>,
24  const Intersection<P0,P1,inside,outside> >
25  {
26  public:
27 
28  typedef ::Dune::GridGlue::GridGlue<P0, P1> GridGlue;
29  typedef ::Dune::GridGlue::Intersection<P0,P1,inside,outside> Intersection;
30 
31  IntersectionIterator(const GridGlue * glue, unsigned int i)
32  : glue_(glue),
33  index_(i),
34  intersection_(glue_, & glue_->intersections_[index_])
35  {}
36 
37  const Intersection& dereference() const
38  {
39  assert(("never dereference the end iterator" &&
40  index_ != glue_->index__sz));
41  return intersection_;
42  }
43 
44  void increment()
45  {
46  intersection_ = Intersection(glue_, & glue_->intersections_[++index_]);
47  }
48 
49  bool equals(const IntersectionIterator& iter) const
50  {
51  return iter.index_ == index_;
52  }
53 
54  private:
55 
56  const GridGlue* glue_;
57  unsigned int index_;
58 
59  Intersection intersection_;
60  };
61 
62  } // end namespace GridGlue
63 } // end namespace Dune
64 
65 #endif // DUNE_GRIDGLUE_ADAPTER_INTERSECTIONITERATOR_HH
Central component of the module implementing the coupling of two grids.
Definition: gridglue.hh:37
sequential adapter to couple two grids at specified close together boundaries
Definition: gridglue.hh:54
Definition: intersectioniterator.hh:25
::Dune::GridGlue::GridGlue< P0, P1 > GridGlue
Definition: intersectioniterator.hh:28
void increment()
Definition: intersectioniterator.hh:44
::Dune::GridGlue::Intersection< P0, P1, inside, outside > Intersection
Definition: intersectioniterator.hh:29
IntersectionIterator(const GridGlue *glue, unsigned int i)
Definition: intersectioniterator.hh:31
const Intersection & dereference() const
Definition: intersectioniterator.hh:37
bool equals(const IntersectionIterator &iter) const
Definition: intersectioniterator.hh:49