dune-grid 2.9.0
Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
Dune::GeometryGrid< HostGrid, CoordFunction, Allocator > Class Template Reference

grid wrapper replacing the geometries More...

#include <dune/grid/geometrygrid/grid.hh>

Classes

struct  Codim
 traits structure containing types for a codimension More...
 

Public Member Functions

const GlobalIdSetglobalIdSet () const
 
const LocalIdSetlocalIdSet () const
 
const LevelIndexSetlevelIndexSet (int level) const
 
const LeafIndexSetleafIndexSet () const
 
void globalRefine (int refCount)
 
bool mark (int refCount, const typename Codim< 0 >::Entity &entity_)
 
int getMark (const typename Codim< 0 >::Entity &entity_) const
 
bool preAdapt ()
 
bool adapt ()
 
void postAdapt ()
 

Protected Member Functions

void * allocateStorage (std::size_t size) const
 
void deallocateStorage (void *p, std::size_t size) const
 

Static Protected Member Functions

template<int codim>
static const HostGrid::template Codim< codim >::Entity & getHostEntity (const typename Codim< codim >::Entity &entity)
 

Traits

typedef GridFamily::Traits Traits
 type of the grid traits More...
 

Iterator Types

typedef Traits::HierarchicIterator HierarchicIterator
 iterator over the grid hierarchy More...
 
typedef Traits::LeafIntersectionIterator LeafIntersectionIterator
 iterator over intersections with other entities on the leaf level More...
 
typedef Traits::LevelIntersectionIterator LevelIntersectionIterator
 iterator over intersections with other entities on the same level More...
 

Grid View Types

typedef GridFamily::Traits::LeafGridView LeafGridView
 type of view for leaf grid More...
 
typedef GridFamily::Traits::LevelGridView LevelGridView
 type of view for level grid More...
 

Index and Id Set Types

typedef Traits::LeafIndexSet LeafIndexSet
 type of leaf index set More...
 
typedef Traits::LevelIndexSet LevelIndexSet
 type of level index set More...
 
typedef Traits::GlobalIdSet GlobalIdSet
 type of global id set More...
 
typedef Traits::LocalIdSet LocalIdSet
 type of local id set More...
 

Miscellaneous Types

typedef Traits::ctype ctype
 type of vector coordinates (e.g., double) More...
 
typedef Traits::Communication Communication
 communicator with all other processes having some part of the grid More...
 
typedef Communication CollectiveCommunication
 

Construction and Destruction

 GeometryGrid (HostGrid &hostGrid, CoordFunction &coordFunction, const Allocator &allocator=Allocator())
 constructor More...
 
 GeometryGrid (std::shared_ptr< HostGrid > hostGrid, std::shared_ptr< CoordFunction > coordFunction, const Allocator &allocator=Allocator())
 constructor More...
 
 GeometryGrid (std::shared_ptr< HostGrid > hostGrid, const Allocator &allocator=Allocator())
 constructor More...
 

Size Methods

int maxLevel () const
 obtain maximal grid level More...
 
int size (int level, int codim) const
 obtain number of entites on a level More...
 
int size (int codim) const
 obtain number of leaf entities More...
 
int size (int level, GeometryType type) const
 obtain number of entites on a level More...
 
int size (GeometryType type) const
 obtain number of leaf entities More...
 
size_t numBoundarySegments () const
 returns the number of boundary segments within the macro grid More...
 

Parallel Data Distribution and Communication Methods

const Communicationcomm () const
 obtain Communication object More...
 
template<class EntitySeed >
Traits::template Codim< EntitySeed::codimension >::Entity entity (const EntitySeed &seed) const
 obtain Entity from EntitySeed More...
 

Grid Views

LevelGridView levelGridView (int level) const
 View for a grid level. More...
 
LeafGridView leafGridView () const
 View for the leaf grid. More...
 

Miscellaneous Methods

const HostGrid & hostGrid () const
 obtain constant reference to the host grid More...
 
HostGrid & hostGrid ()
 obtain mutable reference to the host grid More...
 
void update ()
 update grid caches More...
 
const CoordFunction & coordFunction () const
 obtain constant reference to the coordinate function More...
 
CoordFunction & coordFunction ()
 obtain mutable reference to the coordinate function. More...
 

Detailed Description

template<class HostGrid, class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
class Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >

grid wrapper replacing the geometries

GeometryGrid wraps another DUNE grid and replaces its geometry by the generic geometries from dune-grid. These are linear (respectively n-linear) DUNE geometries interpolating some given corners. These corners are obtained by mapping the corners of the host grid's geometry (also called host geometry) by a coordinate function.

An example of a coordinate function is given by the following code:

