Dune::SubGrid< dim, HostGrid, MapIndexStorage > Class Template Reference

[ provides Dune::Grid ] More...

#include <subgrid.hh>

List of all members.

Public Types

typedef HostGrid HostGridType
typedef SelectType
< MapIndexStorage,
SubGridMapIndexStorage< const
SubGrid< dim, HostGrid,
MapIndexStorage >
>, SubGridVectorIndexStorage
< const SubGrid< dim, HostGrid,
MapIndexStorage > > >::Type 
IndexStorageType
typedef SubGridFamily< dim,
HostGrid, MapIndexStorage > 
GridFamily
 type of the used GridFamily for this grid
typedef SubGridFamily< dim,
HostGrid, MapIndexStorage >
::Traits 
Traits
 the Traits
typedef HostGrid::ctype ctype
 The type used to store coordinates, inherited from the HostGrid.

Public Member Functions

 SubGrid (HostGrid &hostgrid)
 Constructor.
 ~SubGrid ()
 Desctructor.
std::string name () const
 return grid name
int maxLevel () const
template<int codim>
Traits::template Codim< codim >
::LevelIterator 
lbegin (int level) const
 Iterator to first entity of given codim on level.
template<int codim>
Traits::template Codim< codim >
::LevelIterator 
lend (int level) const
 one past the end on this level
template<int codim, PartitionIteratorType PiType>
Traits::template Codim< codim >
::template Partition< PiType >
::LevelIterator 
lbegin (int level) const
 Iterator to first entity of given codim on level.
template<int codim, PartitionIteratorType PiType>
Traits::template Codim< codim >
::template Partition< PiType >
::LevelIterator 
lend (int level) const
 one past the end on this level
template<int codim>
Traits::template Codim< codim >
::LeafIterator 
leafbegin () const
 Iterator to first leaf entity of given codim.
template<int codim>
Traits::template Codim< codim >
::LeafIterator 
leafend () const
 one past the end of the sequence of leaf entities
template<int codim, PartitionIteratorType PiType>
Traits::template Codim< codim >
::template Partition< PiType >
::LeafIterator 
leafbegin () const
 Iterator to first leaf entity of given codim.
template<int codim, PartitionIteratorType PiType>
Traits::template Codim< codim >
::template Partition< PiType >
::LeafIterator 
leafend () const
 one past the end of the sequence of leaf entities
int size (int level, int codim) const
 Number of grid entities per level and codim.
int size (int codim) const
 number of leaf entities per codim in this process
int size (int level, GeometryType type) const
 number of entities per level, codim and geometry type in this process
int size (GeometryType type) const
 number of leaf entities per codim and geometry type in this process
const Traits::GlobalIdSet & globalIdSet () const
 Access to the GlobalIdSet.
const Traits::LocalIdSet & localIdSet () const
 Access to the LocalIdSet.
const Traits::LevelIndexSet & levelIndexSet (int level) const
 Access to the LevelIndexSets.
const Traits::LeafIndexSet & leafIndexSet () const
 Access to the LeafIndexSet.
unsigned int overlapSize (int codim) const
 Size of the overlap on the leaf level.
unsigned int ghostSize (int codim) const
 Size of the ghost cell layer on the leaf level.
unsigned int overlapSize (int level, int codim) const
 Size of the overlap on a given level.
unsigned int ghostSize (int level, int codim) const
 Size of the ghost cell layer on a given level.
const CollectiveCommunication
< SubGrid > & 
comm () const
Grid Refinement Methods


void globalRefine (int refCount)
bool mark (int refCount, const typename Traits::template Codim< 0 >::EntityPointer &e) DUNE_DEPRECATED
 Deprecated wrapper, only present for compatiblity reasons !
bool mark (int refCount, const typename Traits::template Codim< 0 >::Entity &e)
 Mark entity for refinement.
int getMark (const typename Traits::template Codim< 0 >::EntityPointer &e) const DUNE_DEPRECATED
 Deprecated wrapper, only present for compatiblity reasons !
