dune-multidomaingrid 2.10-git
Loading...
Searching...
No Matches
Dune::mdgrid::IndexSetWrapper< GridImp, HostGridViewType > Class Template Reference

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

Inheritance diagram for Dune::mdgrid::IndexSetWrapper< GridImp, HostGridViewType >:
Inheritance graph

Public Types

typedef BaseT::Types Types
 
using MDGridTraits = typename Grid::MDGridTraits
 
typedef MDGridTraits::template Codim< 0 >::SubDomainSet SubDomainSet
 
typedef MDGridTraits::SubDomainIndex SubDomainIndex
 
typedef HostIndexSet::IndexType IndexType
 

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 >::SubDomainSetsubDomains (const EntityType &e) const
 Returns a constant reference to the SubDomainSet of the given entity.
 
template<int cc>
const MapEntry< cc >::SubDomainSetsubDomains (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 SubDomainEntity >
IndexType subIndex (SubDomainIndex subDomain, const SubDomainEntity &e, int i, int codim) const
 
Types types (SubDomainIndex subDomain, int codim) const
 
IndexType size (SubDomainIndex subDomain, GeometryType type) const
 
IndexType size (SubDomainIndex subDomain, int codim) const
 
template<typename EntityType >
bool contains (SubDomainIndex subDomain, const EntityType &e) const
 Returns true if the entity is contained in a specific subdomain.
 
 IndexSetWrapper (const GridImp &grid, HostGridView hostGridView)
 
IndexType index (const typename Traits::template Codim< cc >::Entity &e) const
 
IndexType subIndex (const typename Traits::template Codim< cc >::Entity &e, int i, unsigned int codim) const
 
bool contains (const Entity &e) const
 

Static Public Attributes

static const int dimension = Grid::dimension
 
static const std::size_t maxSubDomains = SubDomainSet::maxSize
 

Friends

template<typename , typename >
class IndexSetWrapper
 
template<typename , typename >
class MultiDomainGrid
 
template<typename , typename >
class subdomain::IndexSetWrapper
 
template<typename , typename , typename , typename >
class SubDomainInterface
 
template<typename >
class SubDomainToSubDomainController
 
template<typename >
class AllInterfacesController
 

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
// [geometry-type, sub-domain] -> entity-count
// [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]
IndexMap indexMap;
SizeMap sizeMap;
CodimSizeMap codimSizeMap;
MultiIndexMap multiIndexMap;
};
using ContainerMap = std::tuple<Container<0>, ..., Container<dim>>;
bool setContains(const ArrayBasedSet< SI, capacity > &a, const ArrayBasedSet< SI, capacity > &b)
std::ptrdiff_t index() const

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 Typedef Documentation

◆ IndexType

template<typename GridImp , typename HostGridViewType >
typedef HostIndexSet::IndexType Dune::mdgrid::IndexSetWrapper< GridImp, HostGridViewType >::IndexType

◆ MDGridTraits

template<typename GridImp , typename HostGridViewType >
using Dune::mdgrid::IndexSetWrapper< GridImp, HostGridViewType >::MDGridTraits = typename Grid::MDGridTraits

◆ SubDomainIndex

template<typename GridImp , typename HostGridViewType >
typedef MDGridTraits::SubDomainIndex Dune::mdgrid::IndexSetWrapper< GridImp, HostGridViewType >::SubDomainIndex

◆ SubDomainSet

template<typename GridImp , typename HostGridViewType >
typedef MDGridTraits::template Codim<0>::SubDomainSet Dune::mdgrid::IndexSetWrapper< GridImp, HostGridViewType >::SubDomainSet

◆ Types

Constructor & Destructor Documentation

◆ IndexSetWrapper()

template<typename GridImp , typename HostGridViewType >
Dune::mdgrid::IndexSetWrapper< GridImp, HostGridViewType >::IndexSetWrapper ( const GridImp &  grid,
HostGridView  hostGridView 
)
inline

Member Function Documentation

◆ contains() [1/2]

template<typename GridImp , typename HostGridViewType >
template<typename EntityType >
bool Dune::mdgrid::IndexSetWrapper< GridImp, HostGridViewType >::contains ( const EntityType e) const
inline

Returns true if the entity is contained in the grid.

◆ contains() [2/2]

template<typename GridImp , typename HostGridViewType >
template<typename EntityType >
bool Dune::mdgrid::IndexSetWrapper< GridImp, HostGridViewType >::contains ( SubDomainIndex  subDomain,
const EntityType e 
) const
inline

Returns true if the entity is contained in a specific subdomain.

◆ index() [1/4]