class ExampleFunction
: public Dune :: AnalyticalCoordFunction< double, 2, 3, ExampleFunction >
{
typedef ExampleFunction This;
typedef Dune :: AnalyticalCoordFunction< double, 2, 3, This > Base;
public:
typedef Base :: DomainVector DomainVector;
typedef Base :: RangeVector RangeVector;
void evaluate ( const DomainVector &x, RangeVector &y ) const
{
y[ 0 ] = x[ 0 ];
y[ 1 ] = x[ 1 ];
y[ 2 ] = x[ 0 ] + x[ 1 ];
}
};
Include standard header files.
Definition: agrid.hh:60
Definition: common/grid.hh:862
Derive an implementation of an analytical coordinate function from this class.
Definition: coordfunction.hh:134
Note
A dune-fem Function can be used as a coordinate function. The evaluation of discrete functions would be very expensive, though.
Template Parameters
HostGridDUNE grid to be wrapped (called host grid)
CoordFunctioncoordinate function

Member Typedef Documentation

◆ CollectiveCommunication

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
typedef Communication Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::CollectiveCommunication
Deprecated:
Use Communication instead! Will be removed after Dune 2.9.

◆ Communication

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
typedef Traits::Communication Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::Communication

communicator with all other processes having some part of the grid

◆ ctype

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
typedef Traits::ctype Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::ctype

type of vector coordinates (e.g., double)

◆ GlobalIdSet

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
typedef Traits::GlobalIdSet Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::GlobalIdSet

type of global id set

The id set assigns a unique identifier to each entity within the grid. This identifier is unique over all processes sharing this grid.

Note
Id's are neither consecutive nor necessarily of an integral type.

The global id set is a model of Dune::IdSet.

◆ HierarchicIterator

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
typedef Traits::HierarchicIterator Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::HierarchicIterator

iterator over the grid hierarchy

◆ LeafGridView

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
typedef GridFamily::Traits::LeafGridView Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::LeafGridView

type of view for leaf grid

◆ LeafIndexSet

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
typedef Traits::LeafIndexSet Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::LeafIndexSet

type of leaf index set

The index set assigns consecutive indices to the entities of the leaf grid. The indices are of integral type and can be used to access arrays.

The leaf index set is a model of Dune::IndexSet.

◆ LeafIntersectionIterator

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
typedef Traits::LeafIntersectionIterator Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::LeafIntersectionIterator

iterator over intersections with other entities on the leaf level

◆ LevelGridView

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
typedef GridFamily::Traits::LevelGridView Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::LevelGridView

type of view for level grid

◆ LevelIndexSet

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
typedef Traits::LevelIndexSet Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::LevelIndexSet

type of level index set

The index set assigns consecutive indices to the entities of a grid level. The indices are of integral type and can be used to access arrays.

The level index set is a model of Dune::IndexSet.

◆ LevelIntersectionIterator

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
typedef Traits::LevelIntersectionIterator Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::LevelIntersectionIterator

iterator over intersections with other entities on the same level

◆ LocalIdSet

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
typedef Traits::LocalIdSet Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::LocalIdSet

type of local id set

The id set assigns a unique identifier to each entity within the grid. This identifier needs only to be unique over this process.

Though the local id set may be identical to the global id set, it is often implemented more efficiently.

Note
Ids are neither consecutive nor necessarily of an integral type.
Local ids need not be compatible with global ids. Also, no mapping from local ids to global ones needs to exist.

The global id set is a model of Dune::IdSet.

◆ Traits

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
typedef GridFamily::Traits Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::Traits

type of the grid traits

Constructor & Destructor Documentation

◆ GeometryGrid() [1/3]

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::GeometryGrid ( HostGrid &  hostGrid,
CoordFunction &  coordFunction,
const Allocator &  allocator = Allocator() 
)
inline

constructor

The references to host grid and coordinate function are stored in the grid. Therefore, they must remain valid until the grid is destroyed.

Parameters
[in]hostGridreference to the grid to wrap
[in]coordFunctionreference to the coordinate function
[in]allocatorstorage allocator

◆ GeometryGrid() [2/3]

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::GeometryGrid ( std::shared_ptr< HostGrid >  hostGrid,
std::shared_ptr< CoordFunction >  coordFunction,
const Allocator &  allocator = Allocator() 
)
inline

constructor

The grid takes ownership of the pointers to host grid and coordinate function. They will be deleted when the grid is destroyed.

Parameters
[in]hostGridshared pointer to the grid to wrap
[in]coordFunctionshared pointer to the coordinate function
[in]allocatorstorage allocator

◆ GeometryGrid() [3/3]

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::GeometryGrid ( std::shared_ptr< HostGrid >  hostGrid,
const Allocator &  allocator = Allocator() 
)
inline

constructor

The grid takes ownership of the pointer to host grid and it will be deleted when the grid is destroyed. The coordinate function is automatically constructed.

Parameters
[in]hostGridshared pointer to the grid to wrap
[in]allocatorstorage allocator

Member Function Documentation

◆ adapt()

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
bool Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::adapt ( )
inline

◆ allocateStorage()

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
void * Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::allocateStorage ( std::size_t  size) const
inlineprotected