int getMark (const typename Traits::template Codim< 0 >::Entity &e) const
 Return refinement mark for entity.
bool preAdapt ()
bool adapt ()
 Triggers the grid refinement process.
void postAdapt ()
 Clean up refinement markers.
Subgrid Creation Methods


void createBegin ()
 Begin subgrid creation.
void createEnd ()
 Complete subgrid creation.
void insertRaw (const typename HostGrid::Traits::template Codim< HostGrid::dimension-dim >::Entity &e)
 Insert this element only !
void add (const typename HostGrid::Traits::template Codim< HostGrid::dimension-dim >::EntityPointer &e) DUNE_DEPRECATED
 Insert this element only !
void insertLevel (int level)
 Insert hostgrid level !
void addLevel (int level) DUNE_DEPRECATED
 Insert hostgrid level !
void insertLeaf ()
 Insert hostgrid leaf level !
void addLeaf () DUNE_DEPRECATED
 Insert hostgrid leaf level !
template<class Container>
void insertSet (const Container &idContainer)
 Inserts all elements in the container, all ancestors and all direct children of the ancestors.
template<class Container>
void addAllWithAncestor (const Container &idContainer)
 Inserts all elements in the container, all ancestors and all direct children of the ancestors.
void insert (const typename HostGrid::Traits::template Codim< HostGrid::dimension-dim >::Entity &e)
 Inserts this element, all ancestors and all direct children of the ancestors.
void addWithAncestor (const typename HostGrid::Traits::template Codim< HostGrid::dimension-dim >::EntityPointer &e) DUNE_DEPRECATED
 Inserts this element, all ancestors and all direct children of the ancestors.
void insertPartial (const typename HostGrid::Traits::template Codim< HostGrid::dimension-dim >::Entity &e)
 Inserts this element and all ancestors.
void addPartial (const typename HostGrid::Traits::template Codim< HostGrid::dimension-dim >::EntityPointer &e) DUNE_DEPRECATED
 Inserts this element and all ancestors.
Special Subgrid Methods


template<int codim>
bool contains (const typename HostGrid::Traits::template Codim< codim >::Entity &e) const
 Returns true if hostgrid entity is contained in subgrid.
template<int codim>
bool contains (const typename HostGrid::Traits::template Codim< codim >::EntityPointer &e) const
 Returns true if hostgrid entity is contained in subgrid.
HostGridTypegetHostGrid () const
 Returns the hostgrid this subgrid lives in.
template<int codim>
HostGrid::Traits::template
Codim< codim >::EntityPointer 
getHostEntity (const typename Traits::template Codim< codim >::Entity &e) const
 Returns the hostgrid entity encapsulated in given subgrid entity.
template<int codim>
Traits::template Codim< codim >
::EntityPointer 
getSubGridEntity (const typename HostGrid::Traits::template Codim< codim >::Entity &e) const
 Returns the subgrid entity encapsulating a given hostgrid entity.
bool hostGridAdapted ()
 Track hostgrid adaptation.
void setMaxLevelDifference (int maxLevelDiff)
 Set the maximal difference of levels that elements containing a common vertex should have.
template<class ElementTransfer>
void transfer (ElementTransfer &elementTransfer) const
bool shrinkHostGrid (int maxAdaptations=100, bool recreateSubgrid=true)
 Shrink hostgrid to subgrid size.
void report () const
 Print subgrid status information.

Protected Member Functions

template<int codim>
bool isLeaf (const typename Traits::template Codim< codim >::Entity &e) const
template<int codim>
bool isLeaf (const typename HostGrid::Traits::template Codim< codim >::Entity &e) const
bool wasRefined (const typename Traits::template Codim< 0 >::Entity &e) const

Protected Attributes

IndexStorageType indexStorage

Friends

