dune-fem 2.12-git
Loading...
Searching...
No Matches
idgridpart/entity.hh
Go to the documentation of this file.
1#ifndef DUNE_FEM_GRIDPART_IDGRIDPART_ENTITY_HH
2#define DUNE_FEM_GRIDPART_IDGRIDPART_ENTITY_HH
3
4#include <type_traits>
5#include <utility>
6
7//- dune-grid includes
8#include <dune/grid/common/entity.hh>
10
11//- dune-fem includes
14
15namespace Dune
16{
17 namespace Fem {
18
19 // IdEntityBasic
20 // -------------
21
22 template< int codim, int dim, class GridFamily >
24 : public DefaultGridPartEntity < codim, dim, GridFamily >
25 {
26 protected:
28
29 public:
34 static const int codimension = codim;
38 static const int mydimension = dimension - codimension;
41
49
51 typedef typename GridFamily::template Codim< codimension >::EntitySeed EntitySeedType;
53 typedef typename Traits::template Codim< codimension >::Geometry Geometry;
54
57 // type of the host grid
58 typedef typename Traits::HostGridPartType HostGridPartType;
59
60 protected:
61 // type of extra data, e.g. a pointer to grid (here empty)
62 typedef typename Traits::ExtraData ExtraData;
63
64 public:
69 typedef typename HostGridPartType::template Codim< codimension >::EntityType HostEntityType;
70
77 IdEntityBasic () = default;
78
87
98 {
99 return hostEntity().type();
100 }
101
103 int level () const
104 {
105 return hostEntity().level();
106 }
107
110 {
111 return hostEntity().partitionType();
112 }
113
116 {
117 return Geometry( hostEntity().geometry() );
118 }
119
121 EntitySeedType seed () const { return hostEntity().seed(); }
122
124 bool equals ( const IdEntityBasic &rhs ) const
125 {
126 return hostEntity() == rhs.hostEntity();
127 }
128
129 unsigned int subEntities( const unsigned int c ) const
130 {
131 return hostEntity().subEntities( c );
132 }
133
141 {
142 return hostEntity_;
143 }
144
145 const ExtraData &data () const { return data_; }
146
149 protected:
152 };
153
154
155
156 // IdGridEntity
157 // ------------
158
159 template< int codim, int dim, class GridFamily >
160 class IdEntity : public IdEntityBasic< codim, dim, GridFamily >
161 {
163 protected:
165
166 public:
167 // type of the host grid
168 typedef typename Traits::HostGridPartType HostGridPartType;
169 protected:
170 // type of extra data, e.g. a pointer to grid (here empty)
171 typedef typename Traits::ExtraData ExtraData;
172
173 public:
175
180 typedef typename HostGridPartType::template Codim< codimension >::EntityType HostEntityType;
181
185 IdEntity () = default;
186
190 };
191
192
193 // IdGridEntity for codimension 0
194 // ----------------------------------
195
200 template< int dim, class GridFamily >
201 class IdEntity< 0, dim, GridFamily > : public IdEntityBasic< 0, dim, GridFamily >
202 {
204 protected:
205 typedef typename BaseType::Traits Traits;
206
207 // type of extra data, e.g. a pointer to grid (here empty)
209
210 public:
212
214 using BaseType::data ;
220 typedef typename HostGridPartType::template Codim< codimension >::EntityType HostEntityType;
223 public:
228 typedef typename Traits::template Codim< codimension >::LocalGeometry LocalGeometry;
229
238 IdEntity () = default;
239
248
251 template< int codim >
252 int count () const
253 {
254 return hostEntity().template count< codim >();
255 }
256
257 template< int codim >
258 typename Traits::template Codim< codim >::Entity
259 subEntity ( int i ) const
260 {
261 typedef typename Traits::template Codim< codim >::Entity::Implementation EntityImpl;
262 return EntityImpl( data(), hostEntity().template subEntity< codim >( i ) );
263 }
264
266 {
267 return hostEntity().hasBoundaryIntersections();
268 }
269
272 };
273
274 } // namespace Fem
275
276} // namespace Dune
277
278#endif // #ifndef DUNE_IDGRID_ENTITY_HH
Y & rhs()
size_type dim() const
PartitionType
STL namespace.
Definition defaultgridpartentity.hh:22
Definition idgridpart/entity.hh:25
int level() const
obtain the level of this entity
Definition idgridpart/entity.hh:103
ExtraData data_
Definition idgridpart/entity.hh:150
Traits::HostGridPartType HostGridPartType
Definition idgridpart/entity.hh:58
static const int dimension
dimension of the grid
Definition idgridpart/entity.hh:36
Geometry geometry() const
Definition idgridpart/entity.hh:115
Traits::template Codim< codimension >::Geometry Geometry
type of corresponding geometry
Definition idgridpart/entity.hh:53
const ExtraData & data() const
Definition idgridpart/entity.hh:145
static const int mydimension
dimension of the entity
Definition idgridpart/entity.hh:38
bool equals(const IdEntityBasic &rhs) const
check for equality
Definition idgridpart/entity.hh:124
HostGridPartType::template Codim< codimension >::EntityType HostEntityType
type of corresponding host entity
Definition idgridpart/entity.hh:69
static const int codimension
codimensioon of the entity
Definition idgridpart/entity.hh:34
IdEntityBasic()=default
construct a null entity
std::remove_const< GridFamily >::type::ctype ctype
coordinate type of the grid
Definition idgridpart/entity.hh:48
EntitySeedType seed() const
return EntitySeed of host grid entity
Definition idgridpart/entity.hh:121
const HostEntityType & hostEntity() const
Definition idgridpart/entity.hh:140
std::remove_const< GridFamily >::type::Traits Traits
Definition idgridpart/entity.hh:27
PartitionType partitionType() const
obtain the partition type of this entity
Definition idgridpart/entity.hh:109
static const int dimensionworld
dimension of the world
Definition idgridpart/entity.hh:40
HostEntityType hostEntity_
Definition idgridpart/entity.hh:151
GridFamily::template Codim< codimension >::EntitySeed EntitySeedType
type of corresponding entity seed
Definition idgridpart/entity.hh:51
unsigned int subEntities(const unsigned int c) const
Definition idgridpart/entity.hh:129
Traits::ExtraData ExtraData
Definition idgridpart/entity.hh:62
GeometryType type() const
obtain the name of the corresponding reference element
Definition idgridpart/entity.hh:97
IdEntityBasic(ExtraData data, HostEntityType hostEntity)
construct an initialized entity
Definition idgridpart/entity.hh:83
Definition idgridpart/entity.hh:161
IdEntity(ExtraData data, HostEntityType hostEntity)
Definition idgridpart/entity.hh:187
IdEntity()=default
construct a null entity
Traits::ExtraData ExtraData
Definition idgridpart/entity.hh:171
HostGridPartType::template Codim< codimension >::EntityType HostEntityType
type of corresponding host entity
Definition idgridpart/entity.hh:180
std::remove_const< GridFamily >::type::Traits Traits
Definition idgridpart/entity.hh:164
Traits::HostGridPartType HostGridPartType
Definition idgridpart/entity.hh:168
Traits::template Codim< codim >::Entity subEntity(int i) const
Definition idgridpart/entity.hh:259
Traits::template Codim< codimension >::LocalGeometry LocalGeometry
type of corresponding local geometry
Definition idgridpart/entity.hh:228
BaseType::ExtraData ExtraData
Definition idgridpart/entity.hh:208
BaseType::Traits Traits
Definition idgridpart/entity.hh:205
HostGridPartType::template Codim< codimension >::EntityType HostEntityType
type of corresponding host entity
Definition idgridpart/entity.hh:220
bool hasBoundaryIntersections() const
Definition idgridpart/entity.hh:265
IdEntity()=default
construct a null entity
BaseType::HostGridPartType HostGridPartType
Definition idgridpart/entity.hh:211
IdEntity(ExtraData data, HostEntityType hostEntity)
construct an initialized entity
Definition idgridpart/entity.hh:245
int count() const
Definition idgridpart/entity.hh:252