/usr/include/dune/grid/uggrid/uggridintersectioniterators.hh is in libdune-grid-dev 2.2.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | #ifndef DUNE_UGINTERSECTIONIT_HH
#define DUNE_UGINTERSECTIONIT_HH
/** \file
* \brief The UGGridIntersectionIterator class
*/
namespace Dune {
/** \brief Implementation of the UGGrid LevelIntersectionIterator
*/
template<class GridImp>
class UGGridLevelIntersectionIterator
{
enum {dim=GridImp::dimension};
friend class UGGridEntity<0,dim,GridImp>;
public:
typedef Dune::Intersection<const GridImp, Dune::UGGridLevelIntersection> Intersection;
/** The default Constructor makes empty Iterator
*/
UGGridLevelIntersectionIterator(typename UG_NS<dim>::Element* center, int nb, const GridImp* gridImp)
: intersection_(UGGridLevelIntersection<GridImp>(center,nb,gridImp))
{}
//! equality
bool equals(const UGGridLevelIntersectionIterator<GridImp>& other) const {
return GridImp::getRealImplementation(intersection_).equals(GridImp::getRealImplementation(other.intersection_));
}
//! prefix increment
void increment() {
GridImp::getRealImplementation(intersection_).neighborCount_++;
GridImp::getRealImplementation(intersection_).geometryIsUpToDate_ = false;
GridImp::getRealImplementation(intersection_).geometryInInsideIsUpToDate_ = false;
GridImp::getRealImplementation(intersection_).geometryInOutsideIsUpToDate_ = false;
}
//! \brief dereferencing
const Intersection & dereference() const {
return intersection_;
}
private:
mutable MakeableInterfaceObject<Intersection> intersection_;
};
/** \brief Implementation of the UGGrid LeafIntersectionIterator
*/
template<class GridImp>
class UGGridLeafIntersectionIterator
{
enum {dim=GridImp::dimension};
friend class UGGridEntity<0,dim,GridImp>;
public:
typedef Dune::Intersection<const GridImp, Dune::UGGridLeafIntersection> Intersection;
UGGridLeafIntersectionIterator(typename UG_NS<dim>::Element* center, int nb, const GridImp* gridImp)
: intersection_(UGGridLeafIntersection<GridImp>(center,nb,gridImp))
{}
//! equality
bool equals(const UGGridLeafIntersectionIterator<GridImp>& other) const {
return GridImp::getRealImplementation(intersection_).equals(GridImp::getRealImplementation(other.intersection_));
}
/** \brief Prefix increment.
The UG data structure does not directly contain information about leaf neighbors/intersections.
Therefore getting that information is fairly expensive. In particular, it is too expensive to
start looking for the next intersection whenever 'increment()' is called. Therefore, all
intersections of one face of the 'inside' element are precomputed, and incrementing then traverses
this precomputed list. If the list is exhausted the iterator advances to the next faces
and precomputes all intersections there.
*/
void increment() {
UGGridLeafIntersection<GridImp>& intersectionImp = GridImp::getRealImplementation(intersection_);
intersectionImp.subNeighborCount_++;
// are there no more intersections for the current element face?
if (intersectionImp.subNeighborCount_ >= intersectionImp.leafSubFaces_.size() ) {
// move to the next face
intersectionImp.neighborCount_++;
intersectionImp.subNeighborCount_ = 0;
// if the next face is not the end iterator construct all intersections for it
if (intersectionImp.neighborCount_ < UG_NS<dim>::Sides_Of_Elem(intersectionImp.center_))
intersectionImp.constructLeafSubfaces();
}
// make sure geometries are not taken from the cache the next time
// the geometry{|InInside|InOutside} methods are called.
intersectionImp.geometryIsUpToDate_ = false;
intersectionImp.geometryInInsideIsUpToDate_ = false;
intersectionImp.geometryInOutsideIsUpToDate_ = false;
}
//! \brief dereferencing
const Intersection & dereference() const {
return intersection_;
}
private:
mutable MakeableInterfaceObject<Intersection> intersection_;
};
} // namespace Dune
#endif
|