class SubGridLevelIndexSet< const SubGrid< dim, HostGrid, MapIndexStorage > >
class SubGridLeafIndexSet< const SubGrid< dim, HostGrid, MapIndexStorage > >
class SubGridGlobalIdSet< const SubGrid< dim, HostGrid, MapIndexStorage > >
class SubGridLocalIdSet< const SubGrid< dim, HostGrid, MapIndexStorage > >
class SubGridHierarchicIterator< const SubGrid< dim, HostGrid, MapIndexStorage > >
class SubGridLevelIntersectionIterator< const SubGrid< dim, HostGrid, MapIndexStorage > >
class SubGridLeafIntersectionIterator< const SubGrid< dim, HostGrid, MapIndexStorage > >
class SubGridBasicIntersectionIterator< const SubGrid< dim, HostGrid, MapIndexStorage > >
class SubGridIndexStorageBase< const SubGrid< dim, HostGrid, MapIndexStorage > >
class SubGridMapIndexStorage< const SubGrid< dim, HostGrid, MapIndexStorage > >
class SubGridVectorIndexStorage< const SubGrid< dim, HostGrid, MapIndexStorage > >
class SubGridLevelIterator
class SubGridLeafIterator
class SubGridEntity

Classes

class  NeighborLevels


Detailed Description

template<int dim, class HostGrid, bool MapIndexStorage = false>
class Dune::SubGrid< dim, HostGrid, MapIndexStorage >

[ provides Dune::Grid ]

Template Parameters:
dim Dimension of the subgrid
HostGrid The type of the grid that we are taking elements of
MapIndexStorage true: use a MapIndexStorage, false: use a VectorIndexStorage

Member Typedef Documentation

template<int dim, class HostGrid, bool MapIndexStorage = false>
typedef HostGrid Dune::SubGrid< dim, HostGrid, MapIndexStorage >::HostGridType

Todo:
Should not be public


Member Function Documentation

template<int dim, class HostGrid, bool MapIndexStorage = false>
int Dune::SubGrid< dim, HostGrid, MapIndexStorage >::maxLevel (  )  const [inline]

template<int dim, class HostGrid, bool MapIndexStorage = false>
void Dune::SubGrid< dim, HostGrid, MapIndexStorage >::globalRefine ( int  refCount  )  [inline]

template<int dim, class HostGrid, bool MapIndexStorage = false>
bool Dune::SubGrid< dim, HostGrid, MapIndexStorage >::mark ( int  refCount,
const typename Traits::template Codim< 0 >::Entity &  e 
) [inline]

Mark entity for refinement.

This only works for entities of codim 0. The parameter is currently ignored

Returns:
  • true, if marking was succesfull
  • false, if marking was not possible

References Dune::SubGrid< dim, HostGrid, MapIndexStorage >::adapt(), Dune::SubGrid< dim, HostGrid, MapIndexStorage >::levelIndexSet(), and Dune::SubGrid< dim, HostGrid, MapIndexStorage >::postAdapt().

template<int dim, class HostGrid, bool MapIndexStorage = false>
int Dune::SubGrid< dim, HostGrid, MapIndexStorage >::getMark ( const typename Traits::template Codim< 0 >::Entity &  e  )  const [inline]

Return refinement mark for entity.

Returns:
refinement mark (1,0,-1)

References Dune::SubGrid< dim, HostGrid, MapIndexStorage >::levelIndexSet().

template<int dim, class HostGrid, bool MapIndexStorage = false>
bool Dune::SubGrid< dim, HostGrid, MapIndexStorage >::preAdapt (  )  [inline]

template<int dim, class HostGrid, bool MapIndexStorage = false>
const CollectiveCommunication<SubGrid>& Dune::SubGrid< dim, HostGrid, MapIndexStorage >::comm (  )  const [inline]

dummy collective communication

template<int dim, class HostGrid, bool MapIndexStorage = false>
void Dune::SubGrid< dim, HostGrid, MapIndexStorage >::createBegin (  )  [inline]

Begin subgrid creation.

Begins subgrid creation. After calling this method you can insert elements to the subgrid using the insert*() methods. To complete subgrid creation you must call createEnd()

This method can also called again to recreate an already created subgrid. In this case all information in this object belonging to the old subgrid is lost and new and old indices in the subgrid may differ. (like adaptation)

References Dune::SubGrid< dim, HostGrid, MapIndexStorage >::size().

Referenced by Dune::SubGrid< dim, HostGrid, MapIndexStorage >::adapt(), and Dune::SubGrid< dim, HostGrid, MapIndexStorage >::shrinkHostGrid().

template<int dim, class HostGrid, bool MapIndexStorage = false>
void Dune::SubGrid< dim, HostGrid, MapIndexStorage >::createEnd (  )  [inline]

Complete subgrid creation.

You should first call createBegin() and then insert elements to the subgrid using the insert*() methods.

This may take some time since the hostgrid is traversed to mark subentities and to compute level and leaf indices.

References Dune::SubGrid< dim, HostGrid, MapIndexStorage >::maxLevel(), and Dune::SubGrid< dim, HostGrid, MapIndexStorage >::size().

Referenced by Dune::SubGrid< dim, HostGrid, MapIndexStorage >::adapt(), and Dune::SubGrid< dim, HostGrid, MapIndexStorage >::shrinkHostGrid().

template<int dim, class HostGrid, bool MapIndexStorage = false>
void Dune::SubGrid< dim, HostGrid, MapIndexStorage >::insertRaw ( const typename HostGrid::Traits::template Codim< HostGrid::dimension-dim >::Entity &  e  )  [inline]

Insert this element only !

Calling this methods may result in an unconsistent subgrid ! Therefore it should only be used internally.

If you know what you're doing you may use it externally to speed up subgrid creation. In this case you must take care for consistency yourself.

Referenced by Dune::SubGrid< dim, HostGrid, MapIndexStorage >::adapt(), and Dune::SubGrid< dim, HostGrid, MapIndexStorage >::add().

template<int dim, class HostGrid, bool MapIndexStorage = false>
void Dune::SubGrid< dim, HostGrid, MapIndexStorage >::add ( const typename HostGrid::Traits::template Codim< HostGrid::dimension-dim >::EntityPointer &  e  )  [inline]

Insert this element only !

DEPRECATED: Use insertRaw() instead !

Calling this methods may result in an unconsistent subgrid ! Therefore it should only be used internally.

If you know what you're doing you may use it externally to speed up subgrid creation. In this case you must take care for consistency yourself.

References Dune::SubGrid< dim, HostGrid, MapIndexStorage >::insertRaw().

template<int dim, class HostGrid, bool MapIndexStorage = false>
void Dune::SubGrid< dim, HostGrid, MapIndexStorage >::insertLevel ( int  level  )  [inline]

Insert hostgrid level !

Add a complete hostgrid level to the subgrid. This will also insert all lower levels.

References Dune::SubGrid< dim, HostGrid, MapIndexStorage >::size().

Referenced by Dune::SubGrid< dim, HostGrid, MapIndexStorage >::addLevel().

template<int dim, class HostGrid, bool MapIndexStorage = false>
void Dune::SubGrid< dim, HostGrid, MapIndexStorage >::addLevel ( int  level  )  [inline]

Insert hostgrid level !

DEPRECATED: Use insertLevel() instead !

Add a complete hostgrid level to the subgrid. This will also insert all lower levels.

References Dune::SubGrid< dim, HostGrid, MapIndexStorage >::insertLevel().

template<int dim, class HostGrid, bool MapIndexStorage = false>
void Dune::SubGrid< dim, HostGrid, MapIndexStorage >::insertLeaf (  )  [inline]

Insert hostgrid leaf level !

Add the complete hostgrid leaf level to the subgrid. This will also insert all lower level elements.

References Dune::SubGrid< dim, HostGrid, MapIndexStorage >::size().

