DUNE MultiDomainGrid (2.10)
A meta grid for dividing an existing DUNE grid into subdomains that can be accessed as a grid in their own right. More...
#include <dune/grid/multidomaingrid/multidomaingrid.hh>
Public Types | |
typedef MDGridTraits::SubDomainIndex | SubDomainIndex |
The (integer) type used to identify subdomains. | |
typedef subdomain::SubDomainGrid< ThisType > | SubDomainGrid |
The type used for representing the grid of a subdomain, always a specialization of Dune::mdgrid::subdomain::SubDomainGrid. | |
typedef Traits::LeafSubDomainInterfaceIterator | LeafSubDomainInterfaceIterator |
The type of the iterators over the codim 1 interface between two subdomains on the leaf view. | |
typedef Traits::LevelSubDomainInterfaceIterator | LevelSubDomainInterfaceIterator |
The type of the iterators over the codim 1 interface between two subdomains on a level view. | |
typedef Traits::LeafAllSubDomainInterfacesIterator | LeafAllSubDomainInterfacesIterator |
The type of the iterators over the codim 1 interfaces between all subdomains on the leaf view. | |
typedef Traits::LevelAllSubDomainInterfacesIterator | LevelAllSubDomainInterfacesIterator |
The type of the iterators over the codim 1 interfaces between all subdomains on a level view. | |
Public Member Functions | |
const SubDomainIndex | maxSubDomainIndex () const |
The largest allowed index for a subdomain. More... | |
Constructors | |
MultiDomainGrid (const std::shared_ptr< HostGrid > &hostGridPtr, bool supportLevelIndexSets=true) | |
Constructs a new MultiDomainGrid from the given host grid. More... | |
MultiDomainGrid (const std::shared_ptr< HostGrid > &hostGridPtr, const MDGridTraitsType &traits, bool supportLevelIndexSets=true) | |
Constructs a new MultiDomainGrid from the given host grid. More... | |
MultiDomainGrid (HostGrid &hostGrid, bool supportLevelIndexSets=true) | |
Constructs a new MultiDomainGrid from the given host grid. More... | |
MultiDomainGrid (HostGrid &hostGrid, const MDGridTraitsType &traits, bool supportLevelIndexSets=true) | |
Constructs a new MultiDomainGrid from the given host grid. More... | |
Dune grid interface methods | |
template<typename EntitySeed > | |
Traits::template Codim< EntitySeed::codimension >::Entity | entity (const EntitySeed &entitySeed) const |
int | maxLevel () const |
The current maximum level of the grid. | |
template<int codim> | |
Traits::template Codim< codim >::LevelIterator | lbegin (int level) const |
template<int codim> | |
Traits::template Codim< codim >::LevelIterator | lend (int level) const |
template<int codim, PartitionIteratorType pitype> | |
Traits::template Codim< codim >::template Partition< pitype >::LevelIterator | lbegin (int level) const |
template<int codim, PartitionIteratorType pitype> | |
Traits::template Codim< codim >::template Partition< pitype >::LevelIterator | lend (int level) const |
template<int codim> | |
Traits::template Codim< codim >::LeafIterator | leafbegin () const |
template<int codim> | |
Traits::template Codim< codim >::LeafIterator | leafend () const |
template<int codim, PartitionIteratorType pitype> | |
Traits::template Codim< codim >::template Partition< pitype >::LeafIterator | leafbegin () const |
template<int codim, PartitionIteratorType pitype> | |
Traits::template Codim< codim >::template Partition< pitype >::LeafIterator | leafend () const |
int | size (int level, int codim) const |
int | size (int codim) const |
int | size (int level, GeometryType type) const |
int | size (GeometryType type) const |
const Traits::GlobalIdSet & | globalIdSet () const |
const Traits::LocalIdSet & | localIdSet () const |
const Traits::LevelIndexSet & | levelIndexSet (int level) const |
const Traits::LeafIndexSet & | leafIndexSet () const |
void | globalRefine (int refCount) |
bool | mark (int refCount, const typename Traits::template Codim< 0 >::Entity &e) |
int | getMark (const typename Traits::template Codim< 0 >::Entity &e) |
bool | preAdapt () |
bool | adapt () |
void | postAdapt () |
int | overlapSize (int level, int codim) const |
int | overlapSize (int codim) const |
int | ghostSize (int level, int codim) const |
int | ghostSize (int codim) const |
const Traits::Communication & | comm () const |
template<typename DataHandleImp , typename DataTypeImp > | |
void | communicate (CommDataHandleIF< DataHandleImp, DataTypeImp > &data, InterfaceType iftype, CommunicationDirection dir, int level) const |
template<typename DataHandleImp , typename DataTypeImp > | |
void | communicate (CommDataHandleIF< DataHandleImp, DataTypeImp > &data, InterfaceType iftype, CommunicationDirection dir) const |
template<typename DataHandle > | |
bool | loadBalance (DataHandle &dataHandle) |
bool | loadBalance () |
size_t | numBoundarySegments () const |
Methods for iterating over subdomain interfaces | |
LeafSubDomainInterfaceIterator | leafSubDomainInterfaceBegin (SubDomainIndex subDomain1, SubDomainIndex subDomain2) const |
Returns an iterator over the leaf interface of two subdomains. More... | |
LeafSubDomainInterfaceIterator | leafSubDomainInterfaceEnd (SubDomainIndex subDomain1, SubDomainIndex subDomain2) const |
Returns the corresponding end iterator for leafSubDomainInterfaceBegin(). | |
LevelSubDomainInterfaceIterator | levelSubDomainInterfaceBegin (SubDomainIndex subDomain1, SubDomainIndex subDomain2, int level) const |
Returns an iterator over the interface of two subdomains at the given level. More... | |
LevelSubDomainInterfaceIterator | levelSubDomainInterfaceEnd (SubDomainIndex subDomain1, SubDomainIndex subDomain2, int level) const |
Returns the corresponding end iterator for levelSubDomainInterfaceBegin(). More... | |
LeafAllSubDomainInterfacesIterator | leafAllSubDomainInterfacesBegin () const |
Returns an iterator over all subdomain interfaces on the leaf view. More... | |
LeafAllSubDomainInterfacesIterator | leafAllSubDomainInterfacesEnd () const |
Returns the corresponding end iterator for leafAllSubDomainInterfacesBegin(). | |
LevelAllSubDomainInterfacesIterator | levelAllSubDomainInterfacesBegin (int level) const |
Returns an iterator over all subdomain interfaces on the requested level view. More... | |
LevelAllSubDomainInterfacesIterator | levelAllSubDomainInterfacesEnd (int level) const |
Returns the corresponding end iterator for levelAllSubDomainInterfacesBegin(). More... | |
Subdomain creation- and adaptation methods | |
void | startSubDomainMarking () |
Prepares the grid for (re-)assigning cells to subdomains. More... | |
void | preUpdateSubDomains () |
Calculates the new subdomain layout, but does not update the current subdomains yet. More... | |
void | updateSubDomains () |
Switches the subdomain layout over to the new layout. | |
void | postUpdateSubDomains () |
clears the saved state of the subdomain layout that was active before the last call to updateSubDomains(). | |
void | addToSubDomain (SubDomainIndex subDomain, const typename Traits::template Codim< 0 >::Entity &e) |
Adds the given leaf entity to the specified subdomain. | |
void | removeFromSubDomain (SubDomainIndex subDomain, const typename Traits::template Codim< 0 >::Entity &e) |
Removes the given leaf entity from the specified subdomain. | |
void | assignToSubDomain (SubDomainIndex subDomain, const typename Traits::template Codim< 0 >::Entity &e) |
Assigns the given leaf entity to the specified subdomain, clearing any previous subdomain assignments. | |
void | removeFromAllSubDomains (const typename Traits::template Codim< 0 >::Entity &e) |
Removes the given leaf entity from all subdomains it currently belongs to. | |
Access to the subdomain grids | |
const SubDomainGrid & | subDomain (SubDomainIndex subDomain) const |
Returns a reference to the SubDomainGrid associated with the given subdomain. | |
SubDomainGrid & | subDomain (SubDomainIndex subDomain) |
Returns a reference to the SubDomainGrid associated with the given subdomain. | |
SubDomainIndex | maxAssignedSubDomainIndex () const |
Returns the largest subdomain index that was ever assigned to a cell in this grid. More... | |
bool | supportLevelIndexSets () const |
Indicates whether this MultiDomainGrid instance supports level index sets on its SubDomainGrids. | |
Static Public Attributes | |
static const std::size_t | maxNumberOfSubDomains = MDGridTraits::maxSubDomainsPerCell |
The largest number of subdomains any given grid cell may belong to. | |
Entity conversion methods | |
const MDGridTraits & | traits () const |
const HostGrid & | hostGrid () const |
HostGrid & | hostGrid () |
template<typename Entity > | |
Traits::template Codim< Entity::codimension >::Entity | wrapHostEntity (const Entity &e) const |
template<int codim> | |
Traits::template Codim< codim >::Entity | wrapHostEntity (const typename HostGrid::template Codim< codim >::Entity &e) const |
template<typename EntityType > | |
static const HostEntity< EntityType >::type & | hostEntity (const EntityType &e) |
Returns a reference to the corresponding host entity. More... | |
template<typename EntityType > | |
static const MultiDomainEntity< EntityType >::type & | multiDomainEntity (const EntityType &e) |
template<typename IntersectionType > | |
static const auto & | multiDomainIntersection (const IntersectionType &is) |
Detailed Description
class Dune::mdgrid::MultiDomainGrid< HostGrid_, MDGridTraitsType >
A meta grid for dividing an existing DUNE grid into subdomains that can be accessed as a grid in their own right.
- Template Parameters
-
HostGrid The type of the underlying grid implementation. MDGridTraitsType A traits type for customizing how the MultiDomainGrid manages the partitioning information.
Constructor & Destructor Documentation
◆ MultiDomainGrid() [1/4]
|
inlineexplicit |
Constructs a new MultiDomainGrid from the given host grid.
- Parameters
-
hostGrid the host grid that will be wrapped by the MultiDomainGrid supportLevelIndexSets flag indicating support for level index sets on subdomains
◆ MultiDomainGrid() [2/4]
|
inlineexplicit |
Constructs a new MultiDomainGrid from the given host grid.
- Parameters
-
hostGrid the host grid that will be wrapped by the MultiDomainGrid traits an instance of the grid traits, which might contain runtime information supportLevelIndexSets flag indicating support for level index sets on subdomains
◆ MultiDomainGrid() [3/4]
|
inlineexplicit |
Constructs a new MultiDomainGrid from the given host grid.
- Parameters
-
hostGrid the host grid that will be wrapped by the MultiDomainGrid supportLevelIndexSets flag indicating support for level index sets on subdomains
◆ MultiDomainGrid() [4/4]
|
inlineexplicit |
Constructs a new MultiDomainGrid from the given host grid.
- Parameters
-
hostGrid the host grid that will be wrapped by the MultiDomainGrid traits an instance of the grid traits, which might contain runtime information supportLevelIndexSets flag indicating support for level index sets on subdomains
Member Function Documentation
◆ hostEntity()
|
inlinestatic |
Returns a reference to the corresponding host entity.
- Warning
- The returned reference will only be valid as long as the passed-in reference to the MultiDomainGrid entity! If you need a persistent host entity object , copy the returned reference.
◆ leafAllSubDomainInterfacesBegin()
|
inline |
Returns an iterator over all subdomain interfaces on the leaf view.
This method returns an iterator that will visit all pairwise surface interfaces between subdomains on the leaf view. In particular, given to adjacent cells e_1 and e_2 and two subdomains s_1 and s_2, this iterator will visit the intersection between e_1 and e_2 iff all of the following hold:
\begin{eqnarray*} e_1 \in s_1,\ e_1 \not\in s_2,\\ e_2 \not\in s_1,\ e_1 \in s_2.\end{eqnarray*}
In essence, the two subdomains have to be locally disjoint on e_1 and e_2.
The iterator will only traverse the host grid once for visiting all subdomain interfaces. Incrementing the iterator might thus result in an iterator pointing to the same grid intersection, but to a different pair of subdomains. The subdomains pointed to by the iterator can be retrieved by calling LeafAllSubDomainInterfacesIterator::subDomain1() and LeafAllSubDomainInterfacesIterator::subDomain2(), respectively.
◆ leafSubDomainInterfaceBegin()
|
inline |
Returns an iterator over the leaf interface of two subdomains.
The resulting iterator will visit all cell intersections that are part of both subdomains.
- Attention
- The iterator assumes the two subdomains to be non-overlapping! If there is an overlap, some intersections will be iterated over twice!
- Parameters
-
subDomain1 the first subdomain subDomain2 the second subdomain
◆ levelAllSubDomainInterfacesBegin()
|
inline |
Returns an iterator over all subdomain interfaces on the requested level view.
This method returns an iterator that will visit all pairwise surface interfaces between subdomains on the requested level view. In particular, given to adjacent cells e_1 and e_2 and two subdomains s_1 and s_2, this iterator will visit the intersection between e_1 and e_2 iff all of the following hold:
\begin{eqnarray*} e_1 \in s_1,\ e_1 \not\in s_2,\\ e_2 \not\in s_1,\ e_1 \in s_2.\end{eqnarray*}
In essence, the two subdomains have to be locally disjoint on e_1 and e_2.
The iterator will only traverse the host grid once for visiting all subdomain interfaces. Incrementing the iterator might thus result in an iterator pointing to the same grid intersection, but to a different pair of subdomains. The subdomains pointed to by the iterator can be retrieved by calling LevelAllSubDomainInterfacesIterator::subDomain1() and LevelAllSubDomainInterfacesIterator::subDomain2(), respectively.
- Parameters
-
level the grid level to be iterated over.
◆ levelAllSubDomainInterfacesEnd()
|
inline |
Returns the corresponding end iterator for levelAllSubDomainInterfacesBegin().
- Parameters
-
level the grid level to be iterated over.
◆ levelSubDomainInterfaceBegin()
|
inline |
Returns an iterator over the interface of two subdomains at the given level.
The resulting iterator will visit all cell intersections that are part of both subdomains.
- Attention
- The iterator assumes the two subdomains to be non-overlapping! If there is an overlap, some intersections will be iterated over twice!
- Parameters
-
subDomain1 the first subdomain subDomain2 the second subdomain level the grid level over which to iterate
◆ levelSubDomainInterfaceEnd()
|
inline |
Returns the corresponding end iterator for levelSubDomainInterfaceBegin().
- Parameters
-
level the grid level to be iterated over.
◆ maxAssignedSubDomainIndex()
|
inline |
Returns the largest subdomain index that was ever assigned to a cell in this grid.
This method returns the largest subdomain index that was passed to addToSubDomain() or assignToSubDomain() since this MultiDomainGrid was created. Keep in mind that the subdomain belonging to that index might not contain any entities anymore if all entities have been removed from it at a later point.
◆ maxSubDomainIndex()
|
inline |
The largest allowed index for a subdomain.
- Note
- As subdomain indices always start at 0, this also determines the maximum number of possible subdomains.
◆ preUpdateSubDomains()
|
inline |
Calculates the new subdomain layout, but does not update the current subdomains yet.
After calling this method, you can query the grid for the changes that will occur when the new subdomain layout becomes active. This includes the possibility to obtain the new indices entities will be assigned in the modified subdomains.
To switch the grid over to the new layout, call updateSubDomains().
References Dune::mdgrid::MultiDomainGrid< HostGrid_, MDGridTraitsType >::maxLevel().
◆ startSubDomainMarking()
|
inline |
Prepares the grid for (re-)assigning cells to subdomains.
After calling this method, it becomes possible to invoke the various methods for cell assignment to subdomains. When you are done marking, call preUpdateSubDomains().
IMPORTANT: Reassigning subdomains and grid adaptation are mutually exclusive, it is not possibly to do both at the same time. This restriction is enforced by the grid.
The documentation for this class was generated from the following files:
- dune/grid/multidomaingrid/entity.hh
- dune/grid/multidomaingrid/multidomaingrid.hh
