Dune Core Modules (unstable)

intersectioniterator.hh
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
2 // SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
3 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4 // vi: set et ts=4 sw=2 sts=2:
5 #ifndef DUNE_ALBERTA_INTERSECTIONITERATOR_HH
6 #define DUNE_ALBERTA_INTERSECTIONITERATOR_HH
7 
8 #include <dune/grid/common/intersectioniterator.hh>
9 
10 #include <dune/grid/albertagrid/intersection.hh>
11 
17 #if HAVE_ALBERTA
18 
19 namespace Dune
20 {
21 
22  // AlbertaGridLeafIntersectionIterator
23  // -----------------------------------
24 
25  template< class GridImp >
26  class AlbertaGridLeafIntersectionIterator
27  {
28  typedef AlbertaGridLeafIntersectionIterator< GridImp > This;
29 
30  public:
32 
33  static const int dimension = Intersection::Entity::dimension;
34 
35  struct Begin {};
36  struct End {};
37 
38  private:
39  typedef AlbertaGridLeafIntersection< GridImp > IntersectionImp;
40 
41  public:
42  AlbertaGridLeafIntersectionIterator ()
43  {}
44 
45  template< class EntityImp >
46  AlbertaGridLeafIntersectionIterator ( const EntityImp &entity, Begin )
47  : intersection_( IntersectionImp( entity, 0 ) )
48  {}
49 
50  template< class EntityImp >
51  AlbertaGridLeafIntersectionIterator ( const EntityImp &entity, End )
52  : intersection_( IntersectionImp( entity, dimension+1 ) )
53  {}
54 
55  AlbertaGridLeafIntersectionIterator ( const This &other )
56  : intersection_( other.intersection_.impl() )
57  {}
58 
59  This &operator= ( const This &other )
60  {
61  intersection_.impl() = other.intersection_.impl();
62  return *this;
63  }
64 
65  const Intersection &dereference () const
66  {
67  return intersection_;
68  }
69 
70  bool equals ( const This &other ) const
71  {
72  return (intersection_.impl() == other.intersection_.impl());
73  }
74 
75  void increment ()
76  {
77  intersection_.impl().next();
78  }
79 
80  private:
81  Intersection intersection_;
82  };
83 
84 }
85 
86 #endif // #if HAVE_ALBERTA
87 
88 #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:164
concept Intersection
Model of an intersection.
Definition: intersection.hh:23
constexpr auto equals
Function object for performing equality comparison.
Definition: hybridutilities.hh:572
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (May 16, 22:29, 2024)