Referenced by Dune::SubGrid< dim, HostGrid, MapIndexStorage >::addLeaf().

template<int dim, class HostGrid, bool MapIndexStorage = false>
void Dune::SubGrid< dim, HostGrid, MapIndexStorage >::addLeaf (  )  [inline]

Insert hostgrid leaf level !

DEPRECATED: Use insertLeaf() instead !

Add the complete hostgrid leaf level to the subgrid. This will also insert all lower level elements.

References Dune::SubGrid< dim, HostGrid, MapIndexStorage >::insertLeaf().

template<int dim, class HostGrid, bool MapIndexStorage = false>
template<class Container>
void Dune::SubGrid< dim, HostGrid, MapIndexStorage >::insertSet ( const Container &  idContainer  )  [inline]

Inserts all elements in the container, all ancestors and all direct children of the ancestors.

This will result in a subgrid where the leaf level covers the same domain as level 0. Although this domain might be smaller than the domain covered level 0 of the hostgrid

References Dune::SubGrid< dim, HostGrid, MapIndexStorage >::insert().

Referenced by Dune::SubGrid< dim, HostGrid, MapIndexStorage >::addAllWithAncestor().

template<int dim, class HostGrid, bool MapIndexStorage = false>
template<class Container>
void Dune::SubGrid< dim, HostGrid, MapIndexStorage >::addAllWithAncestor ( const Container &  idContainer  )  [inline]

Inserts all elements in the container, all ancestors and all direct children of the ancestors.

DEPRECATED: Use insertSet() instead !

This will result in a subgrid where the leaf level covers the same domain as level 0. Although this domain might be smaller than the domain covered level 0 of the hostgrid

References Dune::SubGrid< dim, HostGrid, MapIndexStorage >::insertSet().

template<int dim, class HostGrid, bool MapIndexStorage = false>
void Dune::SubGrid< dim, HostGrid, MapIndexStorage >::insert ( const typename HostGrid::Traits::template Codim< HostGrid::dimension-dim >::Entity &  e  )  [inline]

Inserts this element, all ancestors and all direct children of the ancestors.

This will result in a subgrid where the leaf level covers the same domain as level 0. Although this domain might be smaller than the domain covered level 0 of the hostgrid

Referenced by Dune::SubGrid< dim, HostGrid, MapIndexStorage >::addWithAncestor(), and Dune::SubGrid< dim, HostGrid, MapIndexStorage >::insertSet().

template<int dim, class HostGrid, bool MapIndexStorage = false>
void Dune::SubGrid< dim, HostGrid, MapIndexStorage >::addWithAncestor ( const typename HostGrid::Traits::template Codim< HostGrid::dimension-dim >::EntityPointer &  e  )  [inline]

Inserts this element, all ancestors and all direct children of the ancestors.

DEPRECATED: Use insert() instead !

This will result in a subgrid where the leaf level covers the same domain as level 0. Although this domain might be smaller than the domain covered level 0 of the hostgrid

References Dune::SubGrid< dim, HostGrid, MapIndexStorage >::insert().

template<int dim, class HostGrid, bool MapIndexStorage = false>
void Dune::SubGrid< dim, HostGrid, MapIndexStorage >::insertPartial ( const typename HostGrid::Traits::template Codim< HostGrid::dimension-dim >::Entity &  e  )  [inline]

Inserts this element and all ancestors.

This will in general result in a subgrid where each level covers a different domain. The domain covered by the leaf level might be much smaller than the domains covered by the coarser levels. This might be useful to get algebraic coarse levels even if the domain cannot be resolved by coarser grids.

Referenced by Dune::SubGrid< dim, HostGrid, MapIndexStorage >::addPartial(), and Dune::SubGrid< dim, HostGrid, MapIndexStorage >::shrinkHostGrid().

