dune-grid  2.1.1
idset.hh
Go to the documentation of this file.
00001 #ifndef DUNE_GEOGRID_IDSET_HH
00002 #define DUNE_GEOGRID_IDSET_HH
00003 
00004 #include <dune/grid/common/indexidset.hh>
00005 
00006 namespace Dune
00007 {
00008 
00009   namespace GeoGrid
00010   {
00011   
00012     // IdSet
00013     // -----
00014     
00015     template< class Grid, class HostIdSet >
00016     class IdSet
00017     : public Dune::IdSet< Grid, IdSet< Grid, HostIdSet >, typename HostIdSet::IdType >
00018     {
00019       typedef Dune::IdSet< Grid, IdSet< Grid, HostIdSet >, typename HostIdSet::IdType > Base;
00020 
00021       typedef typename remove_const< Grid >::type::Traits Traits;
00022       
00023     public:
00024       typedef typename HostIdSet::IdType IdType;
00025 
00026       using Base::subId;
00027 
00028       IdSet ( const HostIdSet &hostIdSet )
00029       : hostIdSet_( hostIdSet )
00030       {}
00031 
00032       template< int codim >
00033       IdType id ( const typename Traits::template Codim< codim >::Entity &entity ) const
00034       {
00035         return Grid::getRealImplementation( entity ).id( hostIdSet_ );
00036       }
00037 
00038       template< class Entity >
00039       IdType id ( const Entity &entity ) const
00040       {
00041         return id< Entity :: codimension >( entity );
00042       }
00043 
00044       IdType subId ( const typename Traits::template Codim< 0 >::Entity &entity, int i, unsigned int codim ) const
00045       {
00046         return hostIdSet_.subId( Grid::template getHostEntity< 0 >( entity ), i, codim );
00047       }
00048 
00049     private:
00050       IdSet ( const IdSet & );
00051       IdSet &operator= ( const IdSet & );
00052 
00053       const HostIdSet &hostIdSet_;
00054     };
00055 
00056   }
00057 
00058 }
00059 
00060 #endif // #ifndef DUNE_GEOGRID_IDSET_HH