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#if DUNE_VERSION_NEWER(DUNE_GRID, 2, 7)
54 return entity.impl().index();
56 return grid().getRealImplementation(entity).index();
61 IndexType subIndex (
const typename Traits::template Codim< cd >::Entity &entity,
int i,
unsigned int codim )
const
63 return subIndex( entity, i, codim );
66 template<
class Entity >
67 IndexType subIndex (
const Entity &entity,
int i,
unsigned int codim )
const
70 return index( entity );
71 else if ( codim == 1 )
72#if DUNE_VERSION_NEWER(DUNE_GRID, 2, 7)
73 return index( entity.impl().template subEntity< 1 > ( i ) );
75 return index( grid().getRealImplementation( entity ).
template subEntity< 1 > ( i ) );
77 else if ( codim == dimension )
79#if DUNE_VERSION_NEWER(DUNE_GRID, 2, 7)
80 return index( entity.impl().template subEntity< dimension > ( i ) );
82 return index( grid().getRealImplementation( entity ).
template subEntity< dimension > ( i ) );
87 DUNE_THROW(NotImplemented,
"codimension not available");
88 return IndexType( -1 );
92 IndexType size ( GeometryType type )
const
94 return grid().size( type );
97 int size (
int codim )
const
99 return grid().size( codim );
102 template<
class Entity >
103 bool contains (
const Entity &entity )
const
105 return index(entity) >= 0 && index(entity) < size(Entity::codimension);
108 const std::vector< GeometryType > &geomTypes (
int codim )
const
110 return grid().geomTypes(codim);
113 const std::vector< GeometryType >& types(
int codim)
const
115 return grid().geomTypes(codim);
118 const GridType& grid()
const { assert( grid_ );
return *grid_; }
Definition: indexset.hh:25
identical grid wrapper
Definition: grid.hh:163
Copyright 2019 Equinor AS.
Definition: CartesianIndexMapper.hpp:10