dune-grid-dev-howto  2.2.0
identitygridentitypointer.hh
Go to the documentation of this file.
1 #ifndef DUNE_IDENTITYGRID_ENTITY_POINTER_HH
2 #define DUNE_IDENTITYGRID_ENTITY_POINTER_HH
3 
4 #include "identitygridentity.hh"
5 
10 namespace Dune {
11 
12 
15 template<int codim, class GridImp>
17 {
18  private:
19 
20  enum { dim = GridImp::dimension };
21 
22 
23  public:
24 
28 
30  enum { codimension = codim };
31 
32  typedef typename GridImp::template Codim<codim>::Entity Entity;
33 
35 
36  // The codimension of this entitypointer wrt the host grid
37  enum {CodimInHostGrid = GridImp::HostGridType::dimension - GridImp::dimension + codim};
38 
39  // EntityPointer to the equivalent entity in the host grid
40  typedef typename GridImp::HostGridType::Traits::template Codim<CodimInHostGrid>::EntityPointer HostGridEntityPointer;
41 
42 
44  template< class HostGridEntityPointer >
45  IdentityGridEntityPointer (const GridImp* identityGrid, const HostGridEntityPointer& hostEntity_) :
46  identityGrid_(identityGrid),
47  virtualEntity_(identityGrid, hostEntity_)
48  {
49  }
50 
53  : identityGrid_(entity.identityGrid_),
54  virtualEntity_(entity.identityGrid_, entity.hostEntity_)
55  {}
56 
59  return virtualEntity_.getTarget() == i.virtualEntity_.getTarget();
60  }
61 
62 
64  Entity& dereference() const {
65  return virtualEntity_;
66  }
67 
69  void compactify () {
70  //virtualEntity_.getTarget().compactify();
71  }
72 
74  int level () const {
75  return virtualEntity_.level();
76  }
77 
78 
79  protected:
80 
81  const GridImp* identityGrid_;
82 
85 
86 
87 };
88 
89 
90 } // end namespace Dune
91 
92 #endif