/usr/include/dune/grid/geometrygrid/intersectioniterator.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 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | #ifndef DUNE_GEOGRID_INTERSECTIONITERATOR_HH
#define DUNE_GEOGRID_INTERSECTIONITERATOR_HH
#include <dune/grid/geometrygrid/entitypointer.hh>
#include <dune/grid/geometrygrid/intersection.hh>
namespace Dune
{
// External Forward Declataions
// ----------------------------
namespace GeoGrid
{
// Internal Forward Declarations
// -----------------------------
template< class Grid >
class LeafIntersectionIterator;
template< class Grid >
class LevelIntersectionIterator;
// IntersectionIterator
// --------------------
template< class Traits >
class IntersectionIterator
{
typedef typename Traits::HostIntersectionIterator HostIntersectionIterator;
typedef typename Traits::GridTraits GridTraits;
public:
typedef typename Traits::Intersection Intersection;
typedef typename GridTraits::Grid Grid;
typedef typename GridTraits::template Codim< 0 >::EntityPointer EntityPointer;
private:
typedef typename Traits::IntersectionImpl IntersectionImpl;
typedef typename GridTraits::template Codim< 0 >::EntityPointerImpl EntityPointerImpl;
typedef typename GridTraits::template Codim< 0 >::Geometry ElementGeometry;
public:
template< class Entity >
IntersectionIterator ( const Entity &inside,
const HostIntersectionIterator &hostIterator )
: hostIterator_( hostIterator ),
intersection_( IntersectionImpl( inside.geometry() ) )
{}
IntersectionIterator ( const IntersectionIterator &other )
: hostIterator_( other.hostIterator_ ),
intersection_( IntersectionImpl( Grid::getRealImplementation( other.intersection_ ) ) )
{}
IntersectionIterator &operator= ( const IntersectionIterator &other )
{
hostIterator_ = other.hostIterator_;
Grid::getRealImplementation( intersection_ ) = Grid::getRealImplementation( other.intersection_ );
return *this;
}
bool equals ( const IntersectionIterator &other ) const
{
return (hostIterator_ == other.hostIterator_);
}
void increment ()
{
++hostIterator_;
intersectionImpl().invalidate();
}
const Intersection &dereference () const
{
if( !intersectionImpl() )
intersectionImpl().initialize( *hostIterator_ );
return intersection_;
}
private:
IntersectionImpl &intersectionImpl () const
{
return Grid::getRealImplementation( intersection_ );
}
HostIntersectionIterator hostIterator_;
mutable Intersection intersection_;
};
// LeafIntersectionIteratorTraits
// ------------------------------
template< class Grid >
struct LeafIntersectionIteratorTraits
{
typedef typename remove_const< Grid >::type::Traits GridTraits;
typedef typename GridTraits::LeafIntersection Intersection;
typedef LeafIntersection< const Grid > IntersectionImpl;
typedef typename GridTraits::HostGrid::Traits::LeafIntersectionIterator
HostIntersectionIterator;
};
// LeafIntersectionIterator
// ------------------------
template< class Grid >
class LeafIntersectionIterator
: public IntersectionIterator< LeafIntersectionIteratorTraits< Grid > >
{
typedef LeafIntersectionIteratorTraits< Grid > Traits;
typedef IntersectionIterator< Traits > Base;
typedef typename Traits :: HostIntersectionIterator HostIntersectionIterator;
public:
typedef typename Traits :: Intersection Intersection;
public:
template< class Entity >
LeafIntersectionIterator ( const Entity &inside,
const HostIntersectionIterator &hostIterator )
: Base( inside, hostIterator )
{}
};
// LevelIntersectionIteratorTraits
// -------------------------------
template< class Grid >
struct LevelIntersectionIteratorTraits
{
typedef typename remove_const< Grid >::type::Traits GridTraits;
typedef typename GridTraits::LevelIntersection Intersection;
typedef LevelIntersection< const Grid > IntersectionImpl;
typedef typename GridTraits::HostGrid::Traits::LevelIntersectionIterator
HostIntersectionIterator;
};
// LevelIntersectionIterator
// -------------------------
template< class Grid >
class LevelIntersectionIterator
: public IntersectionIterator< LevelIntersectionIteratorTraits< Grid > >
{
typedef LevelIntersectionIteratorTraits< Grid > Traits;
typedef IntersectionIterator< Traits > Base;
typedef typename Traits :: HostIntersectionIterator HostIntersectionIterator;
public:
typedef typename Traits :: Intersection Intersection;
public:
template< class Entity >
LevelIntersectionIterator ( const Entity &inside,
const HostIntersectionIterator &hostIterator )
: Base( inside, hostIterator )
{}
};
} // namespace GeoGrid
} // namespace Dune
#endif // #ifndef DUNE_GEOGRID_INTERSECTIONITERATOR_HH
|