template<typename GridImp , typename HostGridViewType >
template<typename Entity >
IndexType Dune::mdgrid::IndexSetWrapper< GridImp, HostGridViewType >::index ( const Entity e) const
inline

Returns the index of the entity.

◆ index() [2/4]

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

Returns the index of the entity with codimension codim.

◆ index() [3/4]

template<typename GridImp , typename HostGridViewType >
template<class EntityType >
IndexType Dune::mdgrid::IndexSetWrapper< GridImp, HostGridViewType >::index ( SubDomainIndex  subDomain,
const EntityType e 
) const
inline

Returns the index of the entity in a specific subdomain.

◆ index() [4/4]

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.

◆ size() [1/4]

template<typename GridImp , typename HostGridViewType >
IndexType Dune::mdgrid::IndexSetWrapper< GridImp, HostGridViewType >::size ( GeometryType  type) const
inline

Returns the number of entities with GeometryType type in the grid.

◆ size() [2/4]

template<typename GridImp , typename HostGridViewType >
IndexType Dune::mdgrid::IndexSetWrapper< GridImp, HostGridViewType >::size ( int  codim) const
inline

Returns the number of entities with codimension codim in the grid.

◆ size() [3/4]

template<typename GridImp , typename HostGridViewType >
IndexType Dune::mdgrid::IndexSetWrapper< GridImp, HostGridViewType >::size ( SubDomainIndex  subDomain,
GeometryType  type 
) const
inline

◆ size() [4/4]

template<typename GridImp , typename HostGridViewType >
IndexType Dune::mdgrid::IndexSetWrapper< GridImp, HostGridViewType >::size ( SubDomainIndex  subDomain,
int  codim 
) const
inline

◆ subDomains() [1/2]

template<typename GridImp , typename HostGridViewType >
template<typename EntityType >
const MapEntry< EntityType::codimension >::SubDomainSet & Dune::mdgrid::IndexSetWrapper< GridImp, HostGridViewType >::subDomains ( const EntityType e) const
inline

Returns a constant reference to the SubDomainSet of the given entity.

◆ subDomains() [2/2]

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.

◆ subIndex() [1/3]

template<typename GridImp , typename HostGridViewType >
template<typename Entity >
IndexType Dune::mdgrid::IndexSetWrapper< GridImp, HostGridViewType >::subIndex ( const Entity e,
int  i,
unsigned int  cd 
) const
inline

Returns the subdindex of the i-th subentity of e with codimension codim.

◆ subIndex() [2/3]

template<typename GridImp , typename HostGridViewType >
template<int codim>
IndexType Dune::mdgrid::IndexSetWrapper< GridImp, HostGridViewType >::subIndex ( const typename Grid::Traits::template Codim< codim >::Entity e,
int  i,
unsigned int  cd 
) const
inline

Returns the subdindex of the i-th subentity of e with codimension codim.

◆ subIndex() [3/3]

template<typename GridImp , typename HostGridViewType >
template<typename SubDomainEntity >
IndexType Dune::mdgrid::IndexSetWrapper< GridImp, HostGridViewType >::subIndex ( SubDomainIndex  subDomain,
const SubDomainEntity &  e,
int  i,
int  codim 
) const
inline

◆ types() [1/2]

template<typename GridImp , typename HostGridViewType >
Types Dune::mdgrid::IndexSetWrapper< GridImp, HostGridViewType >::types ( int  codim) const
inline

Returns a list of all geometry types with codimension codim contained in the grid.

◆ types() [2/2]

template<typename GridImp , typename HostGridViewType >
Types Dune::mdgrid::IndexSetWrapper< GridImp, HostGridViewType >::types ( SubDomainIndex  subDomain,
int  codim 
) const
inline

Friends And Related Symbol Documentation

◆ AllInterfacesController

◆ IndexSetWrapper

template<typename GridImp , typename HostGridViewType >
template<typename , typename >
friend class IndexSetWrapper
friend

◆ MultiDomainGrid

template<typename GridImp , typename HostGridViewType >
template<typename , typename >
friend class MultiDomainGrid
friend

◆ subdomain::IndexSetWrapper

◆ SubDomainInterface

◆ SubDomainToSubDomainController

Member Data Documentation

◆ dimension

template<typename GridImp , typename HostGridViewType >
const int Dune::mdgrid::IndexSetWrapper< GridImp, HostGridViewType >::dimension = Grid::dimension
static

◆ maxSubDomains

template<typename GridImp , typename HostGridViewType >
const std::size_t Dune::mdgrid::IndexSetWrapper< GridImp, HostGridViewType >::maxSubDomains = SubDomainSet::maxSize
static

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