Dune Core Modules (2.6.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:
3 #ifndef DUNE_ALBERTA_INTERSECTIONITERATOR_HH
4 #define DUNE_ALBERTA_INTERSECTIONITERATOR_HH
5 
6 #include <dune/grid/common/intersectioniterator.hh>
7 
8 #include <dune/grid/albertagrid/intersection.hh>
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:
37  typedef AlbertaGridLeafIntersection< GridImp > IntersectionImp;
38 
39  public:
40  AlbertaGridLeafIntersectionIterator ()
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 
53  AlbertaGridLeafIntersectionIterator ( const This &other )
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
Intersection of a mesh entity of codimension 0 ("element") with a "neighboring" element or with the d...
Definition: intersection.hh:162
constexpr auto equals(T1 &&t1, T2 &&t2)
Equality comparison.
Definition: hybridutilities.hh:435
Dune namespace.
Definition: alignedallocator.hh:10
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (May 16, 22:29, 2024)