Dune Core Modules (2.4.1)

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
7
12namespace Dune {
13
14
17 template<int codim, class GridImp, class HostGridEntityPointer_>
19 {
20 private:
21
22 enum { dim = GridImp::dimension };
23
24 template<int, typename, typename>
25 friend class IdentityGridEntityPointer;
26
27
28 public:
29
33
35 enum { codimension = codim };
36
37 typedef typename GridImp::template Codim<codim>::Entity Entity;
38
39 // The codimension of this entitypointer wrt the host grid
40 enum {CodimInHostGrid = GridImp::HostGridType::dimension - GridImp::dimension + codim};
41
42 // EntityPointer to the equivalent entity in the host grid
43 typedef HostGridEntityPointer_ HostGridEntityPointer;
44
45
47 IdentityGridEntityPointer (const GridImp* identityGrid, const HostGridEntityPointer& hostEntityPointer)
48 : identityGrid_(identityGrid)
49 , hostEntityPointer_(hostEntityPointer)
50 {}
51
53 template<typename ForeignHostGridEntityPointer>
55 : identityGrid_(entityPointer.identityGrid_)
57 {}
58
60 template<typename ForeignHostGridEntityPointer>
62 {
64 return *this;
65 }
66
68 IdentityGridEntityPointer (const GridImp* identityGrid, HostGridEntityPointer&& hostEntityPointer)
69 : identityGrid_(identityGrid)
70 , hostEntityPointer_(std::move(hostEntityPointer))
71 {}
72
75 : identityGrid_(entity.identityGrid_)
76 , hostEntityPointer_(entity.hostEntity_)
77 {}
78
80 bool equals(const IdentityGridEntityPointer& i) const {
82 }
83
85 template<typename ForeignHostGridEntityPointer>
87 {
88 return hostEntityPointer_ == entityPointer.hostEntityPointer_;
89 }
90
92 Entity dereference() const {
93 return Entity{{identityGrid_,*hostEntityPointer_}};
94 }
95
97 void compactify () {
98 //virtualEntity_.getTarget().compactify();
99 }
100
102 int level () const {
103 return hostEntityPointer_->level();
104 }
105
106
107 protected:
108
109 const GridImp* identityGrid_;
110
112 HostGridEntityPointer hostEntityPointer_;
113
114
115 };
116
117
118} // end namespace Dune
119
120#endif
Wrapper class for entities.
Definition: entity.hh:62
Definition: identitygridentitypointer.hh:19
IdentityGridEntityPointer(const GridImp *identityGrid, const HostGridEntityPointer &hostEntityPointer)
constructor
Definition: identitygridentitypointer.hh:47
IdentityGridEntityPointer(const IdentityGridEntityPointer< codim, GridImp, ForeignHostGridEntityPointer > &entityPointer)
! copy constructor from EntityPointer storing different host EntityPointer
Definition: identitygridentitypointer.hh:54
Entity dereference() const
dereferencing
Definition: identitygridentitypointer.hh:92
int level() const
ask for level of entity
Definition: identitygridentitypointer.hh:102
IdentityGridEntityPointer & operator=(const IdentityGridEntityPointer< codim, GridImp, ForeignHostGridEntityPointer > &entityPointer)
! assignment operator from EntityPointer storing different host EntityPointer
Definition: identitygridentitypointer.hh:61
void compactify()
Make this pointer as small as possible.
Definition: identitygridentitypointer.hh:97
HostGridEntityPointer hostEntityPointer_
host EntityPointer
Definition: identitygridentitypointer.hh:112
IdentityGridEntityPointer(const GridImp *identityGrid, HostGridEntityPointer &&hostEntityPointer)
Move constructor to avoid copying the host EntityPointer.
Definition: identitygridentitypointer.hh:68
bool equals(const IdentityGridEntityPointer< codim, GridImp, ForeignHostGridEntityPointer > &entityPointer) const
equality with EntityPointer based on different host EntityPointer
Definition: identitygridentitypointer.hh:86
IdentityGridEntityPointer EntityPointerImp
Definition: identitygridentitypointer.hh:32
IdentityGridEntityPointer(const IdentityGridEntity< codim, dim, GridImp > &entity)
Constructor from an IdentityGrid entity.
Definition: identitygridentitypointer.hh:74
bool equals(const IdentityGridEntityPointer &i) const
equality
Definition: identitygridentitypointer.hh:80
The implementation of entities in a IdentityGrid.
Definition: identitygridentity.hh:56
The IdentityGridEntity class.
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 (Nov 12, 23:30, 2024)