3 #ifndef DUNE_POLYHEDRALGRID_IDSET_HH
4 #define DUNE_POLYHEDRALGRID_IDSET_HH
6 #include <dune/grid/common/indexidset.hh>
14 template<
int dim,
int dimworld,
typename coord_t >
16 :
public IdSet< PolyhedralGrid< dim, dimworld, coord_t >, PolyhedralGridIdSet< dim, dimworld, coord_t >, std::size_t >
20 typedef typename std::remove_const< Grid >::type::Traits Traits;
21 typedef std::size_t IdType;
24 typedef IdSet< Grid, This, IdType > Base;
28 globalCellPtr_( grid_.globalCellPtr() )
30 codimOffset_[ 0 ] = 0;
31 for(
int i=1; i<=dim; ++i )
33 codimOffset_[ i ] = codimOffset_[ i-1 ] + grid.size( i-1 );
39 IdType
id (
const typename Traits::template Codim< codim >::Entity &entity )
const
41 const int index = entity.seed().index();
43 if (codim == 0 && globalCellPtr_ )
44 return IdType( globalCellPtr_[ index ] );
47 return codimOffset_[ codim ] + index;
52 template<
class Entity >
53 IdType
id (
const Entity &entity )
const
55 return id< Entity::codimension >( entity );
59 template<
class IntersectionImpl >
60 IdType
id (
const Dune::Intersection< const Grid, IntersectionImpl >& intersection )
const
62 #if DUNE_VERSION_NEWER(DUNE_GRID, 2, 7)
63 return intersection.impl().id();
65 return Grid::getRealImplementation( intersection ).id();
70 template<
class Entity >
71 IdType
subId (
const Entity &entity,
int i,
unsigned int codim )
const
75 else if ( codim == 1 )
76 return id( entity.template subEntity< 1 >( i ) );
77 else if ( codim == dim )
79 return id( entity.template subEntity< dim >( i ) );
83 DUNE_THROW(NotImplemented,
"codimension not available");
90 const int* globalCellPtr_;
91 IdType codimOffset_[ dim+1 ];
IdType id(const typename Traits::template Codim< codim >::Entity &entity) const
id meethod for entity and specific codim
Definition: idset.hh:39
IdType id(const Dune::Intersection< const Grid, IntersectionImpl > &intersection) const
id method of all entities
Definition: idset.hh:60
IdType subId(const Entity &entity, int i, unsigned int codim) const
subId method for entities
Definition: idset.hh:71
IdType id(const Entity &entity) const
id method of all entities
Definition: idset.hh:53
identical grid wrapper
Definition: grid.hh:163
Copyright 2019 Equinor AS.
Definition: CartesianIndexMapper.hpp:10