dune-fem 2.12-git
Loading...
Searching...
No Matches
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#include <optional>
7
8#include <dune/grid/common/intersectioniterator.hh>
9
11
12namespace Dune
13{
14
15 namespace Fem
16 {
17
18 // GeoIntersectionIterator
19 // -----------------------
20
21 template< class GridFamily >
23 {
25
27
28 typedef typename Traits::CoordFunctionType CoordFunctionType;
29 typedef typename Traits::template Codim< 0 >::Geometry ElementGeometryType;
30 typedef typename Traits::HostGridPartType::IntersectionIteratorType HostIntersectionIteratorType;
31
33
34 public:
36
37 template< class Entity >
39 HostIntersectionIteratorType hostIterator )
40 : coordFunction_( &inside.impl().coordFunction() ),
41 insideGeo_( inside.geometry() ),
42 hostIterator_( std::move( hostIterator ) )
43 {}
44
46 : coordFunction_( &other.coordFunction() ),
47 insideGeo_( other.insideGeo_ ),
48 hostIterator_( other.hostIterator_ )
49 {}
50
52 : coordFunction_( nullptr ),
53 hostIterator_()
54 {}
55
57 {
58 coordFunction_ = other.coordFunction_;
59 insideGeo_.reset();
60 insideGeo_.emplace( *other.insideGeo_ );
61 hostIterator_ = other.hostIterator_ ;
62 return *this;
63 }
64
65 bool equals ( const ThisType &other ) const
66 {
67 return hostIterator_ == other.hostIterator_;
68 }
69
70 void increment ()
71 {
72 ++hostIterator_;
73 }
74
76 {
77 assert( insideGeo_ );
78 return IntersectionImplType( coordFunction(), *insideGeo_, *hostIterator_ );
79 }
80
81 const CoordFunctionType &coordFunction () const
82 {
83 assert( coordFunction_ );
84 return *coordFunction_;
85 }
86
87 private:
88 const CoordFunctionType *coordFunction_ = nullptr;
90 HostIntersectionIteratorType hostIterator_;
91 };
92
93 } // namespace Fem
94
95} // namespace Dune
96
97#endif // #ifndef DUNE_FEM_GRIDPART_GEOGRIDPART_INTERSECTIONITERATOR_HH
STL namespace.
Definition geogridpart/intersection.hh:20
Definition geogridpart/intersectioniterator.hh:23
GeoIntersectionIterator(const GeoIntersectionIterator &other)
Definition geogridpart/intersectioniterator.hh:45
GeoIntersectionIterator()
Definition geogridpart/intersectioniterator.hh:51
GeoIntersectionIterator(const Entity &inside, HostIntersectionIteratorType hostIterator)
Definition geogridpart/intersectioniterator.hh:38
Dune::Intersection< const GridFamily, IntersectionImplType > Intersection
Definition geogridpart/intersectioniterator.hh:35
const CoordFunctionType & coordFunction() const
Definition geogridpart/intersectioniterator.hh:81
GeoIntersectionIterator & operator=(const GeoIntersectionIterator &other)
Definition geogridpart/intersectioniterator.hh:56
Intersection dereference() const
Definition geogridpart/intersectioniterator.hh:75
void increment()
Definition geogridpart/intersectioniterator.hh:70
bool equals(const ThisType &other) const
Definition geogridpart/intersectioniterator.hh:65
T emplace(T... args)
T reset(T... args)