23 class PolyhedralGridIndexSet
24 :
public IndexSet< PolyhedralGrid< dim, dimworld, coord_t >, PolyhedralGridIndexSet< dim, dimworld, coord_t >, int >
29 typedef PolyhedralGridIndexSet< dim, dimworld, coord_t > This;
30 typedef IndexSet< GridType, This, int > Base;
32 typedef typename std::remove_const< GridType >::type::Traits Traits;
35 static const int dimension = Traits::dimension;
37 typedef typename Base::IndexType IndexType;
39 explicit PolyhedralGridIndexSet (
const GridType& grid )
44 template<
class Entity >
45 IndexType index (
const Entity &entity )
const
47 return index< Entity::codimension >( entity );
51 IndexType index (
const typename Traits::template Codim< cd >::Entity &entity )
const
53 return entity.impl().index();
57 IndexType subIndex (
const typename Traits::template Codim< cd >::Entity &entity,
int i,
unsigned int codim )
const
59 return subIndex( entity, i, codim );
62 template<
class Entity >
63 IndexType subIndex (
const Entity &entity,
int i,
unsigned int codim )
const
66 return index( entity );
67 else if ( codim == 1 )
68 return index( entity.impl().template subEntity< 1 > ( i ) );
69 else if ( codim == dimension )
71 return index( entity.impl().template subEntity< dimension > ( i ) );
75 DUNE_THROW(NotImplemented,
"codimension not available");
76 return IndexType( -1 );
80 IndexType size ( GeometryType type )
const
82 return grid().size( type );
85 int size (
int codim )
const
87 return grid().size( codim );
90 template<
class Entity >
91 bool contains (
const Entity &entity )
const
93 return index(entity) >= 0 && index(entity) < size(Entity::codimension);
96 const std::vector< GeometryType > &geomTypes (
int codim )
const
98 return grid().geomTypes(codim);
103#if DUNE_VERSION_EQUAL(DUNE_GRID, 2, 10)
104 std::vector< GeometryType > types(
int codim)
const
106 const std::vector< GeometryType >& types(
int codim)
const
109 return grid().geomTypes(codim);
112 const GridType& grid()
const { assert( grid_ );
return *grid_; }
115 const GridType *grid_;