dune-fem 2.12-git
Loading...
Searching...
No Matches
adaptiveleafgridpart.hh
Go to the documentation of this file.
1#ifndef DUNE_FEM_ADAPTIVELEAFGRIDPART_HH
2#define DUNE_FEM_ADAPTIVELEAFGRIDPART_HH
3
4//- dune-grid includes
5#include <dune/grid/common/gridview.hh>
6
7//- dune-fem includes
14
15namespace Dune
16{
17
18 namespace Fem
19 {
20
21 /*- see dune/grid/common/gridenums.hh
22 enum InterfaceType {
23 InteriorBorder_InteriorBorder_Interface=0, //!< send/receive interior and border entities
24 InteriorBorder_All_Interface=1, //!< send interior and border, receive all entities
25 Overlap_OverlapFront_Interface=2, //!< send overlap, receive overlap and front entities
26 Overlap_All_Interface=3, //!< send overlap, receive all entities
27 All_All_Interface=4 //!< send all and receive all entities
28 };
29 enum PartitionIteratorType {
30 Interior_Partition=0, //!< only interior entities
31 InteriorBorder_Partition=1, //!< interior and border entities
32 Overlap_Partition=2, //!< only overlap entities
33 OverlapFront_Partition=3, //!< overlap and front entities
34 All_Partition=4, //!< all entities
35 Ghost_Partition=5 //!< only ghost entities
36 };
37 */
38
39 template <PartitionIteratorType ittype>
44 template <>
49
51 //
52 // --AdaptiveLeafIndexGridPart
53 //
55
63 template< class TraitsImp >
65 : public GridPartDefault< TraitsImp >
66 {
69
70 public:
72 typedef TraitsImp Traits;
73
75 typedef typename Traits :: GridPartType GridPartType;
77 typedef typename Traits :: GridType GridType;
79 typedef typename Traits :: IndexSetType IndexSetType;
80
82 template< int codim >
83 struct Codim
84 : public BaseType :: template Codim< codim >
85 {};
86
87 private:
88 typedef typename GridType::LeafGridView LeafGridView;
89
90 public:
92 typedef typename Traits::IntersectionIteratorType IntersectionIteratorType;
93
95 typedef typename IntersectionIteratorType::Intersection IntersectionType;
96
98
100
101 protected:
102 // key type for singleton list is grid pointer
103 typedef SingletonList < const GridType*, IndexSetType > IndexSetProviderType;
104
105 // type of entity with codimension zero
106 typedef typename Codim< 0 > :: EntityType ElementType;
107
108 // the leaf grid view
109 LeafGridView leafGridView_ ;
110
111 // reference to index set
113
114 public:
117 : BaseType( grid ),
119 indexSet_( &IndexSetProviderType::getObject( &grid ),
120 typename IndexSetProviderType::Deleter() )
121 {}
122
124 AdaptiveGridPartBase ( const ThisType &other ) = default;
125
127
128 protected:
131 : BaseType( grid ),
133 indexSet_() // not created because noIndexSet was passed
134 {}
135
136 public:
137 using BaseType::grid;
138
140 const IndexSetType &indexSet () const
141 {
142 assert( indexSet_ );
143 return *indexSet_;
144 }
145
148 {
149 assert( indexSet_ );
150 return *indexSet_;
151 }
152
154 template< int codim >
155 typename Codim< codim > :: IteratorType
156 begin () const
157 {
158 return begin< codim, InteriorBorder_Partition >();
159 }
160
162 template< int codim, PartitionIteratorType pitype >
163 typename Codim< codim > :: template Partition< pitype > :: IteratorType
164 begin () const
165 {
166 return leafGridView_.template begin< codim, pitype >();
167 }
168
170 template< int codim >
171 typename Codim< codim > :: IteratorType
172 end () const
173 {
174 return end< codim, InteriorBorder_Partition >();
175 }
176
178 template< int codim, PartitionIteratorType pitype >
179 typename Codim< codim > :: template Partition< pitype > :: IteratorType
180 end () const
181 {
182 return leafGridView_.template end< codim, pitype >();
183 }
184
187 ibegin ( const ElementType &entity ) const
188 {
189 return leafGridView_.ibegin( entity );
190 }
191
194 iend ( const ElementType &entity ) const
195 {
196 return leafGridView_.iend( entity );
197 }
198
200 template< class DataHandle, class Data >
202 {
203 return leafGridView_.communicate( data, iftype, dir );
204 }
205
206 protected:
207 const GridPartType& asImp() const
208 {
209 return static_cast<const GridPartType &> (*this);
210 }
211
213 {
214 return static_cast<GridPartType &> (*this);
215 }
216 };
217
225 template< class Grid, PartitionIteratorType idxpitype = All_Partition, bool onlyCodimensionZero = false >
226 class AdaptiveLeafGridPart;
227
229 template< class Grid, PartitionIteratorType idxpitype , bool onlyCodimensionZero >
231 {
232 public:
234 typedef Grid GridType;
235
238
241
243
244 protected:
245 // choose the AdaptiveIndexSet (based on the HierarchicIndexSet)
246 // to be revised
247 template < int dummy, bool onlyCodimZero >
254
255 template <int dummy>
262
263 // also for Cartesian grids (e.g. YaspGrid) use adaptive leaf index set in parallel
264 typedef AdaptiveLeafIndexSetChooser<-1, onlyCodimensionZero > IndexSetChooserType;
265
266 public:
269
272
273 // type of intersection iterator
274 typedef typename GridType::LeafGridView::IntersectionIterator IntersectionIteratorType;
275
276 template< int codim >
277 struct Codim
278 {
279 typedef typename GridType::template Codim< codim >::Geometry GeometryType;
280 typedef typename GridType::template Codim< codim >::LocalGeometry LocalGeometryType;
281
282 typedef typename GridType::template Codim< codim >::Entity EntityType;
283 typedef typename GridType::template Codim< codim >::EntitySeed EntitySeedType;
284
285 // GridView typedefs interface
290
291 template< PartitionIteratorType pitype >
293 {
295 // GridView typedef
297 };
298
300 // GridView typedef
302 };
303
306 };
307
308 template< class Grid, PartitionIteratorType idxpitype , bool onlyCodimensionZero >
310 : public AdaptiveGridPartBase< AdaptiveLeafGridPartTraits< Grid, idxpitype, onlyCodimensionZero > >
311 {
313 public:
314 typedef typename BaseType :: NoIndexSetType NoIndexSetType;
315 typedef typename BaseType :: GridType GridType;
316 typedef typename BaseType :: GridViewType GridViewType;
317 typedef typename BaseType :: GridPartType GridPartType;
320 : BaseType( grid )
321 {}
322
325 : BaseType( grid, dummy )
326 {}
327
329 AdaptiveLeafGridPart ( const AdaptiveLeafGridPart& other ) = default;
330 };
331
339 template< class Grid, PartitionIteratorType idxpitype = All_Partition >
341
342
343 template< class Grid, PartitionIteratorType idxpitype = All_Partition >
345
353 template< class Grid, PartitionIteratorType idxpitype >
363
371 template< class Grid, PartitionIteratorType idxpitype >
373 : public AdaptiveGridPartBase< IntersectionAdaptiveLeafGridPartTraits< Grid, idxpitype > >
374 {
376 public:
377 typedef typename BaseType :: NoIndexSetType NoIndexSetType;
378 typedef typename BaseType :: GridType GridType;
381 : BaseType( grid )
382 {
383 }
384
387 : BaseType( grid, noIndexSet )
388 {
389 }
390
393 };
394
395
396
397 // Capabilities
398 // ------------
399
400 namespace GridPartCapabilities
401 {
402
403 // Capabilities for AdaptiveLeafGridPart
404 // -------------------------------------
405
406 template< class Grid, PartitionIteratorType idxpitype, bool onlyCodimensionZero >
407 struct hasGrid< AdaptiveLeafGridPart< Grid, idxpitype, onlyCodimensionZero > >
408 {
409 static const bool v = true;
410 };
411
412 template< class Grid, PartitionIteratorType idxpitype, bool onlyCodimensionZero >
419
420 template< class Grid, PartitionIteratorType idxpitype, bool onlyCodimensionZero >
421 struct isCartesian< AdaptiveLeafGridPart< Grid, idxpitype, onlyCodimensionZero > >
422 {
424 };
425
426 template< class Grid, PartitionIteratorType idxpitype, bool onlyCodimensionZero, int codim >
427 struct hasEntity< AdaptiveLeafGridPart< Grid, idxpitype, onlyCodimensionZero >, codim >
428 {
430 };
431
432 template< class Grid, PartitionIteratorType idxpitype, bool onlyCodimensionZero, int codim >
433 struct canCommunicate< AdaptiveLeafGridPart< Grid, idxpitype, onlyCodimensionZero >, codim >
434 {
436 };
437
438 template< class Grid, PartitionIteratorType idxpitype, bool onlyCodimensionZero >
439 struct isConforming< AdaptiveLeafGridPart< Grid, idxpitype, onlyCodimensionZero > >
440 {
442 };
443
444
445 // Capabilities for DGAdaptiveLeafGridPart
446 // ---------------------------------------
447
448 template< class Grid, PartitionIteratorType idxpitype >
449 struct hasGrid< DGAdaptiveLeafGridPart< Grid, idxpitype > >
450 {
451 static const bool v = true;
452 };
453
454 template< class Grid, PartitionIteratorType idxpitype >
461
462 template< class Grid, PartitionIteratorType idxpitype >
464 {
466 };
467
468 template< class Grid, PartitionIteratorType idxpitype, int codim >
469 struct hasEntity< DGAdaptiveLeafGridPart< Grid, idxpitype >, codim >
470 {
472 };
473
474 template< class Grid, PartitionIteratorType idxpitype, int codim >
475 struct canCommunicate< DGAdaptiveLeafGridPart< Grid, idxpitype >, codim >
476 {
478 };
479
480 template< class Grid, PartitionIteratorType idxpitype >
485
486
487 // Capbilities for IntersectionAdaptiveLeafGridPart
488 // ------------------------------------------------
489
490 template< class Grid, PartitionIteratorType idxpitype >
492 {
493 static const bool v = true;
494 };
495
496 template< class Grid, PartitionIteratorType idxpitype >
503
504 template< class Grid, PartitionIteratorType idxpitype >
509
510 template< class Grid, PartitionIteratorType idxpitype, int codim >
511 struct hasEntity< IntersectionAdaptiveLeafGridPart< Grid, idxpitype >, codim >
512 {
514 };
515
516 template< class Grid, PartitionIteratorType idxpitype, int codim >
521
522 template< class Grid, PartitionIteratorType idxpitype >
527
528 } // namespace GridPartCapabilities
529
530 } // namespace Fem
531
532} // namespace Dune
533
534#endif // #ifndef DUNE_FEM_ADAPTIVELEAFGRIDPART_HH
PartitionIteratorType
CommunicationDirection
InterfaceType
InteriorBorder_Partition
InteriorBorder_All_Interface
InteriorBorder_InteriorBorder_Interface
Grid< dim, dimworld, ct, GridFamily >::LeafGridView leafGridView(const Grid< dim, dimworld, ct, GridFamily > &grid)
typename GridFamily::Traits::Communication Communication
Definition adaptiveleafgridpart.hh:41
static const InterfaceType value
Definition adaptiveleafgridpart.hh:42
A grid part with an index set specially designed for adaptive calculations.
Definition adaptiveleafgridpart.hh:66
SingletonList< const GridType *, IndexSetType > IndexSetProviderType
Definition adaptiveleafgridpart.hh:103
Traits::GridType GridType
Grid implementation type.
Definition adaptiveleafgridpart.hh:77
Traits::IndexSetType IndexSetType
The leaf index set of the grid implementation.
Definition adaptiveleafgridpart.hh:79
Codim< codim >::template Partition< pitype >::IteratorType begin() const
Begin iterator on the leaf level.
Definition adaptiveleafgridpart.hh:164
GridPartType GridViewType
Definition adaptiveleafgridpart.hh:99
std::integral_constant< bool, false > NoIndexSetType
Definition adaptiveleafgridpart.hh:97
IntersectionIteratorType iend(const ElementType &entity) const
iend of corresponding intersection iterator for given entity
Definition adaptiveleafgridpart.hh:194
GridPartType & asImp()
Definition adaptiveleafgridpart.hh:212
IntersectionIteratorType ibegin(const ElementType &entity) const
ibegin of corresponding intersection iterator for given entity
Definition adaptiveleafgridpart.hh:187
AdaptiveGridPartBase(const ThisType &other)=default
Copy Constructor.
LeafGridView leafGridView_
Definition adaptiveleafgridpart.hh:109
AdaptiveGridPartBase & operator=(const AdaptiveGridPartBase &other)=default
Codim< codim >::IteratorType begin() const
Begin iterator on the leaf level.
Definition adaptiveleafgridpart.hh:156
IndexSetType & indexSet()
Returns reference to index set of the underlying grid.
Definition adaptiveleafgridpart.hh:147
decltype(auto) communicate(CommDataHandleIF< DataHandle, Data > &data, InterfaceType iftype, CommunicationDirection dir) const
corresponding communication method for this grid part
Definition adaptiveleafgridpart.hh:201
Codim< 0 >::EntityType ElementType
Definition adaptiveleafgridpart.hh:106
AdaptiveGridPartBase(GridType &grid, const NoIndexSetType &noIndexSet)
Constructor constructing object held by index set (for iterator access)
Definition adaptiveleafgridpart.hh:130
TraitsImp Traits
Type definitions.
Definition adaptiveleafgridpart.hh:72
Codim< codim >::IteratorType end() const
Begin iterator on the leaf level.
Definition adaptiveleafgridpart.hh:172
const GridPartType & asImp() const
Definition adaptiveleafgridpart.hh:207
Traits::GridPartType GridPartType
Grid implementation type.
Definition adaptiveleafgridpart.hh:75
const IndexSetType & indexSet() const
Returns reference to index set of the underlying grid.
Definition adaptiveleafgridpart.hh:140
AdaptiveGridPartBase(GridType &grid)
constructor
Definition adaptiveleafgridpart.hh:116
std::shared_ptr< IndexSetType > indexSet_
Definition adaptiveleafgridpart.hh:112
Codim< codim >::template Partition< pitype >::IteratorType end() const
End iterator on the leaf level.
Definition adaptiveleafgridpart.hh:180
IntersectionIteratorType::Intersection IntersectionType
type of intersection
Definition adaptiveleafgridpart.hh:95
Traits::IntersectionIteratorType IntersectionIteratorType
type of intersection iterator
Definition adaptiveleafgridpart.hh:92
Struct providing types of the leaf iterators on codimension codim.
Definition adaptiveleafgridpart.hh:85
Definition adaptiveleafgridpart.hh:311
BaseType::NoIndexSetType NoIndexSetType
Definition adaptiveleafgridpart.hh:314
AdaptiveLeafGridPart(GridType &grid)
Constructor.
Definition adaptiveleafgridpart.hh:319
AdaptiveLeafGridPart(const AdaptiveLeafGridPart &other)=default
copy constructor
BaseType::GridViewType GridViewType
Definition adaptiveleafgridpart.hh:316
BaseType::GridType GridType
Definition adaptiveleafgridpart.hh:315
BaseType::GridPartType GridPartType
Definition adaptiveleafgridpart.hh:317
AdaptiveLeafGridPart(GridType &grid, const NoIndexSetType &dummy)
copy constructor (for construction from IndexSet, no public use)
Definition adaptiveleafgridpart.hh:324
Type definitions for the LeafGridPart class.
Definition adaptiveleafgridpart.hh:231
AdaptiveLeafGridPart< GridType, idxpitype, onlyCodimensionZero > GridPartType
type of the grid part , i.e. this type
Definition adaptiveleafgridpart.hh:237
Grid GridType
type of the grid
Definition adaptiveleafgridpart.hh:234
GridType::Communication CommunicationType
Definition adaptiveleafgridpart.hh:242
static const bool conforming
is true if grid on this view only has conforming intersections
Definition adaptiveleafgridpart.hh:305
IndexSetChooserType::IndexSetType IndexSetType
type of the index set
Definition adaptiveleafgridpart.hh:268
AdaptiveLeafIndexSetChooser<-1, onlyCodimensionZero > IndexSetChooserType
Definition adaptiveleafgridpart.hh:264
static const InterfaceType indexSetInterfaceType
Definition adaptiveleafgridpart.hh:271
GridType::LeafGridView::IntersectionIterator IntersectionIteratorType
Definition adaptiveleafgridpart.hh:274
static const PartitionIteratorType indexSetPartitionType
Definition adaptiveleafgridpart.hh:270
TwistUtility< GridType > TwistUtilityType
The type of the corresponding TwistUtility.
Definition adaptiveleafgridpart.hh:240
AdaptiveLeafIndexSet< GridPartType > IndexSetType
Definition adaptiveleafgridpart.hh:252
static const PartitionIteratorType indexSetPartitionType
Definition adaptiveleafgridpart.hh:250
static const InterfaceType indexSetInterfaceType
Definition adaptiveleafgridpart.hh:251
DGAdaptiveLeafIndexSet< GridPartType > IndexSetType
Definition adaptiveleafgridpart.hh:260
Definition adaptiveleafgridpart.hh:278
LocalGeometryType LocalGeometry
Definition adaptiveleafgridpart.hh:287
GridType::template Codim< codim >::Geometry GeometryType
Definition adaptiveleafgridpart.hh:279
EntitySeedType EntitySeed
Definition adaptiveleafgridpart.hh:289
GridType::template Codim< codim >::EntitySeed EntitySeedType
Definition adaptiveleafgridpart.hh:283
IteratorType Iterator
Definition adaptiveleafgridpart.hh:301
GridType::template Codim< codim >::LocalGeometry LocalGeometryType
Definition adaptiveleafgridpart.hh:280
EntityType Entity
Definition adaptiveleafgridpart.hh:288
GeometryType Geometry
Definition adaptiveleafgridpart.hh:286
Partition< InteriorBorder_Partition >::IteratorType IteratorType
Definition adaptiveleafgridpart.hh:299
GridType::template Codim< codim >::Entity EntityType
Definition adaptiveleafgridpart.hh:282
Definition adaptiveleafgridpart.hh:293
GridType::template Codim< codim >::template Partition< pitype >::LeafIterator IteratorType
Definition adaptiveleafgridpart.hh:294
IteratorType Iterator
Definition adaptiveleafgridpart.hh:296
A grid part with an index set specially designed for adaptive calculations including indices for inte...
Definition adaptiveleafgridpart.hh:374
IntersectionAdaptiveLeafGridPart(const IntersectionAdaptiveLeafGridPart &other)=default
copy constructor
IntersectionAdaptiveLeafGridPart(GridType &grid, const NoIndexSetType &noIndexSet)
copy constructor (for construction from IndexSet, no public use)
Definition adaptiveleafgridpart.hh:386
BaseType::GridType GridType
Definition adaptiveleafgridpart.hh:378
IntersectionAdaptiveLeafGridPart(GridType &grid)
Constructor.
Definition adaptiveleafgridpart.hh:380
BaseType::NoIndexSetType NoIndexSetType
Definition adaptiveleafgridpart.hh:377
A grid part with an index set specially designed for adaptive calculations including indices for inte...
Definition adaptiveleafgridpart.hh:355
IntersectionAdaptiveLeafGridPart< Grid, idxpitype > GridPartType
type of the grid part , i.e. this type
Definition adaptiveleafgridpart.hh:358
IntersectionAdaptiveLeafIndexSet< GridPartType > IndexSetType
type of the index set
Definition adaptiveleafgridpart.hh:361
consecutive, persistent index set for the leaf level based on the grid's hierarchy index set
Definition adaptiveleafindexset.hh:1357
Definition adaptiveleafindexset.hh:1431
consecutive, persistent index set for the leaf level based on the grid's hierarchy index set
Definition adaptiveleafindexset.hh:1502
specialize with 'false' if grid part has no underlying dune grid (default=true)
Definition gridpart/common/capabilities.hh:18
static const bool v
Definition gridpart/common/capabilities.hh:19
specialize with 'true' for if the codimension 0 entity of the grid part has only one possible geometr...
Definition gridpart/common/capabilities.hh:29
static const bool v
Definition gridpart/common/capabilities.hh:30
static const unsigned int topologyId
Definition gridpart/common/capabilities.hh:31
specialize with 'true' if the grid part is cartesian (default=false)
Definition gridpart/common/capabilities.hh:40
static const bool v
Definition gridpart/common/capabilities.hh:41
specialize with 'true' for all codims that a grid implements entities for (default=false)
Definition gridpart/common/capabilities.hh:50
static const bool v
Definition gridpart/common/capabilities.hh:51
specialize with 'true' for all codims that a grid can communicate data on (default=false)
Definition gridpart/common/capabilities.hh:60
static const bool v
Definition gridpart/common/capabilities.hh:61
specialize with 'true' if implementation guarantees conforming level grids. (default=false)
Definition gridpart/common/capabilities.hh:70
static const bool v
Definition gridpart/common/capabilities.hh:71
Default implementation for the GridPart classes.
Definition gridpart.hh:372
Traits::template Codim< EntitySeed::codimension >::EntityType entity(const EntitySeed &seed) const
obtain entity pointer from entity seed
Definition gridpart.hh:468
const GridType & grid() const
Returns const reference to the underlying grid.
Definition gridpart.hh:423
Utility to get twist from IntersectionIterator, if provided by grid (i.e. AlbertaGrid,...
Definition twistutility.hh:107
Singleton list for key/object pairs.
Definition singletonlist.hh:53