10
/** \brief Implementation of the UGGrid LevelIntersectionIterator
12
template<class GridImp>
13
class UGGridLevelIntersectionIterator
12
/** \brief Implementation of the UGGrid LevelIntersectionIterator
14
template<class GridImp>
15
class UGGridLevelIntersectionIterator
16
18
enum {dim=GridImp::dimension};
18
20
friend class UGGridEntity<0,dim,GridImp>;
22
typedef Dune::Intersection<const GridImp, Dune::UGGridLevelIntersection> Intersection;
24
/** The default Constructor makes empty Iterator
23
typedef Dune::Intersection< GridImp, Dune::UGGridLevelIntersection< GridImp > > Intersection;
25
/** The default Constructor makes empty Iterator
26
27
UGGridLevelIntersectionIterator(typename UG_NS<dim>::Element* center, int nb, const GridImp* gridImp)
27
: intersection_(UGGridLevelIntersection<GridImp>(center,nb,gridImp))
28
: intersection_(UGGridLevelIntersection<GridImp>(center,nb,gridImp))
31
32
bool equals(const UGGridLevelIntersectionIterator<GridImp>& other) const {
32
return GridImp::getRealImplementation(intersection_).equals(GridImp::getRealImplementation(other.intersection_));
33
return GridImp::getRealImplementation(intersection_).equals(GridImp::getRealImplementation(other.intersection_));
35
36
//! prefix increment
37
GridImp::getRealImplementation(intersection_).neighborCount_++;
38
GridImp::getRealImplementation(intersection_).neighborCount_++;
39
GridImp::getRealImplementation(intersection_).geometryIsUpToDate_ = false;
40
GridImp::getRealImplementation(intersection_).geometryInInsideIsUpToDate_ = false;
41
GridImp::getRealImplementation(intersection_).geometryInOutsideIsUpToDate_ = false;
40
GridImp::getRealImplementation(intersection_).geometry_.reset();
41
GridImp::getRealImplementation(intersection_).geometryInInside_.reset();
42
GridImp::getRealImplementation(intersection_).geometryInOutside_.reset();
44
45
//! \brief dereferencing
45
46
const Intersection & dereference() const {
51
52
mutable MakeableInterfaceObject<Intersection> intersection_;
56
/** \brief Implementation of the UGGrid LeafIntersectionIterator
58
template<class GridImp>
59
class UGGridLeafIntersectionIterator
57
/** \brief Implementation of the UGGrid LeafIntersectionIterator
59
template<class GridImp>
60
class UGGridLeafIntersectionIterator
62
63
enum {dim=GridImp::dimension};
64
65
friend class UGGridEntity<0,dim,GridImp>;
68
typedef Dune::Intersection<const GridImp, Dune::UGGridLeafIntersection> Intersection;
69
typedef Dune::Intersection< GridImp, Dune::UGGridLeafIntersection< GridImp > > Intersection;
70
71
UGGridLeafIntersectionIterator(typename UG_NS<dim>::Element* center, int nb, const GridImp* gridImp)
71
: intersection_(UGGridLeafIntersection<GridImp>(center,nb,gridImp))
72
: intersection_(UGGridLeafIntersection<GridImp>(center,nb,gridImp))
75
76
bool equals(const UGGridLeafIntersectionIterator<GridImp>& other) const {
76
return GridImp::getRealImplementation(intersection_).equals(GridImp::getRealImplementation(other.intersection_));
77
return GridImp::getRealImplementation(intersection_).equals(GridImp::getRealImplementation(other.intersection_));
79
80
/** \brief Prefix increment.
81
The UG data structure does not directly contain information about leaf neighbors/intersections.
82
Therefore getting that information is fairly expensive. In particular, it is too expensive to
83
start looking for the next intersection whenever 'increment()' is called. Therefore, all
84
intersections of one face of the 'inside' element are precomputed, and incrementing then traverses
85
this precomputed list. If the list is exhausted the iterator advances to the next faces
86
and precomputes all intersections there.
82
The UG data structure does not directly contain information about leaf neighbors/intersections.
83
Therefore getting that information is fairly expensive. In particular, it is too expensive to
84
start looking for the next intersection whenever 'increment()' is called. Therefore, all
85
intersections of one face of the 'inside' element are precomputed, and incrementing then traverses
86
this precomputed list. If the list is exhausted the iterator advances to the next faces
87
and precomputes all intersections there.
90
UGGridLeafIntersection<GridImp>& intersectionImp = GridImp::getRealImplementation(intersection_);
92
intersectionImp.subNeighborCount_++;
94
// are there no more intersections for the current element face?
95
if (intersectionImp.subNeighborCount_ >= intersectionImp.leafSubFaces_.size() ) {
97
// move to the next face
98
intersectionImp.neighborCount_++;
99
intersectionImp.subNeighborCount_ = 0;
101
// if the next face is not the end iterator construct all intersections for it
102
if (intersectionImp.neighborCount_ < UG_NS<dim>::Sides_Of_Elem(intersectionImp.center_))
103
intersectionImp.constructLeafSubfaces();
107
// make sure geometries are not taken from the cache the next time
108
// the geometry{|InInside|InOutside} methods are called.
109
intersectionImp.geometryIsUpToDate_ = false;
110
intersectionImp.geometryInInsideIsUpToDate_ = false;
111
intersectionImp.geometryInOutsideIsUpToDate_ = false;
91
UGGridLeafIntersection<GridImp>& intersectionImp = GridImp::getRealImplementation(intersection_);
93
intersectionImp.subNeighborCount_++;
95
// are there no more intersections for the current element face?
96
if (intersectionImp.subNeighborCount_ >= intersectionImp.leafSubFaces_.size() ) {
98
// move to the next face
99
intersectionImp.neighborCount_++;
100
intersectionImp.subNeighborCount_ = 0;
102
// if the next face is not the end iterator construct all intersections for it
103
if (intersectionImp.neighborCount_ < UG_NS<dim>::Sides_Of_Elem(intersectionImp.center_))
104
intersectionImp.constructLeafSubfaces();
108
// make sure geometries are not taken from the cache the next time
109
// the geometry{|InInside|InOutside} methods are called.
110
intersectionImp.geometry_.reset();
111
intersectionImp.geometryInInside_.reset();
112
intersectionImp.geometryInOutside_.reset();
114
115
//! \brief dereferencing
115
116
const Intersection & dereference() const {
116
return intersection_;
117
return intersection_;
121
122
mutable MakeableInterfaceObject<Intersection> intersection_;
125
126
} // namespace Dune