Dune Core Modules (2.3.1)

Dune::IndexSet< GridImp, IndexSetImp, IndexTypeImp > Class Template Reference

Index Set Interface base class. More...

#include <dune/grid/common/indexidset.hh>

Public Types

typedef IndexTypeImp IndexType
 The type used for the indices.
 

Public Member Functions

Index access from entity
template<int cc>
IndexType index (const typename remove_const< GridImp >::type::Traits::template Codim< cc >::Entity &e) const
 Map entity to index. The result of calling this method with an entity that is not in the index set is undefined. More...
 
template<class EntityType >
IndexType index (const EntityType &e) const
 Map entity to index. Easier to use than the above because codimension template parameter need not be supplied explicitly. The result of calling this method with an entity that is not in the index set is undefined. More...
 
template<int cc>
IndexType subIndex (const typename Traits::template Codim< cc >::Entity &e, int i, unsigned int codim) const
 Map a subentity to an index. More...
 
template<class Entity >
IndexType subIndex (const Entity &e, int i, unsigned int codim) const
 Map a subentity to an index. More...
 

Static Public Attributes

static const int dimension = remove_const< GridImp >::type::dimension
 dimension of the grid (maximum allowed codimension)
 

Access to entity set

const std::vector< GeometryType > & geomTypes (int codim) const
 Return vector with all geometry types of entities in domain of index map. Return a vector with all geometry types of a given codimension contained in the Entity set \(E\). More...
 
IndexType size (GeometryType type) const
 Return total number of entities of given geometry type in entity set \(E\). More...
 
IndexType size (int codim) const
 Return total number of entities of given codim in the entity set \(E\). This is simply a sum over all geometry types. More...
 
template<class EntityType >
bool contains (const EntityType &e) const
 Return true if the given entity is contained in \(E\). More...
 
 IndexSet ()
 

Detailed Description

template<class GridImp, class IndexSetImp, class IndexTypeImp>
class Dune::IndexSet< GridImp, IndexSetImp, IndexTypeImp >

Index Set Interface base class.

This class template is used as a base class for all index set implementations. It uses the Barton-Nackman trick to ensure conformity to the interface.

Template Parameters
GridImpType that is a model of Dune::Grid.
IndexSetImpType that is a model of Dune::IndexSet.
IndexTypeImpThe type used by IndexSetImp to store the indices

Overview

An index set provides a map

\[ m : E \to \mathbf{N}\]

where \(E\) is a subset of the entities of a grid and \(\mathbf{N}\) is the set of natural numbers (including 0).

We define the subsets

\[ E_g^c = \{e\in E \ | \ \textrm{$e$ has codimension $c$ and geometry type $g$} \}.\]

The index map \(m\) has the following properties:

  • It is unique within the subsets \(E_g^c\), i.e. for any \(e,e^\prime\in E_g^c\) we have \(e\neq e^\prime \rightarrow m(e)\neq m(e^\prime)\).
  • It is consecutive and zero-starting within the subsets \(E_g^c\), i.e. we have \(0\leq m(e) < |E_g^c|\) for any \(e\in E_g^c\).

Index sets are used to assign user defined data (e.g. degrees of freedom of a discretization) to entities of the grid. For efficiency reasons the prefered data structure for user data is the array. In order to access the data from the entity, its index (with respect to an index set - there may be several) is evaluated and used as an index to an array (or some other container providing random access).

Usually an index set is not used directly but a Mapper is used to compute the array index from the information supplied by an index set.

It is important to note that the index assigned to an entity may change during grid modification (i.e. refinement or dynamic load balancing). The user is reponsible for reorganizing the information stored in the external arrays appropriately. In order to do this the IdSet concept is supplied.

Level index

Index set where \(E\) corresponds to all entities of a given grid level. All grid implementations provide level indices.

Leaf Index

Index set where \(E\) corresponds to all entities of the leaf grid. All grid implementations provide a leaf index.

Member Function Documentation

◆ contains()

template<class GridImp , class IndexSetImp , class IndexTypeImp >
template<class EntityType >
bool Dune::IndexSet< GridImp, IndexSetImp, IndexTypeImp >::contains ( const EntityType &  e) const
inline

Return true if the given entity is contained in \(E\).

