/*! Result of the discussion on indices and related stuff with Robert
    in Avignon in the week June 6-10, 2005.

	We propose to have four different ways to number entities:

	1) Levelwise index: Consecutive, zero-starting, non-persistent numbering of
       entities of one codimension, geometry type and level in one process. 
	   I.e. entities of different levels, codimension, geometry type and processes can have the same number.
	   Non-persistent means that the number can change during grid refinement and 
	   load balancing.

	2) Leafwise index: Consecutive, zero-starting, non-persistent numbering of
       entities of leaf entities of one codimension and geometry type. All children which are copies
       of an entity have the same number.

	3) Globally unique id: Every entity has a globally unique identification, i.e. across
	   all levels, codimensions and processes. The type used for this id is
	   user-defined. But: The copies in the refinement tree are identified which means
	   e.g. an entity in the coarse grid that is copied to the fine grid has the *same*
       id.

	4) Locally unique id: Same as 3) but only *within* processes.

	Note 1: In principle all information could be created externally from the globally
    unique index defined in 3. But as usual we will provide default implementations
    that can be overloaded.

	Note 2: The indices and id are accessible via extra objects that are returned
    by the grid. This offers the possibility that indices or ids are only computed
    on demand. These classes are: 

	   LevelIndexSet
	   LeafIndexSet
	   GlobalIdSet
	   LocalIdSet

	Note 3: The classes LevelIndexSet and LeafIndexSet impelement the *same* methods.
    This enables us to write other classes independent of whether they use a level
    or leaf index. This also requires the size methods to be in theses classes (see below).

	Note 4: GlobalIdSet and LocalIdSet implement the same interface.

	There are the following four methods on the grid that deliver the index/id objects:

	   const GlobalIdSet& globalidset();

	   const LevelIndexSet& levelindexset(int level);
	   const LeafIndexSet& leafindexset();
	   const LocalIdSet& localidset();
 */

//! Class to acces the level index
template<class GridImp>
class LevelIndexSet
{
public:
  //! get index of an entity
  template<int cd>
  int index (const typename GridImp::Traits::template codim<cd>::Entity& e) const 
  {
  }

  //! get index of subentity of a codim 0 entity
  template<int cc>
  int subindex (const typename GridImp::Traits::template codim<0>::Entity& e, int i) const
  {
  }

  //! get number of entities of given codim, type and level (the level is known to the object)
  int size (int codim, GeometryType type) const
  {
  }

  //! deliver all geometry types used in this grid
  const std::vector<GeometryType>& geomtypes () const
  {
  }
};

//! Class to acces the leaf index
template<class GridImp>
class LeafIndexSet
{
public:
  //! get index of an entity
  template<int cd>
  int index (const typename GridImp::Traits::template codim<cd>::Entity& e) const 
  {
  }

  //! get index of subentity of a codim 0 entity
  template<int cc>
  int subindex (const typename GridImp::Traits::template codim<0>::Entity& e, int i) const
  {
  }

  //! get number of entities of given codim, type
  int size (int codim, GeometryType type) const
  {
  }

  //! deliver all geometry types used in this grid
  const std::vector<GeometryType>& geomtypes () const
  {
  }
};


//! Class to acces the globally unique id
template<class GridImp>
class GlobalIdSet
{
public:
  //! define the type used for persisitent indices
  typedef ... GlobalIdType;

  //! get id of an entity
  template<int cd>
  GlobalIdType id (const typename GridImp::Traits::template codim<cd>::Entity& e) const 
  {
  }

  //! get id of subentity
  template<int cc>
  GlobalIdType subid (const typename GridImp::Traits::template codim<0>::Entity& e, int i) const
  {
  }
};

//! Class to acces the locally unique id
template<class GridImp>
class LocalIdSet
{
public:
  //! define the type used for persisitent indices
  typedef ... LocalIdType;

  //! get id of an entity
  template<int cd>
  LocalIdType id (const typename GridImp::Traits::template codim<cd>::Entity& e) const 
  {
  }

  //! get id of subentity
  template<int cc>
  LocalIdType subid (const typename GridImp::Traits::template codim<0>::Entity& e, int i) const
  {
  }
};

