DUNE MultiDomainGrid (unstable)

Dune::mdgrid::IndexSetWrapper< GridImp, HostGridViewType > Class Template Reference

#include <dune/grid/multidomaingrid/indexsets.hh>

Public Member Functions

template<int codim>
IndexType index (const typename Grid::Traits::template Codim< codim >::Entity &e) const
 Returns the index of the entity with codimension codim.
 
template<typename Entity >
IndexType index (const Entity &e) const
 Returns the index of the entity.
 
template<int codim>
IndexType subIndex (const typename Grid::Traits::template Codim< codim >::Entity &e, int i, unsigned int cd) const
 Returns the subdindex of the i-th subentity of e with codimension codim.
 
template<typename Entity >
IndexType subIndex (const Entity &e, int i, unsigned int cd) const
 Returns the subdindex of the i-th subentity of e with codimension codim.
 
Types types (int codim) const
 Returns a list of all geometry types with codimension codim contained in the grid.
 
IndexType size (GeometryType type) const
 Returns the number of entities with GeometryType type in the grid.
 
IndexType size (int codim) const
 Returns the number of entities with codimension codim in the grid.
 
template<typename EntityType >
bool contains (const EntityType &e) const
 Returns true if the entity is contained in the grid.
 
template<typename EntityType >
const MapEntry< EntityType::codimension >::SubDomainSet & subDomains (const EntityType &e) const
 Returns a constant reference to the SubDomainSet of the given entity.
 
template<int cc>
const MapEntry< cc >::SubDomainSet & subDomains (const typename Grid::Traits::template Codim< cc >::Entity &e) const
 
template<class EntityType >
IndexType index (SubDomainIndex subDomain, const EntityType &e) const
 Returns the index of the entity in a specific subdomain.
 
template<int cc>
IndexType index (SubDomainIndex subDomain, const typename Grid::Traits::template Codim< cc >::Entity &e) const
 
template<typename EntityType >
bool contains (SubDomainIndex subDomain, const EntityType &e) const
 Returns true if the entity is contained in a specific subdomain.
 

Detailed Description

template<typename GridImp, typename HostGridViewType>
class Dune::mdgrid::IndexSetWrapper< GridImp, HostGridViewType >

This is the heart of this module. The index sets for each level of the grid view and for the leaf grid view store a container of the type ContainerMap which is roughly the following:

{c++}
template<int codim>
struct Container {
struct MapEntry {
using SubDomainSet = typename MDGridTraits::template Codim<cc>::SubDomainSet;
SubDomainSet domains;
IndexType index;
};
// [geometry-type, host-index] -> map-entry
using IndexMap = std::vector<std::vector<MapEntry>>;
// [geometry-type, sub-domain] -> entity-count
using SizeMap = std::vector<typename Grid::MDGridTraits::template Codim<codim>::SizeContainer>;
// [sub-domain] -> entity-count
using CodimSizeMap = typename Grid::MDGridTraits::template Codim<codim>::SizeContainer;
// [map-entry.index] -> [sub-domain-offset-0-index, ..., sub-domain-offset-i-index]
using MultiIndexMap = std::vector<typename Grid::MDGridTraits::template Codim<codim>::MultiIndexContainer>;
IndexMap indexMap;
SizeMap sizeMap;
CodimSizeMap codimSizeMap;
MultiIndexMap multiIndexMap;
};
using ContainerMap = std::tuple<Container<0>, ..., Container<dim>>;
IndexType index(const typename Grid::Traits::template Codim< codim >::Entity &e) const
Returns the index of the entity with codimension codim.
Definition: indexsets.hh:247

Most of the fancy stuff is just to avoid instantiating unsupported codimensions by the host grid. But in general, the index of the sub-domain entity is stored in multiIndexMap and is accessed through the indexMap. If there is only one sub-domain in the entity, the sub-domain index is directly stored in indexMap to avoid the indirection of going to multiIndexMap. This also makes the multi-domain entities more compact.

To be performant in the overlapping case, the current implementation requires that MultiIndexContainer stores its contents within its class itself (i.e. no indirection to the heap). Doing otherwise implies very scatter memory and a very irregular memory access pattern. Either a fixed integer or an array do this. An idea to make this performant in a more general case is to use a polymorphic allocator that creates the multi-indices contiguously in memory. Index set for the MultiDomainGrid.

Member Function Documentation

◆ index()

template<typename GridImp , typename HostGridViewType >
template<int cc>
IndexType Dune::mdgrid::IndexSetWrapper< GridImp, HostGridViewType >::index ( SubDomainIndex  subDomain,
const typename Grid::Traits::template Codim< cc >::Entity &  e 
) const
inline

Returns the index of the entity with codimension cc in a specific subdomain.

Template Parameters
thecodimension of the entity.

◆ subDomains()

template<typename GridImp , typename HostGridViewType >
template<int cc>
const MapEntry< cc >::SubDomainSet & Dune::mdgrid::IndexSetWrapper< GridImp, HostGridViewType >::subDomains ( const typename Grid::Traits::template Codim< cc >::Entity &  e) const
inline

Returns a constant reference to the SubDomainSet of the given entity with codimension cc.

Template Parameters
ccthe codimension of the entity.

The documentation for this class was generated from the following file:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden & Uni Heidelberg  |  generated with Hugo v0.111.3 (Apr 7, 22:57, 2025)