dune-fem 2.12-git
Loading...
Searching...
No Matches
geometrygridpart.hh
Go to the documentation of this file.
1#ifndef DUNE_FEM_GRIDPART_GEOMETRYGRIDPART_HH
2#define DUNE_FEM_GRIDPART_GEOMETRYGRIDPART_HH
3
4#include <cassert>
5
7
9
17
26
27namespace Dune
28{
29
30 namespace Fem
31 {
32
33 // Internal Forward Declarations
34 // -----------------------------
35
36 template< class GridFunctionType >
37 class GeometryGridPart;
38
39
40
41 // GeometryGridPartData
42 // --------------------
43
44 template< class GridFunction >
46 {
47 typedef GridFunction GridFunctionType;
48
49 GeometryGridPartData () noexcept = default;
50 GeometryGridPartData ( const GridFunctionType &gridFunction ) noexcept : gridFunction_( &gridFunction ) {}
51
52 operator const GridFunctionType & () const { assert( gridFunction_ ); return *gridFunction_; }
53
54 private:
55 const GridFunctionType *gridFunction_ = nullptr;
56 };
57
58
59
60 // GeometryGridPartFamily
61 // ----------------------
62
63 template< class GridFunction >
65 {
66 typedef GridFunction GridFunctionType;
67 typedef typename GridFunction::RangeFieldType ctype;
68
69 constexpr static int dimension = GridFunction::GridPartType::dimension;
70 constexpr static int dimensionworld = GridFunction::FunctionSpaceType::dimRange;
71
73
74 struct Traits
75 {
77 typedef GridFunction GridFunctionType;
78 typedef typename GridFunctionType::GridPartType HostGridPartType;
79
81
82 template< int codim >
95
98
101
104
106 };
107
108 template< int codim >
109 struct Codim
110 : public Traits::template Codim< codim >
111 {};
112
115
117 };
118
119
120
121 // GeometryGridPartTraits
122 // ----------------------
123
124 template< class GridFunction >
126 {
127 typedef GridFunction GridFunctionType;
128 typedef typename GridFunction::GridPartType HostGridPartType;
132
134
135 constexpr static int dimension = GridFunction::GridPartType::dimension;
136 constexpr static int dimensionworld = GridFunction::FunctionSpaceType::dimRange;
137
140
142
143 typedef typename HostGridPartType::GridType GridType;
144
145 static const PartitionIteratorType indexSetPartitionType = HostGridPartType::indexSetPartitionType;
146 static const InterfaceType indexSetInterfaceType = HostGridPartType::indexSetInterfaceType;
147
151
152 template< int codim >
153 struct Codim : public GridFamily::Traits::template Codim< codim >
154 {
155 typedef typename GridFamily::Traits::template Codim< codim > BaseType;
156
157 typedef typename BaseType::Geometry GeometryType;
158 typedef typename BaseType::LocalGeometry LocalGeometryType;
159
160 typedef typename BaseType::Entity EntityType;
161 typedef typename BaseType::EntitySeed EntitySeedType;
162
163 template< PartitionIteratorType pitype >
169 };
170
171 typedef typename HostGridPartType::CommunicationType CommunicationType;
173 static const bool conforming = HostGridPartType::Traits::conforming;
174 };
175
176
177
178 // GeometryGridPart
179 // ----------------
180
181 template< class GridFunction >
183 : public GridPartDefault< GeometryGridPartTraits< GridFunction > >
184 {
185 public:
186 typedef GridFunction GridFunctionType;
187
188 private:
192
193 public:
194 typedef typename GridFunctionType::GridPartType HostGridPartType;
196 typedef typename BaseType::GridType GridType;
198 typedef typename BaseType::Grid Grid;
202 typedef typename BaseType::IndexSet IndexSet;
216
217 // the interface takes this from the grid
218 constexpr static int dimensionworld = GridFunction::FunctionSpaceType::dimRange;
219
220 template< int codim >
221 struct Codim
222 : public BaseType::template Codim< codim >
223 {};
224
226 : BaseType( const_cast< GridType& > (gridFunction.gridPart().grid()) ),
229 {}
230
231 const IndexSetType &indexSet () const
232 {
233 return indexSet_;
234 }
235
236 template< int codim >
238 begin () const
239 {
240 return begin< codim, InteriorBorder_Partition >();
241 }
242
243 template< int codim, PartitionIteratorType pitype >
244 typename Codim< codim >::template Partition< pitype >::IteratorType
245 begin () const
246 {
247 return IdIterator< codim, pitype, const GridFamily >( gridFunction(), hostGridPart().template begin< codim, pitype >() );
248 }
249
250 template< int codim >
252 end () const
253 {
254 return end< codim, InteriorBorder_Partition >();
255 }
256
257 template< int codim, PartitionIteratorType pitype >
258 typename Codim< codim >::template Partition< pitype >::IteratorType
259 end () const
260 {
261 return IdIterator< codim, pitype, const GridFamily >( gridFunction(), hostGridPart().template end< codim, pitype >() );
262 }
263
264 int level () const
265 {
266 return hostGridPart().level();
267 }
268
273
278
279 template< class DataHandle, class Data >
281 InterfaceType iftype, CommunicationDirection dir ) const
282 {
283 typedef CommDataHandleIF< DataHandle, Data > HostHandleType;
285 hostGridPart().communicate( handleWrapper, iftype, dir );
286 }
287
288 // convert a grid entity to a grid part entity ("Gurke!")
289 template< class Entity >
291 convert ( const Entity &entity ) const
292 {
293 // make sure we have a grid entity
294 const auto& gridEntity = Fem::gridEntity( entity );
295
296 // create a grid part entity from a given grid entity
297 typedef typename Codim< Entity::codimension >::EntityType EntityType;
298 typedef typename EntityType::Implementation Implementation;
300 // here, grid part information can be passed, if necessary
301 return EntityObj( Implementation( gridFunction(), hostGridPart().convert( gridEntity ) ) );
302 }
303 template < class EntitySeed >
305 entity ( const EntitySeed &seed ) const
306 {
307 return convert( hostGridPart().entity(seed) );
308 }
309
311 {
312 return gridFunction().gridPart();
313 }
314
316 {
317 assert( gridFunction_ );
318 return *gridFunction_;
319 }
320
321 protected:
324 };
325
326
327
328 // GridEntityAccess for GeometryGridPartEntity
329 // -------------------------------------------
330
331 template< int codim, int dim, class GridFamily >
332 struct GridEntityAccess< Dune::ExtendedEntity< codim, dim, GridFamily, GeometryGridPartEntity > >
333 {
336 typedef typename HostAccessType::GridEntityType GridEntityType;
337
338 static const GridEntityType &gridEntity ( const EntityType &entity )
339 {
340 return HostAccessType::gridEntity( entity.impl().hostEntity() );
341 }
342 };
343
344
345
346 // EntitySearch for GeometryGridPart
347 // ---------------------------------
348
349 template< class GridFunction, int codim, PartitionIteratorType partition >
350 class EntitySearch< GeometryGridPart< GridFunction >, codim, partition >
351 : public DefaultEntitySearch< GeometryGridPart< GridFunction >, codim, partition >
352 {
355
356 public:
358
359 explicit EntitySearch ( const GridPartType &gridPart )
360 : BaseType( gridPart )
361 {}
362 };
363
364 } // namespace Fem
365
366} // namespace Dune
367
368#endif // #ifndef DUNE_FEM_GRIDPART_GEOMETRYGRIDPART_HH
void seed(const Vertex &vertex)
PartitionIteratorType
CommunicationDirection
InterfaceType
const GridEntityAccess< Entity >::GridEntityType & gridEntity(const Entity &entity)
Definition gridpart.hh:510
Implementation & impl()
Definition deaditerator.hh:49
Definition deaditerator.hh:158
Definition entitysearch.hh:25
Definition entitysearch.hh:131
Wrapper class for wrapped entities added a cast operator to the host entity.
Definition extendedentity.hh:23
IndexSetType IndexSet
Index set implementation.
Definition gridpart.hh:94
CommunicationType Communication
Collective communication.
Definition gridpart.hh:99
IntersectionIteratorType IntersectionIterator
type of IntersectionIterator
Definition gridpart.hh:113
GridType Grid
type of Grid implementation
Definition gridpart.hh:89
IntersectionType Intersection
type of Intersection
Definition gridpart.hh:118
GridPartType GridViewType
Definition gridpart.hh:120
Default implementation for the GridPart classes.
Definition gridpart.hh:372
IntersectionIteratorType::Intersection IntersectionType
type of intersection
Definition gridpart.hh:388
Traits::CommunicationType CommunicationType
Collective communication.
Definition gridpart.hh:391
const GridType & grid() const
Returns const reference to the underlying grid.
Definition gridpart.hh:423
Traits::IndexSetType IndexSetType
Index set implementation.
Definition gridpart.hh:382
Traits::IntersectionIteratorType IntersectionIteratorType
type of intersection iterator
Definition gridpart.hh:385
Traits::GridType GridType
Grid implementation.
Definition gridpart.hh:380
Definition gridpart.hh:494
MetaTwistUtility forwards the twist calls to the TwistUtility of the underlying HostTwistUtility.
Definition metatwistutility.hh:22
Definition sharedgeometry.hh:20
Definition geometrygridpart.hh:184
void communicate(CommDataHandleIF< DataHandle, Data > &handle, InterfaceType iftype, CommunicationDirection dir) const
Definition geometrygridpart.hh:280
GeometryGridPart(const GridFunctionType &gridFunction)
Definition geometrygridpart.hh:225
BaseType::IndexSet IndexSet
index set use in this gridpart
Definition geometrygridpart.hh:202
const GridFunctionType & gridFunction() const
Definition geometrygridpart.hh:315
GridFunctionType::GridPartType HostGridPartType
Definition geometrygridpart.hh:194
static constexpr int dimensionworld
Definition geometrygridpart.hh:218
IntersectionIteratorType iend(const typename Codim< 0 >::EntityType &entity) const
Definition geometrygridpart.hh:274
Codim< codim >::IteratorType begin() const
Definition geometrygridpart.hh:238
const GridFunctionType * gridFunction_
Definition geometrygridpart.hh:322
BaseType::Communication Communication
Collective communication.
Definition geometrygridpart.hh:214
BaseType::IntersectionIteratorType IntersectionIteratorType
type of intersection iterator
Definition geometrygridpart.hh:204
BaseType::Grid Grid
type of grid
Definition geometrygridpart.hh:198
BaseType::IntersectionIterator IntersectionIterator
type of intersection iterator
Definition geometrygridpart.hh:206
BaseType::IndexSetType IndexSetType
index set use in this gridpart
Definition geometrygridpart.hh:200
Codim< codim >::template Partition< pitype >::IteratorType begin() const
Definition geometrygridpart.hh:245
IndexSetType indexSet_
Definition geometrygridpart.hh:323
Codim< codim >::IteratorType end() const
Definition geometrygridpart.hh:252
BaseType::IntersectionType IntersectionType
type of intersection
Definition geometrygridpart.hh:208
IntersectionIteratorType ibegin(const typename Codim< 0 >::EntityType &entity) const
Definition geometrygridpart.hh:269
BaseType::GridViewType GridViewType
Definition geometrygridpart.hh:215
Codim< codim >::template Partition< pitype >::IteratorType end() const
Definition geometrygridpart.hh:259
GridFunction GridFunctionType
Definition geometrygridpart.hh:186
BaseType::Intersection Intersection
type of intersection
Definition geometrygridpart.hh:210
BaseType::CommunicationType CommunicationType
Collective communication.
Definition geometrygridpart.hh:212
const IndexSetType & indexSet() const
Definition geometrygridpart.hh:231
BaseType::GridType GridType
type of grid
Definition geometrygridpart.hh:196
const HostGridPartType & hostGridPart() const
Definition geometrygridpart.hh:310
int level() const
Definition geometrygridpart.hh:264
MakeableInterfaceObject< typename Codim< Entity::codimension >::EntityType > convert(const Entity &entity) const
Definition geometrygridpart.hh:291
Codim< EntitySeed::codimension >::EntityType entity(const EntitySeed &seed) const
Definition geometrygridpart.hh:305
Definition geometrygridpart.hh:46
GeometryGridPartData() noexcept=default
GridFunction GridFunctionType
Definition geometrygridpart.hh:47
Definition geometrygridpart.hh:65
Traits::LeafIntersectionIterator LeafIntersectionIterator
Definition geometrygridpart.hh:113
Traits::HierarchicIterator HierarchicIterator
Definition geometrygridpart.hh:116
GridFunction GridFunctionType
Definition geometrygridpart.hh:66
static constexpr int dimension
Definition geometrygridpart.hh:69
static constexpr int dimensionworld
Definition geometrygridpart.hh:70
GeometryGridPartFamily< GridFunction > GridPartFamily
Definition geometrygridpart.hh:72
Traits::LevelIntersectionIterator LevelIntersectionIterator
Definition geometrygridpart.hh:114
GridFunction::RangeFieldType ctype
Definition geometrygridpart.hh:67
Definition geometrygridpart.hh:75
SharedGeometry< LocalFunctionGeometry< ConstLocalFunction< GridFunction > > > ElementGeometryImpl
Definition geometrygridpart.hh:80
Dune::Intersection< const GridPartFamily, IntersectionImplType > LeafIntersection
Definition geometrygridpart.hh:99
Dune::Intersection< const GridPartFamily, IntersectionImplType > LevelIntersection
Definition geometrygridpart.hh:100
Dune::IntersectionIterator< const GridPartFamily, IntersectionIteratorImplType, IntersectionImplType > LeafIntersectionIterator
Definition geometrygridpart.hh:102
DeadIntersectionIterator< const GridPartFamily > IntersectionIteratorImplType
Definition geometrygridpart.hh:97
Dune::IntersectionIterator< const GridPartFamily, IntersectionIteratorImplType, IntersectionImplType > LevelIntersectionIterator
Definition geometrygridpart.hh:103
DeadIntersection< const GridPartFamily > IntersectionImplType
Definition geometrygridpart.hh:96
GridFunctionType::GridPartType HostGridPartType
Definition geometrygridpart.hh:78
GridFunction GridFunctionType
Definition geometrygridpart.hh:77
GeometryGridPartData< GridFunction > ExtraData
Definition geometrygridpart.hh:76
Dune::EntityIterator< 0, const GridPartFamily, DeadIterator< typename Codim< 0 >::Entity > > HierarchicIterator
Definition geometrygridpart.hh:105
Definition geometrygridpart.hh:84
Dune::Geometry< dimension - codim, dimensionworld, const GridPartFamily, GeometryImpl > Geometry
Definition geometrygridpart.hh:90
HostGridPartType::template Codim< codim >::LocalGeometryType LocalGeometry
Definition geometrygridpart.hh:85
Dune::ExtendedEntity< codim, dimension, const GridPartFamily, GeometryGridPartEntity > Entity
Definition geometrygridpart.hh:92
HostGridPartType::GridType::template Codim< codim >::EntitySeed EntitySeed
Definition geometrygridpart.hh:93
Definition geometrygridpart.hh:111
Definition geometrygridpart.hh:126
static const bool conforming
Definition geometrygridpart.hh:173
GeometryGridPartFamily< GridFunction > GridPartFamily
Definition geometrygridpart.hh:130
IntersectionIterator< const GridFamily, IntersectionIteratorImplType, IntersectionImplType > IntersectionIteratorType
Definition geometrygridpart.hh:150
HostGridPartType::GridType GridType
Definition geometrygridpart.hh:143
GeometryGridPartIntersectionIterator< const GridFamily > IntersectionIteratorImplType
Definition geometrygridpart.hh:148
IdIndexSet< const GridPartFamily > IndexSetType
Definition geometrygridpart.hh:141
GeometryGridPart< GridFunction > GridPartType
Definition geometrygridpart.hh:129
static constexpr int dimensionworld
Definition geometrygridpart.hh:136
GeometryGridPartIntersection< const GridFamily > IntersectionImplType
Definition geometrygridpart.hh:149
GridFunction::GridPartType HostGridPartType
Definition geometrygridpart.hh:128
HostGridPartType::CommunicationType CommunicationType
Definition geometrygridpart.hh:171
static constexpr int dimension
Definition geometrygridpart.hh:135
CommunicationType Communication
Definition geometrygridpart.hh:172
GridFunction GridFunctionType
Definition geometrygridpart.hh:127
GridPartType GridViewType
Definition geometrygridpart.hh:133
static const PartitionIteratorType indexSetPartitionType
Definition geometrygridpart.hh:145
static const InterfaceType indexSetInterfaceType
Definition geometrygridpart.hh:146
MetaTwistUtility< typename HostGridPartType::TwistUtilityType > TwistUtilityType
type of twist utility
Definition geometrygridpart.hh:139
GeometryGridPartFamily< GridFunction > GridFamily
Definition geometrygridpart.hh:131
Definition geometrygridpart.hh:154
BaseType::EntitySeed EntitySeedType
Definition geometrygridpart.hh:161
GridFamily::Traits::template Codim< codim > BaseType
Definition geometrygridpart.hh:155
BaseType::Geometry GeometryType
Definition geometrygridpart.hh:157
BaseType::LocalGeometry LocalGeometryType
Definition geometrygridpart.hh:158
BaseType::Entity EntityType
Definition geometrygridpart.hh:160
Definition geometrygridpart.hh:165
IteratorType Iterator
Definition geometrygridpart.hh:167
EntityIterator< codim, const GridFamily, IdIterator< codim, pitype, const GridFamily > > IteratorType
Definition geometrygridpart.hh:166
Definition geometrygridpart.hh:223
GridEntityAccess< typename EntityType::Implementation::HostEntityType > HostAccessType
Definition geometrygridpart.hh:335
Dune::ExtendedEntity< codim, dim, GridFamily, GeometryGridPartEntity > EntityType
Definition geometrygridpart.hh:334
HostAccessType::GridEntityType GridEntityType
Definition geometrygridpart.hh:336
static const GridEntityType & gridEntity(const EntityType &entity)
Definition geometrygridpart.hh:338
BaseType::GridPartType GridPartType
Definition geometrygridpart.hh:357
EntitySearch(const GridPartType &gridPart)
Definition geometrygridpart.hh:359
Definition gridpart/geometrygridpart/datahandle.hh:22
Definition geometrygridpart/intersection.hh:24
Definition geometrygridpart/intersectioniterator.hh:21
Definition idgridpart/indexset.hh:264
Definition idgridpart/iterator.hh:21