dune-grid  2.4.1-rc2
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 
10 namespace Dune {
11 
14  template<int codim, class GridImp>
15  class YaspEntityPointer
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 
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)
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: yaspgrid.hh:59
YaspEntityPointer(const YGLI &g, const I &it)
constructor
Definition: yaspgridentitypointer.hh:40
YaspEntityPointer< codim, GridImp > EntityPointerImp
Definition: yaspgridentitypointer.hh:26
GridImp::YGrid::Iterator I
Definition: yaspgridentitypointer.hh:25
bool equals(const YaspEntityPointer &rhs) const
copying and moving – use default implementations
Definition: yaspgridentitypointer.hh:68
Definition: yaspgrid.hh:58
GridImp::template Codim< codim >::Entity Entity
Definition: yaspgridentitypointer.hh:23
YaspEntityPointer(YaspEntityImp &&entity)
Definition: yaspgridentitypointer.hh:61
YaspEntityPointer(const YaspEntityImp &entity)
copying and moving
Definition: yaspgridentitypointer.hh:57
YaspEntityPointer()
default constructor
Definition: yaspgridentitypointer.hh:35
GridImp::YGridLevelIterator YGLI
Definition: yaspgridentitypointer.hh:24
static void(*)(*)(*)(*)(*)(*) move(const double *)
Definition: partitiondisplay.cc:122
Entity _entity
use default assignment operator
Definition: yaspgridentitypointer.hh:85
Include standard header files.
Definition: agrid.hh:59
STL namespace.
YaspEntity< codim, dim, GridImp > YaspEntityImp
Definition: yaspgridentitypointer.hh:28
Definition: yaspgridentitypointer.hh:32
int level() const
ask for level of entity
Definition: yaspgridentitypointer.hh:80
const Entity & dereference() const
dereferencing
Definition: yaspgridentitypointer.hh:74