3 #ifndef DUNE_POLYHEDRALGRID_INDEXSET_HH 4 #define DUNE_POLYHEDRALGRID_INDEXSET_HH 8 #include <dune/common/typetraits.hh> 9 #include <dune/common/version.hh> 11 #include <dune/grid/common/gridenums.hh> 12 #include <dune/grid/common/indexidset.hh> 14 #include <opm/grid/polyhedralgrid/declaration.hh> 22 template<
int dim,
int dimworld,
typename coord_t >
24 :
public IndexSet< PolyhedralGrid< dim, dimworld, coord_t >, PolyhedralGridIndexSet< dim, dimworld, coord_t >, int >
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;
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_; }
120 #endif // #ifndef DUNE_POLYHEDRALGRID_INDEXSET_HH int size(int, int codim) const
obtain number of entites on a level
Definition: grid.hh:428
The namespace Dune is the main namespace for all Dune code.
Definition: CartesianIndexMapper.hpp:9
identical grid wrapper
Definition: declaration.hh:10
Definition: indexset.hh:23