◆ comm()

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
const Communication & Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::comm ( ) const
inline

obtain Communication object

The Communication object should be used to globally communicate information between all processes sharing this grid.

Note
The Communication object returned is identical to the one returned by the host grid.

◆ coordFunction() [1/2]

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
CoordFunction & Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::coordFunction ( )
inline

obtain mutable reference to the coordinate function.

◆ coordFunction() [2/2]

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
const CoordFunction & Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::coordFunction ( ) const
inline

obtain constant reference to the coordinate function

◆ deallocateStorage()

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
void Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::deallocateStorage ( void *  p,
std::size_t  size 
) const
inlineprotected

◆ entity()

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
template<class EntitySeed >
Traits::template Codim< EntitySeed::codimension >::Entity Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::entity ( const EntitySeed seed) const
inline

obtain Entity from EntitySeed

EntitySeed survives to a grid modification which only changes the grid coordinates. Therefore it is consistent to use an EntitySeed to rebuild an Entity after this kind of grid modification.

An example of this is given by the following code:

// store seed of the first entity in the leaf view
const auto& gv = grid.leafGridView();
const auto& entity = (*(gv.template begin<0>()));
auto seed = entity.seed();
// perform a grid modification
grid.coordFunction().setTime(t);
// rebuild first entity from the seed
const auto& newEntity = grid.entity(seed);
EntitySeed seed() const
Return the entity seed which contains sufficient information to generate the entity again and uses as...
Definition: common/entity.hh:167
Traits::template Codim< EntitySeed::codimension >::Entity entity(const EntitySeed &seed) const
obtain Entity from EntitySeed
Definition: geometrygrid/grid.hh:507

◆ getHostEntity()

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
template<int codim>
static const HostGrid::template Codim< codim >::Entity & Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::getHostEntity ( const typename Codim< codim >::Entity &  entity)
inlinestaticprotected

◆ getMark()

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
int Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::getMark ( const typename Codim< 0 >::Entity &  entity_) const
inline

◆ globalIdSet()

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
const GlobalIdSet & Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::globalIdSet ( ) const
inline

◆ globalRefine()

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
void Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::globalRefine ( int  refCount)
inline

◆ hostGrid() [1/2]

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
HostGrid & Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::hostGrid ( )
inline

obtain mutable reference to the host grid

◆ hostGrid() [2/2]

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
const HostGrid & Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::hostGrid ( ) const
inline

obtain constant reference to the host grid

◆ leafGridView()

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
LeafGridView Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::leafGridView ( ) const
inline

View for the leaf grid.

◆ leafIndexSet()

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
const LeafIndexSet & Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::leafIndexSet ( ) const
inline

◆ levelGridView()

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
LevelGridView Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::levelGridView ( int  level) const
inline

View for a grid level.

◆ levelIndexSet()

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
const LevelIndexSet & Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::levelIndexSet ( int  level) const
inline

◆ localIdSet()

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
const LocalIdSet & Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::localIdSet ( ) const
inline

◆ mark()

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
bool Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::mark ( int  refCount,
const typename Codim< 0 >::Entity &  entity_ 
)
inline

◆ maxLevel()

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
int Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::maxLevel ( ) const
inline

obtain maximal grid level

Grid levels are numbered 0, ..., L, where L is the value returned by this method.

Returns
maximal grid level

◆ numBoundarySegments()

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
size_t Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::numBoundarySegments ( ) const
inline

returns the number of boundary segments within the macro grid

Returns
number of boundary segments within the macro grid

◆ postAdapt()

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
void Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::postAdapt ( )
inline

◆ preAdapt()

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
bool Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::preAdapt ( )
inline

◆ size() [1/4]

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
int Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::size ( GeometryType  type) const
inline

obtain number of leaf entities

Returns
number of leaf entities with a geometry of type type

◆ size() [2/4]

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
int Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::size ( int  codim) const
inline

obtain number of leaf entities

Parameters
[in]codimcodimension to consider
Returns
number of leaf entities of codimension codim

◆ size() [3/4]

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
int Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::size ( int  level,
GeometryType  type 
) const
inline

obtain number of entites on a level

Parameters
[in]levellevel to consider
[in]typegeometry type to consider
Returns
number of entities with a geometry of type type on grid level level.

◆ size() [4/4]

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
int Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::size ( int  level,
int  codim 
) const
inline

obtain number of entites on a level

Parameters
[in]levellevel to consider
[in]codimcodimension to consider
Returns
number of entities of codimension codim on grid level level.

◆ update()

template<class HostGrid , class CoordFunction = DefaultCoordFunction< HostGrid >, class Allocator = std::allocator< void >>
void Dune::GeometryGrid< HostGrid, CoordFunction, Allocator >::update ( )
inline

update grid caches

This method has to be called whenever the underlying host grid changes.

Note
If you adapt the host grid through this geometry grid's adaptation or load balancing methods, update is automatically called.

The documentation for this class was generated from the following files: