dune-grid 3.0-git
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:
29
30 public:
32 enum { codimension = codim };
33
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
51 : _entity(YaspEntityImp(std::move(g),std::move(it)))
52 {}
53
54#endif
55
58 : _entity(entity)
59 {}
60
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:
86 };
87
88} // namespace Dune
89
90#endif // DUNE_GRID_YASPGRIDENTITYPOINTER_HH
STL namespace.
Include standard header files.
Definition agrid.hh:60
Definition yaspgridentity.hh:239
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
@ codimension
Definition yaspgridentitypointer.hh:32
YaspEntityPointer(const YaspEntityImp &entity)
copying and moving
Definition yaspgridentitypointer.hh:57
GridImp::YGrid::Iterator I
Definition yaspgridentitypointer.hh:25
Entity _entity
use default assignment operator
Definition yaspgridentitypointer.hh:85
YaspEntity< codim, dim, GridImp > YaspEntityImp
Definition yaspgridentitypointer.hh:28
YaspEntityPointer< codim, GridImp > EntityPointerImp
Definition yaspgridentitypointer.hh:26
const Entity & dereference() const
dereferencing
Definition yaspgridentitypointer.hh:74
GridImp::YGridLevelIterator YGLI
Definition yaspgridentitypointer.hh:24
YaspEntityPointer(YaspEntityImp &&entity)
Definition yaspgridentitypointer.hh:61
GridImp::template Codim< codim >::Entity Entity
Definition yaspgridentitypointer.hh:23
YaspEntityPointer(YGLI &&g, I &&it)
Definition yaspgridentitypointer.hh:50
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