dune-grid-dev-howto  2.3beta2
identitygridentitypointer.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_IDENTITYGRID_ENTITY_POINTER_HH
4 #define DUNE_IDENTITYGRID_ENTITY_POINTER_HH
5 
6 #include "identitygridentity.hh"
7 
12 namespace Dune {
13 
14 
17  template<int codim, class GridImp>
19  {
20  private:
21 
22  enum { dim = GridImp::dimension };
23 
24 
25  public:
26 
30 
32  enum { codimension = codim };
33 
34  typedef typename GridImp::template Codim<codim>::Entity Entity;
35 
37 
38  // The codimension of this entitypointer wrt the host grid
39  enum {CodimInHostGrid = GridImp::HostGridType::dimension - GridImp::dimension + codim};
40 
41  // EntityPointer to the equivalent entity in the host grid
42  typedef typename GridImp::HostGridType::Traits::template Codim<CodimInHostGrid>::EntityPointer HostGridEntityPointer;
43 
44 
46  template< class HostGridEntityPointer >
47  IdentityGridEntityPointer (const GridImp* identityGrid, const HostGridEntityPointer& hostEntity_) :
48  identityGrid_(identityGrid),
49  virtualEntity_(identityGrid, hostEntity_)
50  {}
51 
54  : identityGrid_(entity.identityGrid_),
55  virtualEntity_(entity.identityGrid_, entity.hostEntity_)
56  {}
57 
60  return virtualEntity_.getTarget() == i.virtualEntity_.getTarget();
61  }
62 
63 
65  Entity& dereference() const {
66  return virtualEntity_;
67  }
68 
70  void compactify () {
71  //virtualEntity_.getTarget().compactify();
72  }
73 
75  int level () const {
76  return virtualEntity_.level();
77  }
78 
79 
80  protected:
81 
82  const GridImp* identityGrid_;
83 
86 
87 
88  };
89 
90 
91 } // end namespace Dune
92 
93 #endif