#include <subgrid.hh>
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. | |
HostGridType & | getHostGrid () 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 |
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 |
typedef HostGrid Dune::SubGrid< dim, HostGrid, MapIndexStorage >::HostGridType |
int Dune::SubGrid< dim, HostGrid, MapIndexStorage >::maxLevel | ( | ) | const [inline] |
Return maximum level defined in this grid. Levels are numbered 0 ... maxlevel with 0 the coarsest level.
Referenced by Dune::SubGrid< dim, HostGrid, MapIndexStorage >::adapt(), Dune::SubGrid< dim, HostGrid, MapIndexStorage >::createEnd(), Dune::SubGrid< dim, HostGrid, MapIndexStorage >::levelIndexSet(), Dune::SubGrid< dim, HostGrid, MapIndexStorage >::postAdapt(), Dune::SubGrid< dim, HostGrid, MapIndexStorage >::preAdapt(), and Dune::SubGrid< dim, HostGrid, MapIndexStorage >::shrinkHostGrid().
void Dune::SubGrid< dim, HostGrid, MapIndexStorage >::globalRefine | ( | int | refCount | ) | [inline] |
global refinement
References Dune::SubGrid< dim, HostGrid, MapIndexStorage >::adapt(), Dune::SubGrid< dim, HostGrid, MapIndexStorage >::mark(), and Dune::SubGrid< dim, HostGrid, MapIndexStorage >::preAdapt().
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
References Dune::SubGrid< dim, HostGrid, MapIndexStorage >::adapt(), Dune::SubGrid< dim, HostGrid, MapIndexStorage >::levelIndexSet(), and Dune::SubGrid< dim, HostGrid, MapIndexStorage >::postAdapt().
int Dune::SubGrid< dim, HostGrid, MapIndexStorage >::getMark | ( | const typename Traits::template Codim< 0 >::Entity & | e | ) | const [inline] |
Return refinement mark for entity.
References Dune::SubGrid< dim, HostGrid, MapIndexStorage >::levelIndexSet().
bool Dune::SubGrid< dim, HostGrid, MapIndexStorage >::preAdapt | ( | ) | [inline] |
References Dune::SubGrid< dim, HostGrid, MapIndexStorage >::levelIndexSet(), Dune::SubGrid< dim, HostGrid, MapIndexStorage >::maxLevel(), and Dune::SubGrid< dim, HostGrid, MapIndexStorage >::postAdapt().
Referenced by Dune::SubGrid< dim, HostGrid, MapIndexStorage >::adapt(), Dune::SubGrid< dim, HostGrid, MapIndexStorage >::globalRefine(), and Dune::SubGrid< dim, HostGrid, MapIndexStorage >::postAdapt().
const CollectiveCommunication<SubGrid>& Dune::SubGrid< dim, HostGrid, MapIndexStorage >::comm | ( | ) | const [inline] |
dummy collective communication
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().
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().
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().
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().
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().
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().
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().
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().
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().
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().
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().
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().
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().
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().
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
void Dune::SubGrid< dim, HostGrid, MapIndexStorage >::transfer | ( | ElementTransfer & | elementTransfer | ) | const [inline] |
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.
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().
bool Dune::SubGrid< dim, HostGrid, MapIndexStorage >::isLeaf | ( | const typename Traits::template Codim< codim >::Entity & | e | ) | const [inline, protected] |
bool Dune::SubGrid< dim, HostGrid, MapIndexStorage >::isLeaf | ( | const typename HostGrid::Traits::template Codim< codim >::Entity & | e | ) | const [inline, protected] |
bool Dune::SubGrid< dim, HostGrid, MapIndexStorage >::wasRefined | ( | const typename Traits::template Codim< 0 >::Entity & | e | ) | const [inline, protected] |
IndexStorageType Dune::SubGrid< dim, HostGrid, MapIndexStorage >::indexStorage [protected] |
Referenced by Dune::SubGrid< dim, HostGrid, MapIndexStorage >::isLeaf(), and Dune::SubGrid< dim, HostGrid, MapIndexStorage >::report().