Note
If the input element e is not an element of the grid, then the result of contains() is undefined.

◆ geomTypes()

template<class GridImp , class IndexSetImp , class IndexTypeImp >
const std::vector< GeometryType > & Dune::IndexSet< GridImp, IndexSetImp, IndexTypeImp >::geomTypes ( int  codim) const
inline

Return vector with all geometry types of entities in domain of index map. Return a vector with all geometry types of a given codimension contained in the Entity set \(E\).

Parameters
[in]codimA valid codimension.
Returns
Const reference to a vector of geometry types.

◆ index() [1/2]

template<class GridImp , class IndexSetImp , class IndexTypeImp >
template<class EntityType >
IndexType Dune::IndexSet< GridImp, IndexSetImp, IndexTypeImp >::index ( const EntityType &  e) const
inline

Map entity to index. Easier to use than the above because codimension template parameter need not be supplied explicitly. The result of calling this method with an entity that is not in the index set is undefined.

Parameters
eReference to codim cc entity. Since entity knows its codimension, automatic extraction is possible.
Returns
An index in the range 0 ... Max number of entities in set - 1.

◆ index() [2/2]

template<class GridImp , class IndexSetImp , class IndexTypeImp >
template<int cc>
IndexType Dune::IndexSet< GridImp, IndexSetImp, IndexTypeImp >::index ( const typename remove_const< GridImp >::type::Traits::template Codim< cc >::Entity &  e) const
inline

Map entity to index. The result of calling this method with an entity that is not in the index set is undefined.

Parameters
eReference to codim cc entity, where cc is the template parameter of the function.
Returns
An index in the range 0 ... Max number of entities in set - 1.

◆ size() [1/2]

template<class GridImp , class IndexSetImp , class IndexTypeImp >
IndexType Dune::IndexSet< GridImp, IndexSetImp, IndexTypeImp >::size ( GeometryType  type) const
inline

Return total number of entities of given geometry type in entity set \(E\).

Parameters
[in]typeA valid geometry type.
Returns
number of entities.

Referenced by Dune::OneDGrid::size(), Dune::UGGrid< dim >::size(), and Dune::DGFWriter< GV >::write().

◆ size() [2/2]

template<class GridImp , class IndexSetImp , class IndexTypeImp >
IndexType Dune::IndexSet< GridImp, IndexSetImp, IndexTypeImp >::size ( int  codim) const
inline

Return total number of entities of given codim in the entity set \(E\). This is simply a sum over all geometry types.

Parameters
[in]codimA valid codimension
Returns
number of entities.

◆ subIndex() [1/2]

template<class GridImp , class IndexSetImp , class IndexTypeImp >
template<class Entity >
IndexType Dune::IndexSet< GridImp, IndexSetImp, IndexTypeImp >::subIndex ( const Entity e,
int  i,
unsigned int  codim 
) const
inline

Map a subentity to an index.

The result of calling this method with an entity that is not in the index set is undefined.

Note
This method exists for convenience only. It extracts the codimension from the type of the entity, which can be guessed by the compiler.
Template Parameters
Entitytype of entity (must be GridImp::Codim< cc >::Entity for some cc)
Parameters
[in]ereference to entity
[in]inumber subentity of e within the codimension
[in]codimcodimension of the subentity we're interested in
Returns
An index in the range 0 ... Max number of entities in set - 1.

References Dune::Entity< cd, dim, GridImp, EntityImp >::codimension.

◆ subIndex() [2/2]

template<class GridImp , class IndexSetImp , class IndexTypeImp >
template<int cc>
IndexType Dune::IndexSet< GridImp, IndexSetImp, IndexTypeImp >::subIndex ( const typename Traits::template Codim< cc >::Entity &  e,
int  i,
unsigned int  codim 
) const
inline

Map a subentity to an index.

The result of calling this method with an entity that is not in the index set is undefined.

Template Parameters
cccodimension of the entity
Parameters
[in]ereference to codimension cc entity
[in]inumber subentity of e within the codimension
[in]codimcodimension of the subentity we're interested in (must satisfy cc <= codim <= dimension)
Returns
An index in the range 0 ... Max number of entities in set - 1.

The documentation for this class was generated from the following files:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 12, 23:30, 2024)