Dune Core Modules (2.4.2)

yaspgridentitypointer.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_GRID_YASPGRIDENTITYPOINTER_HH
4#define DUNE_GRID_YASPGRIDENTITYPOINTER_HH
5
10namespace Dune {
11
14 template<int codim, class GridImp>
16 {
18 enum { dim=GridImp::dimension };
20 typedef typename GridImp::ctype ctype;
21
22 public:
23 typedef typename GridImp::template Codim<codim>::Entity Entity;
24 typedef typename GridImp::YGridLevelIterator YGLI;
25 typedef typename GridImp::YGrid::Iterator I;
27 protected:
28 typedef YaspEntity<codim, dim, GridImp> YaspEntityImp;
29
30 public:
32 enum { codimension = codim };
33
36 _entity(YaspEntityImp())
37 {}
38
40 YaspEntityPointer (const YGLI & g, const I& it)
41 : _entity(YaspEntityImp(g,it))
42 {}
43
44
45// skip this constructor for GCC 4.4, which has a number of nasty bugs in its rvalue reference support
46// As this behavior is hard to trigger in small configuration tests and because we'll probably drop GCC 4.4
47// after the next release anyway, I hacked in this hardcoded check for the compiler version
48#if not (defined(__GNUC__) && (__GNUC__ < 5) && (__GNUC_MINOR__ < 5))
49
50 YaspEntityPointer (YGLI&& g, I&& it)
51 : _entity(YaspEntityImp(std::move(g),std::move(it)))
52 {}
53
54#endif
55
57 YaspEntityPointer (const YaspEntityImp& entity)
58 : _entity(entity)
59 {}
60
61 YaspEntityPointer (YaspEntityImp&& entity)
62 : _entity(std::move(entity))
63 {}
64
66
68 bool equals (const YaspEntityPointer& rhs) const
69 {
70 return (_entity == rhs._entity);
71 }
72
74 const Entity& dereference() const
75 {
76 return _entity;
77 }
78
80 int level () const {return _entity.level();}
81
83
84 protected:
85 Entity _entity;
86 };
87
88} // namespace Dune
89
90#endif // DUNE_GRID_YASPGRIDENTITYPOINTER_HH
A pointer to a YaspGrid::Entity.
Definition: yaspgridentitypointer.hh:16
YaspEntityPointer()
default constructor
Definition: yaspgridentitypointer.hh:35
int level() const
ask for level of entity
Definition: yaspgridentitypointer.hh:80
YaspEntityPointer(const YaspEntityImp &entity)
copying and moving
Definition: yaspgridentitypointer.hh:57
Entity _entity
use default assignment operator
Definition: yaspgridentitypointer.hh:85
const Entity & dereference() const
dereferencing
Definition: yaspgridentitypointer.hh:74
bool equals(const YaspEntityPointer &rhs) const
copying and moving – use default implementations
Definition: yaspgridentitypointer.hh:68
YaspEntityPointer(const YGLI &g, const I &it)
constructor
Definition: yaspgridentitypointer.hh:40
Dune namespace.
Definition: alignment.hh:10
STL namespace.
Static tag representing a codimension.
Definition: dimension.hh:22
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)