1 #ifndef DUNE_FEM_GRIDPART_IDGRIDPART_INTERSECTIONITERATOR_HH 2 #define DUNE_FEM_GRIDPART_IDGRIDPART_INTERSECTIONITERATOR_HH 3 4 #include <type_traits> 5 #include <utility> 6 7 #include <dune/grid/common/intersectioniterator.hh> 8 9 #include <dune/fem/gridpart/idgridpart/intersection.hh> 10 11 namespace Dune 12 { 13 14 namespace Fem 15 { 16 17 // IdIntersectionIterator 18 // ---------------------- 19 20 template< class GridFamily > 21 class IdIntersectionIterator 22 { 23 typedef IdIntersectionIterator< GridFamily > ThisType; 24 25 typedef typename std::remove_const< GridFamily >::type::Traits Traits; 26 27 typedef typename Traits::HostGridPartType::IntersectionIteratorType HostIntersectionIteratorType; 28 29 typedef IdIntersection< const GridFamily > IntersectionImplType; 30 31 public: 32 typedef Dune::Intersection< const GridFamily, IntersectionImplType > Intersection; 33 typedef typename Traits::ExtraData ExtraData; 34 35 IdIntersectionIterator () = default; 36 IdIntersectionIterator(ExtraData data,HostIntersectionIteratorType hostIterator)37 IdIntersectionIterator ( ExtraData data, HostIntersectionIteratorType hostIterator ) 38 : data_( std::move( data ) ), 39 hostIterator_( std::move( hostIterator ) ) 40 {} 41 equals(const ThisType & other) const42 bool equals ( const ThisType &other ) const 43 { 44 return hostIterator_ == other.hostIterator_; 45 } 46 increment()47 void increment () 48 { 49 ++hostIterator_; 50 } 51 dereference() const52 Intersection dereference () const 53 { 54 return IntersectionImplType( data(), *hostIterator_ ); 55 } 56 data() const57 const ExtraData &data () const { return data_; } 58 59 protected: 60 ExtraData data_; 61 HostIntersectionIteratorType hostIterator_; 62 }; 63 64 } // namespace Fem 65 66 } // namespace Dune 67 68 #endif // #ifndef DUNE_FEM_GRIDPART_IDGRIDPART_INTERSECTIONITERATOR_HH 69