1 #ifndef DUNE_FEM_ADAPTIVELEAFGRIDPART_HH 2 #define DUNE_FEM_ADAPTIVELEAFGRIDPART_HH 5 #include <dune/common/typetraits.hh> 8 #include <dune/grid/common/gridview.hh> 42 template <PartitionIteratorType ittype>
45 static const InterfaceType
value = InteriorBorder_All_Interface;
50 static const InterfaceType
value = InteriorBorder_InteriorBorder_Interface;
66 template<
class TraitsImp >
87 :
public BaseType :: template
Codim< codim >
91 typedef typename GridType::LeafGridView LeafGridView;
103 const GridPartType& gridPart_;
104 const GridType& grid_;
105 Key(
const GridPartType& gridPart,
const GridType& grid)
106 : gridPart_( gridPart ), grid_( grid )
112 return (&grid_) == (& other.grid_ );
114 operator const GridPartType& ()
const {
return gridPart_; }
121 typedef typename Codim< 0 > :: EntityType ElementType;
124 LeafGridView leafGridView_ ;
127 const IndexSetType& indexSet_;
131 GridType &initDofManager(GridType &grid )
const 140 : BaseType( initDofManager( grid ) ),
141 leafGridView_( grid.leafGridView() ),
142 indexSet_( IndexSetProviderType::getObject( KeyType( asImp(), grid ) ) )
148 leafGridView_( other.leafGridView_ ),
149 indexSet_( IndexSetProviderType::getObject( KeyType( asImp(), other.grid() ) ) )
156 IndexSetProviderType::removeObject( indexSet() );
159 using BaseType::grid;
168 template<
int codim >
169 typename Codim< codim > :: IteratorType
172 return begin< codim, InteriorBorder_Partition >();
176 template<
int codim, PartitionIteratorType pitype >
177 typename Codim< codim > :: template Partition< pitype > :: IteratorType
180 return leafGridView_.template begin< codim, pitype >();
184 template<
int codim >
185 typename Codim< codim > :: IteratorType
188 return end< codim, InteriorBorder_Partition >();
192 template<
int codim, PartitionIteratorType pitype >
193 typename Codim< codim > :: template Partition< pitype > :: IteratorType
196 return leafGridView_.template end< codim, pitype >();
200 inline IntersectionIteratorType
201 ibegin (
const ElementType &entity )
const 203 return leafGridView_.ibegin( entity );
207 inline IntersectionIteratorType
208 iend (
const ElementType &entity )
const 210 return leafGridView_.iend( entity );
213 int boundaryId (
const IntersectionType &intersection )
const 215 return intersection.boundaryId();
221 return grid().maxLevel();
225 template<
class DataHandle,
class Data >
226 inline void communicate ( CommDataHandleIF< DataHandle, Data > &data,
227 InterfaceType iftype,
228 CommunicationDirection dir )
const 230 this->grid().communicate( data, iftype, dir );
236 return static_cast<const GridPartType &
> (*this);
247 template<
class Gr
id, PartitionIteratorType
idxpitype = All_Partition,
bool onlyCodimensionZero = false >
251 template<
class Gr
id, PartitionIteratorType
idxpitype ,
bool onlyCodimensionZero >
269 template <
int dummy,
bool onlyCodimZero >
272 static const PartitionIteratorType indexSetPartitionType = idxpitype;
280 static const PartitionIteratorType indexSetPartitionType = idxpitype;
292 static const PartitionIteratorType indexSetPartitionType = IndexSetChooserType::indexSetPartitionType;
293 static const InterfaceType indexSetInterfaceType = IndexSetChooserType::indexSetInterfaceType;
298 template<
int codim >
309 template< PartitionIteratorType pitype >
317 static const bool conforming = Dune::Capabilities::isLeafwiseConforming< GridType > :: v;
320 template<
class Gr
id, PartitionIteratorType
idxpitype ,
bool onlyCodimensionZero >
322 :
public AdaptiveGridPartBase< AdaptiveLeafGridPartTraits< Grid, idxpitype, onlyCodimensionZero > >
347 template<
class Gr
id, PartitionIteratorType
idxpitype = All_Partition >
367 template<
class Gr
id, PartitionIteratorType
idxpitype = All_Partition >
371 template<
class Gr
id, PartitionIteratorType
idxpitype >
389 template<
class Gr
id, PartitionIteratorType
idxpitype >
414 namespace GridPartCapabilities
420 template<
class Gr
id, PartitionIteratorType
idxpitype,
bool onlyCodimensionZero >
423 static const bool v =
true;
426 template<
class Gr
id, PartitionIteratorType
idxpitype,
bool onlyCodimensionZero >
429 static const bool v = Dune::Capabilities::hasSingleGeometryType< Grid >::v;
430 static const unsigned int topologyId
431 = Dune::Capabilities::hasSingleGeometryType< Grid >::topologyId;
434 template<
class Gr
id, PartitionIteratorType
idxpitype,
bool onlyCodimensionZero >
437 static const bool v = Dune::Capabilities::isCartesian< Grid >::v;
440 template<
class Gr
id, PartitionIteratorType
idxpitype,
bool onlyCodimensionZero,
int codim >
443 static const bool v = Dune::Capabilities::hasEntity< Grid, codim >::v;
446 template<
class Gr
id, PartitionIteratorType
idxpitype,
bool onlyCodimensionZero >
449 static const bool v = Dune::Capabilities::isParallel< Grid >::v;
452 template<
class Gr
id, PartitionIteratorType
idxpitype,
bool onlyCodimensionZero,
int codim >
455 static const bool v = Dune::Capabilities::canCommunicate< Grid, codim >::v;
458 template<
class Gr
id, PartitionIteratorType
idxpitype,
bool onlyCodimensionZero >
461 static const bool v = Dune::Capabilities::isLeafwiseConforming< Grid >::v;
468 template<
class Gr
id, PartitionIteratorType
idxpitype >
471 static const bool v =
true;
474 template<
class Gr
id, PartitionIteratorType
idxpitype >
477 static const bool v = Dune::Capabilities::hasSingleGeometryType< Grid >::v;
478 static const unsigned int topologyId
479 = Dune::Capabilities::hasSingleGeometryType< Grid >::topologyId;
482 template<
class Gr
id, PartitionIteratorType
idxpitype >
485 static const bool v = Dune::Capabilities::isCartesian< Grid >::v;
488 template<
class Gr
id, PartitionIteratorType
idxpitype,
int codim >
491 static const bool v = Dune::Capabilities::hasEntity< Grid, codim >::v;
494 template<
class Gr
id, PartitionIteratorType
idxpitype >
497 static const bool v = Dune::Capabilities::isParallel< Grid >::v;
500 template<
class Gr
id, PartitionIteratorType
idxpitype,
int codim >
503 static const bool v = Dune::Capabilities::canCommunicate< Grid, codim >::v;
506 template<
class Gr
id, PartitionIteratorType
idxpitype >
509 static const bool v = Dune::Capabilities::isLeafwiseConforming< Grid >::v;
516 template<
class Gr
id, PartitionIteratorType
idxpitype >
519 static const bool v =
true;
522 template<
class Gr
id, PartitionIteratorType
idxpitype >
525 static const bool v = Dune::Capabilities::hasSingleGeometryType< Grid >::v;
526 static const unsigned int topologyId
527 = Dune::Capabilities::hasSingleGeometryType< Grid >::topologyId;
530 template<
class Gr
id, PartitionIteratorType
idxpitype >
533 static const bool v = Dune::Capabilities::isCartesian< Grid >::v;
536 template<
class Gr
id, PartitionIteratorType
idxpitype,
int codim >
539 static const bool v = Dune::Capabilities::hasEntity< Grid, codim >::v;
542 template<
class Gr
id, PartitionIteratorType
idxpitype >
545 static const bool v = Dune::Capabilities::isParallel< Grid >::v;
548 template<
class Gr
id, PartitionIteratorType
idxpitype,
int codim >
551 static const bool v = Dune::Capabilities::canCommunicate< Grid, codim >::v;
554 template<
class Gr
id, PartitionIteratorType
idxpitype >
557 static const bool v = Dune::Capabilities::isLeafwiseConforming< Grid >::v;
566 #endif // #ifndef DUNE_FEM_ADAPTIVELEAFGRIDPART_HH Default implementation for the GridPart classes.
Definition: gridpart.hh:307
GridType::template Codim< codim >::LocalGeometry LocalGeometryType
Definition: adaptiveleafgridpart.hh:302
Utility to get twist from IntersectionIterator, if provided by grid (i.e. AlbertaGrid, ALUGrid) otherwise return default values (correct for YASP/SGRID).
Definition: twistutility.hh:83
IntersectionAdaptiveLeafGridPart(GridType &grid)
Constructor.
Definition: adaptiveleafgridpart.hh:397
AdaptiveLeafGridPart< GridType, idxpitype, onlyCodimensionZero > GridPartType
type of the grid part , i.e. this type
Definition: adaptiveleafgridpart.hh:259
~AdaptiveGridPartBase()
Destrcutor removeing index set, if only one reference left, index set removed.
Definition: adaptiveleafgridpart.hh:154
Traits::IntersectionIteratorType IntersectionIteratorType
type of intersection iterator
Definition: adaptiveleafgridpart.hh:95
GridType::template Codim< codim >::EntitySeed EntitySeedType
Definition: adaptiveleafgridpart.hh:307
BaseType::GridType GridType
Definition: adaptiveleafgridpart.hh:395
GridType::template Codim< codim >::EntityPointer EntityPointerType
Definition: adaptiveleafgridpart.hh:304
Traits::GridType GridType
Grid implementation type.
Definition: adaptiveleafgridpart.hh:80
AdaptiveLeafGridPart(GridType &grid)
Constructor.
Definition: adaptiveleafgridpart.hh:328
IntersectionIteratorType iend(const ElementType &entity) const
iend of corresponding intersection iterator for given entity
Definition: adaptiveleafgridpart.hh:208
IntersectionIteratorType::Intersection IntersectionType
type of intersection
Definition: adaptiveleafgridpart.hh:98
specialize with 'true' if implementation supports parallelism (default=false)
Definition: gridpart/common/capabilities.hh:59
Codim< codim >::template Partition< pitype >::IteratorType end() const
End iterator on the leaf level.
Definition: adaptiveleafgridpart.hh:194
BaseType::GridType GridType
Definition: adaptiveleafgridpart.hh:353
Singleton list for key/object pairs.
Definition: singletonlist.hh:49
GridType::LeafGridView::IntersectionIterator IntersectionIteratorType
Definition: adaptiveleafgridpart.hh:296
specialize with 'true' for all codims that a grid implements entities for (default=false) ...
Definition: gridpart/common/capabilities.hh:49
GridType::CollectiveCommunication CollectiveCommunicationType
Definition: adaptiveleafgridpart.hh:264
specialize with 'true' if implementation guarantees conforming level grids. (default=false) ...
Definition: gridpart/common/capabilities.hh:79
GridType::template Codim< codim >::Entity EntityType
Definition: adaptiveleafgridpart.hh:305
specialize with 'false' if grid part has no underlying dune grid (default=true)
Definition: gridpart/common/capabilities.hh:17
AdaptiveLeafIndexSet< GridPartType > IndexSetType
Definition: adaptiveleafgridpart.hh:274
IntersectionAdaptiveLeafIndexSet< GridPartType > IndexSetType
type of the index set
Definition: adaptiveleafgridpart.hh:379
DGAdaptiveLeafIndexSet< GridPartType > IndexSetType
Definition: adaptiveleafgridpart.hh:282
static const InterfaceType value
Definition: adaptiveleafgridpart.hh:45
Codim< codim >::IteratorType end() const
Begin iterator on the leaf level.
Definition: adaptiveleafgridpart.hh:186
IntersectionAdaptiveLeafGridPart(const IntersectionAdaptiveLeafGridPart &other)
copy constructor
Definition: adaptiveleafgridpart.hh:403
consecutive, persistent index set for the leaf level based on the grid's hierarchy index set ...
Definition: adaptiveleafindexset.hh:35
AdaptiveLeafGridPart(const AdaptiveLeafGridPart &other)
copy constructor
Definition: adaptiveleafgridpart.hh:334
specialize with 'true' for all codims that a grid can communicate data on (default=false) ...
Definition: gridpart/common/capabilities.hh:69
GridType::template Codim< codim >::Geometry GeometryType
Definition: adaptiveleafgridpart.hh:301
bool operator==(const Double &a, const Double &b)
Definition: double.hh:589
GridType::template Codim< codim >::template Partition< pitype >::LeafIterator IteratorType
Definition: adaptiveleafgridpart.hh:312
const IndexSetType & indexSet() const
Returns reference to index set of the underlying grid.
Definition: adaptiveleafgridpart.hh:162
Definition: coordinate.hh:4
Definition: adaptiveleafgridpart.hh:270
Type definitions for the LeafGridPart class.
Definition: adaptiveleafgridpart.hh:252
TwistUtility< GridType > TwistUtilityType
The type of the corresponding TwistUtility.
Definition: adaptiveleafgridpart.hh:262
const GridPartType & asImp() const
Definition: adaptiveleafgridpart.hh:234
AdaptiveGridPartBase(const ThisType &other)
Copy Constructor.
Definition: adaptiveleafgridpart.hh:146
AdaptiveGridPartBase(GridType &grid)
constructor
Definition: adaptiveleafgridpart.hh:139
AdaptiveLeafIndexSetChooser<-1, onlyCodimensionZero > IndexSetChooserType
Definition: adaptiveleafgridpart.hh:286
A grid part with an index set specially designed for adaptive calculations.
Definition: adaptiveleafgridpart.hh:348
specialize with 'true' for if the codimension 0 entity of the grid part has only one possible geometr...
Definition: gridpart/common/capabilities.hh:28
A grid part with an index set specially designed for adaptive calculations.
Definition: adaptiveleafgridpart.hh:67
Traits::IndexSetType IndexSetType
The leaf index set of the grid implementation.
Definition: adaptiveleafgridpart.hh:82
TraitsImp Traits
Type definitions.
Definition: adaptiveleafgridpart.hh:75
IndexSetChooserType::IndexSetType IndexSetType
type of the index set
Definition: adaptiveleafgridpart.hh:290
Definition: adaptiveleafgridpart.hh:310
Struct providing types of the leaf iterators on codimension codim.
Definition: adaptiveleafgridpart.hh:86
Type definitions for the LeafGridPart class.
Definition: adaptiveleafgridpart.hh:372
int level() const
Returns maxlevel of the grid.
Definition: adaptiveleafgridpart.hh:219
IntersectionAdaptiveLeafGridPart< Grid, idxpitype > GridPartType
type of the grid part , i.e. this type
Definition: adaptiveleafgridpart.hh:376
specialize with 'true' if the grid part is cartesian (default=false)
Definition: gridpart/common/capabilities.hh:39
int boundaryId(const IntersectionType &intersection) const
Definition: adaptiveleafgridpart.hh:213
consecutive, persistent index set for the leaf level based on the grid's hierarchy index set ...
Definition: adaptiveleafindexset.hh:31
Codim< codim >::template Partition< pitype >::IteratorType begin() const
Begin iterator on the leaf level.
Definition: adaptiveleafgridpart.hh:178
Definition: adaptiveleafgridpart.hh:248
BaseType::GridType GridType
Definition: adaptiveleafgridpart.hh:326
Grid GridType
type of the grid
Definition: adaptiveleafgridpart.hh:256
Definition: adaptiveleafgridpart.hh:43
IntersectionIteratorType ibegin(const ElementType &entity) const
ibegin of corresponding intersection iterator for given entity
Definition: adaptiveleafgridpart.hh:201
DGAdaptiveLeafGridPart(const DGAdaptiveLeafGridPart &other)
copy constructor
Definition: adaptiveleafgridpart.hh:361
Definition: adaptiveleafgridpart.hh:299
Codim< codim >::IteratorType begin() const
Begin iterator on the leaf level.
Definition: adaptiveleafgridpart.hh:170
Definition: adaptiveleafindexset.hh:33
A grid part with an index set specially designed for adaptive calculations.
Definition: adaptiveleafgridpart.hh:368
void communicate(CommDataHandleIF< DataHandle, Data > &data, InterfaceType iftype, CommunicationDirection dir) const
corresponding communication method for this grid part
Definition: adaptiveleafgridpart.hh:226
Traits::GridPartType GridPartType
Grid implementation type.
Definition: adaptiveleafgridpart.hh:78
DGAdaptiveLeafGridPart(GridType &grid)
Constructor.
Definition: adaptiveleafgridpart.hh:355
static ThisType & instance(const GridType &grid)
obtain a reference to the DofManager for a given grid
Definition: dofmanager.hh:1319