3 #ifndef DUNE_POLYHEDRALGRID_INDEXSET_HH
4 #define DUNE_POLYHEDRALGRID_INDEXSET_HH
8 #include <dune/common/typetraits.hh>
10 #include <dune/grid/common/gridenums.hh>
11 #include <dune/grid/common/indexidset.hh>
13 #include <opm/grid/polyhedralgrid/declaration.hh>
21 template<
int dim,
int dimworld,
typename coord_t >
23 :
public IndexSet< PolyhedralGrid< dim, dimworld, coord_t >, PolyhedralGridIndexSet< dim, dimworld, coord_t >, int >
29 typedef IndexSet< GridType, This, int > Base;
31 typedef typename std::remove_const< GridType >::type::Traits Traits;
34 static const int dimension = Traits::dimension;
36 typedef typename Base::IndexType IndexType;
43 template<
class Entity >
44 IndexType index (
const Entity &entity )
const
46 return index< Entity::codimension >( entity );
50 IndexType index (
const typename Traits::template Codim< cd >::Entity &entity )
const
52 #if DUNE_VERSION_NEWER(DUNE_GRID, 2, 7)
53 return entity.impl().index();
55 return grid().getRealImplementation(entity).index();
60 IndexType subIndex (
const typename Traits::template Codim< cd >::Entity &entity,
int i,
unsigned int codim )
const
62 return subIndex( entity, i, codim );
65 template<
class Entity >
66 IndexType subIndex (
const Entity &entity,
int i,
unsigned int codim )
const
69 return index( entity );
70 else if ( codim == 1 )
71 #if DUNE_VERSION_NEWER(DUNE_GRID, 2, 7)
72 return index( entity.impl().template subEntity< 1 > ( i ) );
74 return index( grid().getRealImplementation( entity ).
template subEntity< 1 > ( i ) );
76 else if ( codim == dimension )
78 #if DUNE_VERSION_NEWER(DUNE_GRID, 2, 7)
79 return index( entity.impl().template subEntity< dimension > ( i ) );
81 return index( grid().getRealImplementation( entity ).
template subEntity< dimension > ( i ) );
86 DUNE_THROW(NotImplemented,
"codimension not available");
87 return IndexType( -1 );
91 IndexType size ( GeometryType type )
const
93 return grid().size( type );
96 int size (
int codim )
const
98 return grid().size( codim );
101 template<
class Entity >
102 bool contains (
const Entity &entity )
const
104 return index(entity) >= 0 && index(entity) < size(Entity::codimension);
107 const std::vector< GeometryType > &geomTypes (
int codim )
const
109 return grid().geomTypes(codim);
112 const std::vector< GeometryType >& types(
int codim)
const
114 return grid().geomTypes(codim);
117 const GridType& grid()
const { assert( grid_ );
return *grid_; }
Definition: indexset.hh:24
identical grid wrapper
Definition: grid.hh:158
Copyright 2019 Equinor AS.
Definition: CartesianIndexMapper.hpp:10