dune-fem  2.8-git
filteredgridpart/intersectioniterator.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_GRIDPART_FILTEREDGRIDPART_INTERSECTIONITERATOR_HH
2 #define DUNE_FEM_GRIDPART_FILTEREDGRIDPART_INTERSECTIONITERATOR_HH
3 
4 #include <cassert>
5 
6 #include <type_traits>
7 #include <utility>
8 
9 #include <dune/grid/common/intersectioniterator.hh>
10 
12 
13 namespace Dune
14 {
15 
16  namespace Fem
17  {
18 
19  // FilteredGridPartIntersectionIterator
20  // ------------------------------------
21 
22  template< class GridPartFamily >
24  {
26 
27  typedef typename std::remove_const_t< GridPartFamily >::Filter FilterType;
28  typedef typename std::remove_const_t< GridPartFamily >::HostGridPart::IntersectionIteratorType HostIteratorType;
29 
31 
32  public:
33  typedef Dune::Intersection< GridPartFamily, IntersectionImpl > Intersection;
34 
36 
37  FilteredGridPartIntersectionIterator ( const FilterType &filter, HostIteratorType hostIterator )
38  : filter_( &filter ), hostIterator_( std::move( hostIterator ) )
39  {}
40 
41  Intersection dereference () const { return Intersection( IntersectionImpl( filter(), *hostIterator_ ) ); }
42 
43  bool equals ( const ThisType &other ) const { return (hostIterator() == other.hostIterator()); }
44 
45  void increment () { ++hostIterator_; }
46 
47  const FilterType &filter () const { assert( filter_ ); return *filter_; }
48 
49  const HostIteratorType &hostIterator () const { return hostIterator_; }
50  HostIteratorType &hostIterator () { return hostIterator_; }
51 
52  private:
53  const FilterType *filter_ = nullptr;
54  HostIteratorType hostIterator_;
55  };
56 
57  } // namespace Fem
58 
59 } // namespace Dune
60 
61 #endif // #ifndef DUNE_FEM_GRIDPART_FILTEREDGRIDPART_INTERSECTIONITERATOR_HH
Definition: bindguard.hh:11
Definition: filteredgridpart/intersection.hh:21
Definition: filteredgridpart/intersectioniterator.hh:24
void increment()
Definition: filteredgridpart/intersectioniterator.hh:45
const HostIteratorType & hostIterator() const
Definition: filteredgridpart/intersectioniterator.hh:49
HostIteratorType & hostIterator()
Definition: filteredgridpart/intersectioniterator.hh:50
bool equals(const ThisType &other) const
Definition: filteredgridpart/intersectioniterator.hh:43
Intersection dereference() const
Definition: filteredgridpart/intersectioniterator.hh:41
FilteredGridPartIntersectionIterator(const FilterType &filter, HostIteratorType hostIterator)
Definition: filteredgridpart/intersectioniterator.hh:37
Dune::Intersection< GridPartFamily, IntersectionImpl > Intersection
Definition: filteredgridpart/intersectioniterator.hh:33
const FilterType & filter() const
Definition: filteredgridpart/intersectioniterator.hh:47