template<int dim, class HostGrid, bool MapIndexStorage = false>
void Dune::SubGrid< dim, HostGrid, MapIndexStorage >::addPartial ( const typename HostGrid::Traits::template Codim< HostGrid::dimension-dim >::EntityPointer &  e  )  [inline]

Inserts this element and all ancestors.

DEPRECATED: Use insertPartial() instead !

This will in general result in a subgrid where each level covers a different domain. The domain covered by the leaf level might be much smaller than the domains covered by the coarser levels. This might be useful to get algebraic coarse levels even if the domain cannot be resolved by coarser grids.

References Dune::SubGrid< dim, HostGrid, MapIndexStorage >::insertPartial().

template<int dim, class HostGrid, bool MapIndexStorage = false>
bool Dune::SubGrid< dim, HostGrid, MapIndexStorage >::hostGridAdapted (  )  [inline]

Track hostgrid adaptation.

Returns true if *adapt() method of hostgrid was called during last run of *adapt() in subgrid

template<int dim, class HostGrid, bool MapIndexStorage = false>
template<class ElementTransfer>
void Dune::SubGrid< dim, HostGrid, MapIndexStorage >::transfer ( ElementTransfer &  elementTransfer  )  const [inline]

Todo:
Please doc me !

template<int dim, class HostGrid, bool MapIndexStorage = false>
bool Dune::SubGrid< dim, HostGrid, MapIndexStorage >::shrinkHostGrid ( int  maxAdaptations = 100,
bool  recreateSubgrid = true 
) [inline]

Shrink hostgrid to subgrid size.

This method shrinks the hostgrid while the subgrid is preserved. Up to maxAdaptations coarsening steps will be applied until the number of hostgrid leaf elements remains unchanged. In general the resulting hostgrid might still be containe more elements than the subgrid.

Observe, that this method changes the hostgrid AND the subgrid. The subgrid should contain the same elements afterwards, but the indices might have changed!

You should not call mark() or preAdapt() befor and postAdapt() afer this method for subgrid or hostgrid.

The state after calling this method is comparable to the state after postAdapt() for subgrid and hostgrid.

Parameters:
maxAdaptations maximal number of coarsening steps (default=100)
recreateSubgrid If true, subgrid containing the same elements is recreated, if false, subgrid is not usable until created manually. (default=true)

References Dune::SubGrid< dim, HostGrid, MapIndexStorage >::adapt(), Dune::SubGrid< dim, HostGrid, MapIndexStorage >::createBegin(), Dune::SubGrid< dim, HostGrid, MapIndexStorage >::createEnd(), Dune::SubGrid< dim, HostGrid, MapIndexStorage >::globalIdSet(), Dune::SubGrid< dim, HostGrid, MapIndexStorage >::insertPartial(), Dune::SubGrid< dim, HostGrid, MapIndexStorage >::maxLevel(), and Dune::SubGrid< dim, HostGrid, MapIndexStorage >::postAdapt().

template<int dim, class HostGrid, bool MapIndexStorage = false>
template<int codim>
bool Dune::SubGrid< dim, HostGrid, MapIndexStorage >::isLeaf ( const typename Traits::template Codim< codim >::Entity &  e  )  const [inline, protected]

template<int dim, class HostGrid, bool MapIndexStorage = false>
template<int codim>
bool Dune::SubGrid< dim, HostGrid, MapIndexStorage >::isLeaf ( const typename HostGrid::Traits::template Codim< codim >::Entity &  e  )  const [inline, protected]

template<int dim, class HostGrid, bool MapIndexStorage = false>
bool Dune::SubGrid< dim, HostGrid, MapIndexStorage >::wasRefined ( const typename Traits::template Codim< 0 >::Entity &  e  )  const [inline, protected]


Member Data Documentation

template<int dim, class HostGrid, bool MapIndexStorage = false>
IndexStorageType Dune::SubGrid< dim, HostGrid, MapIndexStorage >::indexStorage [protected]


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

Generated on Tue Mar 17 15:15:48 2009 for dune-subgrid by  doxygen 1.5.6