DUNE PDELab (git)

intersectioniterator.hh
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file LICENSE.md in module root
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4// vi: set et ts=4 sw=2 sts=2:
5#ifndef DUNE_GEOGRID_INTERSECTIONITERATOR_HH
6#define DUNE_GEOGRID_INTERSECTIONITERATOR_HH
7
8#include <dune/grid/geometrygrid/intersection.hh>
9
10namespace Dune
11{
12
13 namespace GeoGrid
14 {
15
16 // IntersectionIterator
17 // --------------------
18
19 template< class Grid, class HostIntersectionIterator >
20 class IntersectionIterator
21 {
22 typedef typename std::remove_const< Grid >::type::Traits Traits;
23
24 typedef GeoGrid::Intersection< Grid, typename HostIntersectionIterator::Intersection > IntersectionImpl;
25
26 typedef typename Traits::template Codim< 0 >::Geometry ElementGeometry;
27 typedef typename Traits::template Codim< 0 >::GeometryImpl ElementGeometryImpl;
28
29 public:
31
32 IntersectionIterator()
33 {}
34
35 template< class Entity >
36 IntersectionIterator ( const Entity &inside,
37 const HostIntersectionIterator &hostIterator )
38 : hostIterator_( hostIterator )
39 , insideGeo_( inside.geometry().impl() )
40 {}
41
42 IntersectionIterator ( const IntersectionIterator &other )
43 : hostIterator_( other.hostIterator_ )
44 , insideGeo_( other.insideGeo_ )
45 {}
46
47 IntersectionIterator ( IntersectionIterator&& other )
48 : hostIterator_( std::move( other.hostIterator_ ) )
49 , insideGeo_( std::move( other.insideGeo_ ) )
50 {}
51
52 IntersectionIterator &operator= ( const IntersectionIterator &other )
53 {
54 hostIterator_ = other.hostIterator_;
55 insideGeo_ = other.insideGeo_;
56 return *this;
57 }
58
59 IntersectionIterator &operator= ( IntersectionIterator&& other )
60 {
61 hostIterator_ = std::move( other.hostIterator_ );
62 insideGeo_ = std::move( other.insideGeo_ );
63 return *this;
64 }
65
66 bool equals ( const IntersectionIterator &other ) const
67 {
68 return (hostIterator_ == other.hostIterator_);
69 }
70
71 void increment ()
72 {
73 ++hostIterator_;
74 }
75
76 Intersection dereference () const
77 {
78 return IntersectionImpl( *hostIterator_, insideGeo_ );
79 }
80
81 private:
82
83 HostIntersectionIterator hostIterator_;
84 ElementGeometryImpl insideGeo_;
85
86 };
87
88 } // namespace GeoGrid
89
90} // namespace Dune
91
92#endif // #ifndef DUNE_GEOGRID_INTERSECTIONITERATOR_HH
Intersection of a mesh entity of codimension 0 ("element") with a "neighboring" element or with the d...
Definition: intersection.hh:164
constexpr auto equals(T1 &&t1, T2 &&t2)
Equality comparison.
Definition: hybridutilities.hh:587
Dune namespace.
Definition: alignedallocator.hh:13
STL namespace.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 24, 23:30, 2024)