dune-fem  2.8-git
geogridpart/intersectioniterator.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_GRIDPART_GEOGRIDPART_INTERSECTIONITERATOR_HH
2 #define DUNE_FEM_GRIDPART_GEOGRIDPART_INTERSECTIONITERATOR_HH
3 
4 #include <type_traits>
5 #include <utility>
6 
7 #include <dune/grid/common/intersectioniterator.hh>
8 
10 
11 namespace Dune
12 {
13 
14  namespace Fem
15  {
16 
17  // GeoIntersectionIterator
18  // -----------------------
19 
20  template< class GridFamily >
22  {
24 
25  typedef typename std::remove_const< GridFamily >::type::Traits Traits;
26 
27  typedef typename Traits::CoordFunctionType CoordFunctionType;
28  typedef typename Traits::template Codim< 0 >::Geometry ElementGeometryType;
29  typedef typename Traits::HostGridPartType::IntersectionIteratorType HostIntersectionIteratorType;
30 
32 
33  public:
34  typedef Dune::Intersection< const GridFamily, IntersectionImplType > Intersection;
35 
37 
38  template< class Entity >
39  GeoIntersectionIterator ( const Entity &inside,
40  HostIntersectionIteratorType hostIterator )
41  : coordFunction_( &inside.impl().coordFunction() ),
42  insideGeo_( inside.geometry() ),
43  hostIterator_( std::move( hostIterator ) )
44  {}
45 
46  bool equals ( const ThisType &other ) const
47  {
48  return hostIterator_ == other.hostIterator_;
49  }
50 
51  void increment ()
52  {
53  ++hostIterator_;
54  }
55 
57  {
58  return IntersectionImplType( coordFunction(), insideGeo_, *hostIterator_ );
59  }
60 
61  const CoordFunctionType &coordFunction () const
62  {
63  assert( coordFunction_ );
64  return *coordFunction_;
65  }
66 
67  private:
68  const CoordFunctionType *coordFunction_ = nullptr;
69  ElementGeometryType insideGeo_;
70  HostIntersectionIteratorType hostIterator_;
71  };
72 
73  } // namespace Fem
74 
75 } // namespace Dune
76 
77 #endif // #ifndef DUNE_FEM_GRIDPART_GEOGRIDPART_INTERSECTIONITERATOR_HH
Definition: bindguard.hh:11
Definition: geogridpart/intersection.hh:20
Definition: geogridpart/intersectioniterator.hh:22
GeoIntersectionIterator(const Entity &inside, HostIntersectionIteratorType hostIterator)
Definition: geogridpart/intersectioniterator.hh:39
Dune::Intersection< const GridFamily, IntersectionImplType > Intersection
Definition: geogridpart/intersectioniterator.hh:34
const CoordFunctionType & coordFunction() const
Definition: geogridpart/intersectioniterator.hh:61
Intersection dereference() const
Definition: geogridpart/intersectioniterator.hh:56
void increment()
Definition: geogridpart/intersectioniterator.hh:51
bool equals(const ThisType &other) const
Definition: geogridpart/intersectioniterator.hh:46