My Project
intersectioniterator.hh
1// -*- mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=2 sw=2 sts=2:
3#ifndef DUNE_POLYHEDRALGRID_INTERSECTIONITERATOR_HH
4#define DUNE_POLYHEDRALGRID_INTERSECTIONITERATOR_HH
5
6#include <opm/grid/polyhedralgrid/intersection.hh>
7
8namespace Dune
9{
10
11 // PolyhedralGridIntersectionIterator
12 // --------------------------
13
14 template< class Grid >
16 {
17 protected:
19
20 typedef typename Grid::Traits Traits;
21 typedef typename Traits::template Codim<0>::Entity Element;
22 static const bool isLeafIntersection = true;
23
24 public:
25 typedef typename Traits::template Codim<0>::EntitySeed EntitySeed;
26
27 typedef typename std::conditional< isLeafIntersection,
28 typename Traits :: LeafIntersection,
29 typename Traits :: LevelIntersection > :: type Intersection ;
30 typedef typename Intersection :: Implementation IntersectionImpl ;
31
32 typedef typename Traits :: ExtraData ExtraData;
33
34 typedef typename Grid::template Codim< 0 >::EntityPointer EntityPointer;
35
36 PolyhedralGridIntersectionIterator ( ExtraData data, const EntitySeed& seed, bool isBegin )
37 : intersection_( IntersectionImpl( data, seed, isBegin?0:data->subEntities(seed, 1) ) )
38 {}
39
41 : intersection_( IntersectionImpl( other.intersectionImpl()) )
42 {}
43
44 PolyhedralGridIntersectionIterator& operator=( const This& other )
45 {
46 intersectionImpl() = other.intersectionImpl();
47 return *this;
48 }
49
50 bool equals ( const This &other ) const
51 {
52 return intersectionImpl().equals( other.intersectionImpl() );
53 }
54
55 void increment ()
56 {
57 ++(intersectionImpl()).intersectionIdx_;
58 }
59
60 const Intersection &dereference () const
61 {
62 return intersection_;
63 }
64
65 ExtraData data() const { return intersectionImpl().data(); }
66
67 protected:
68 IntersectionImpl &intersectionImpl () const
69 {
70 return intersection_.impl();
71 }
72
73 mutable Intersection intersection_;
74 };
75
76} // namespace Dune
77
78#endif // #ifndef DUNE_POLYHEDRALGRID_INTERSECTIONITERATOR_HH
Definition: intersectioniterator.hh:16
Copyright 2019 Equinor AS.
Definition: CartesianIndexMapper.hpp:10