Go to the documentation of this file.
3 #ifndef DUNE_GEOGRID_GRID_HH
4 #define DUNE_GEOGRID_GRID_HH
6 #include <dune/common/deprecated.hh>
23 template<
class HostGr
id >
73 template<
class HostGr
id,
class CoordFunction = DefaultCoordFunction< HostGr
id >,
class Allocator = std::allocator<
void > >
77 < HostGrid::dimension, CoordFunction::dimRange, typename HostGrid::ctype,
78 GeoGrid::GridFamily< HostGrid, CoordFunction, Allocator > >,
86 < HostGrid::dimension, CoordFunction::dimRange,
typename HostGrid::ctype,
111 typedef typename GridFamily::Traits
Traits;
120 template<
int codim >
205 typedef typename Traits::ctype
ctype;
228 removeHostGrid_( false ),
229 levelIndexSets_( hostGrid_->
maxLevel()+1, nullptr, allocator ),
230 storageAllocator_( allocator )
245 removeHostGrid_( true ),
246 levelIndexSets_( hostGrid_->
maxLevel()+1, nullptr, allocator ),
247 storageAllocator_( allocator )
261 coordFunction_( new CoordFunction( this->
hostGrid() ) ),
262 removeHostGrid_( true ),
263 levelIndexSets_( hostGrid_->
maxLevel()+1, nullptr, allocator ),
264 storageAllocator_( allocator )
272 for(
unsigned int i = 0; i < levelIndexSets_.size(); ++i )
274 if( levelIndexSets_[ i ] )
275 delete( levelIndexSets_[ i ] );
278 if( removeHostGrid_ )
280 delete coordFunction_;
310 int size (
int level,
int codim )
const
354 return hostGrid().numBoundarySegments( );
362 assert( globalIdSet_ );
370 assert( localIdSet_ );
376 assert( levelIndexSets_.size() == (
size_t)(
maxLevel()+1) );
377 if( (level < 0) || (level >
maxLevel()) )
379 DUNE_THROW(
GridError,
"LevelIndexSet for nonexisting level " << level
394 assert( leafIndexSet_ );
395 return leafIndexSet_;
400 hostGrid().globalRefine( refCount );
461 const bool gridChanged=
hostGrid().loadBalance();
482 template<
class DataHandle,
class Data >
483 bool loadBalance ( CommDataHandleIF< DataHandle, Data > &datahandle )
485 typedef CommDataHandleIF< DataHandle, Data > DataHandleIF;
486 typedef GeoGrid :: CommDataHandle< Grid, DataHandleIF > WrappedDataHandle;
488 WrappedDataHandle wrappedDataHandle( *
this, datahandle );
489 const bool gridChanged =
hostGrid().loadBalance( wrappedDataHandle );
515 template<
class EntitySeed >
520 return EntityImpl( *
this, seed );
531 typedef typename LevelGridView::GridViewImp ViewImp;
538 typedef typename LeafGridView::GridViewImp ViewImp;
572 const int newNumLevels =
maxLevel()+1;
573 const int oldNumLevels = levelIndexSets_.size();
575 for(
int i = newNumLevels; i < oldNumLevels; ++i )
577 if( levelIndexSets_[ i ] )
578 delete levelIndexSets_[ i ];
580 levelIndexSets_.resize( newNumLevels,
nullptr );
595 template<
int codim >
604 return storageAllocator_.allocate(
size );
609 storageAllocator_.deallocate( (
char *)p,
size );
613 HostGrid *
const hostGrid_;
614 CoordFunction *coordFunction_;
615 bool removeHostGrid_;
616 mutable std::vector< LevelIndexSet *, typename Allocator::template rebind< LevelIndexSet * >::other > levelIndexSets_;
620 mutable typename Allocator::template rebind< char >::other storageAllocator_;
628 template<
class HostGr
id,
class CoordFunction,
class Allocator >
629 template<
int codim >
630 struct GeometryGrid< HostGrid, CoordFunction, Allocator >::Codim
631 :
public Base::template Codim< codim >
672 template< PartitionIteratorType pitype >
706 #endif // #ifndef DUNE_GEOGRID_GRID_HH
Traits::CollectiveCommunication CollectiveCommunication
communicator with all other processes having some part of the grid
Definition: geometrygrid/grid.hh:209
Different resources needed by all grid implementations.
Traits::HierarchicIterator HierarchicIterator
iterator over the grid hierarchy
Definition: geometrygrid/grid.hh:129
const LocalIdSet & localIdSet() const
Definition: geometrygrid/grid.hh:366
Definition: geometrygrid/grid.hh:24
GridFamily::Traits::LeafGridView LeafGridView
type of view for leaf grid
Definition: geometrygrid/grid.hh:141
size_t numBoundarySegments() const
returns the number of boundary segments within the macro grid
Definition: geometrygrid/grid.hh:352
actual implementation of the entity
Definition: geometrygrid/entity.hh:32
int size(GeometryType type) const
obtain number of leaf entities
Definition: geometrygrid/grid.hh:343
Traits::LevelIndexSet LevelIndexSet
type of level index set
Definition: geometrygrid/grid.hh:169
const GlobalIdSet & globalIdSet() const
Definition: geometrygrid/grid.hh:358
Traits::template Codim< codim >::template Partition< pitype >::LevelIterator LevelIterator
Definition: geometrygrid/grid.hh:680
void * allocateStorage(std::size_t size) const
Definition: geometrygrid/grid.hh:602
bool preAdapt()
Definition: geometrygrid/grid.hh:414
~GeometryGrid()
destructor
Definition: geometrygrid/grid.hh:270
int size(int codim) const
obtain number of leaf entities
Definition: geometrygrid/grid.hh:321
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
Traits::LocalIdSet LocalIdSet
type of local id set
Definition: geometrygrid/grid.hh:198
int getMark(const typename Codim< 0 >::Entity &entity) const
Definition: geometrygrid/grid.hh:409
GridFamily::Traits::LevelGridView LevelGridView
type of view for level grid
Definition: geometrygrid/grid.hh:143
HostGrid & hostGrid()
obtain mutable reference to the host grid
Definition: geometrygrid/grid.hh:554
Traits::template Codim< codim >::template Partition< pitype >::LeafIterator LeafIterator
Definition: geometrygrid/grid.hh:677
void globalRefine(int refCount)
Definition: geometrygrid/grid.hh:398
Grid abstract base class.
Definition: common/grid.hh:373
static const HostGrid::template Codim< codim >::Entity & getHostEntity(const typename Codim< codim >::Entity &entity)
Definition: geometrygrid/grid.hh:597
Definition: identity.hh:12
GridFamily::Traits Traits
type of the grid traits
Definition: geometrygrid/grid.hh:112
static std::conditional< std::is_reference< InterfaceType >::value, typename std::add_lvalue_reference< typename ReturnImplementationType< typename std::remove_reference< InterfaceType >::type >::ImplementationType >::type, typename std::remove_const< typename ReturnImplementationType< typename std::remove_reference< InterfaceType >::type >::ImplementationType >::type >::type getRealImplementation(InterfaceType &&i)
return real implementation of interface class
Definition: common/grid.hh:1026
GeometryGrid(HostGrid *hostGrid, CoordFunction *coordFunction, const Allocator &allocator=Allocator())
constructor
Definition: geometrygrid/grid.hh:242
Definition: geometrygrid/backuprestore.hh:21
LeafGridView leafGridView() const
View for the leaf grid.
Definition: geometrygrid/grid.hh:536
Traits::ctype ctype
type of vector coordinates (e.g., double)
Definition: geometrygrid/grid.hh:206
Definition: geometrygrid/entity.hh:55
const HostGrid & hostGrid() const
obtain constant reference to the host grid
Definition: geometrygrid/grid.hh:548
static void adapt(CoordFunctionInterface &coordFunction)
Definition: coordfunction.hh:321
Traits::GlobalIdSet GlobalIdSet
type of global id set
Definition: geometrygrid/grid.hh:181
Definition: geometrygrid/indexsets.hh:25
const CoordFunction & coordFunction() const
obtain constant reference to the coordinate function
Definition: geometrygrid/grid.hh:587
const CollectiveCommunication & comm() const
obtain CollectiveCommunication object
Definition: geometrygrid/grid.hh:442
Definition: geometrygrid/grid.hh:673
Traits::LevelIntersectionIterator LevelIntersectionIterator
iterator over intersections with other entities on the same level
Definition: geometrygrid/grid.hh:133
Traits::LeafIndexSet LeafIndexSet
type of leaf index set
Definition: geometrygrid/grid.hh:159
static std::conditional< std::is_reference< InterfaceType >::value, typename std::add_lvalue_reference< typename ReturnImplementationType< typename std::remove_reference< InterfaceType >::type >::ImplementationType >::type, typename std::remove_const< typename ReturnImplementationType< typename std::remove_reference< InterfaceType >::type >::ImplementationType >::type >::type getRealImplementation(InterfaceType &&i)
return real implementation of interface class
Definition: common/grid.hh:1026
Definition: geometrygrid/gridview.hh:27
Traits::LeafIntersectionIterator LeafIntersectionIterator
iterator over intersections with other entities on the leaf level
Definition: geometrygrid/grid.hh:131
const LeafIndexSet & leafIndexSet() const
Definition: geometrygrid/grid.hh:390
Traits::template Codim< EntitySeed::codimension >::Entity entity(const EntitySeed &seed) const
obtain Entity from EntitySeed
Definition: geometrygrid/grid.hh:517
const LevelIndexSet & levelIndexSet(int level) const
Definition: geometrygrid/grid.hh:374
CoordFunction & coordFunction()
obtain mutable reference to the coordinate function.
Definition: geometrygrid/grid.hh:590
void update()
update grid caches
Definition: geometrygrid/grid.hh:567
LevelGridView levelGridView(int level) const
View for a grid level.
Definition: geometrygrid/grid.hh:529
int maxLevel() const
obtain maximal grid level
Definition: geometrygrid/grid.hh:297
int size(int level, GeometryType type) const
obtain number of entites on a level
Definition: geometrygrid/grid.hh:334
Partition< All_Partition >::LevelIterator LevelIterator
type of level iterator
Definition: geometrygrid/grid.hh:699
GeometryGrid(HostGrid &hostGrid, CoordFunction &coordFunction, const Allocator &allocator=Allocator())
constructor
Definition: geometrygrid/grid.hh:225
Base class for exceptions in Dune grid modules.
Definition: exceptions.hh:16
GeometryGrid(HostGrid *hostGrid, const Allocator &allocator=Allocator())
constructor
Definition: geometrygrid/grid.hh:259
Definition: geometrygrid/gridfamily.hh:48
void deallocateStorage(void *p, std::size_t size) const
Definition: geometrygrid/grid.hh:607
bool adapt()
Definition: geometrygrid/grid.hh:419
int size(int level, int codim) const
obtain number of entites on a level
Definition: geometrygrid/grid.hh:310
Traits::template Codim< codim >::LocalGeometry LocalGeometry
type of local geometry
Definition: geometrygrid/grid.hh:665
Traits::template Codim< codim >::Entity Entity
type of entity
Definition: geometrygrid/grid.hh:640
bool mark(int refCount, const typename Codim< 0 >::Entity &entity)
Definition: geometrygrid/grid.hh:404
grid wrapper replacing the geometries
Definition: declaration.hh:10
Store a reference to an entity with a minimal memory footprint.
Definition: common/entityseed.hh:23
Traits::template Codim< codim >::Geometry Geometry
type of world geometry
Definition: geometrygrid/grid.hh:655
Partition< All_Partition >::LeafIterator LeafIterator
type of leaf iterator
Definition: geometrygrid/grid.hh:690
Definition: geometrygrid/gridfamily.hh:32
Definition: geometrygrid/entity.hh:58
Include standard header files.
Definition: agrid.hh:58
Definition: geometrygrid/intersection.hh:19
traits structure containing types for a codimension
Definition: geometrygrid/grid.hh:121
Definition: geometrygrid/geometry.hh:86
Definition: common/geometry.hh:24
Definition: geometrygrid/datahandle.hh:23
provides access to host grid objects from GeometryGrid
Definition: identitygrid.hh:36
void postAdapt()
Definition: geometrygrid/grid.hh:426