dune-fem  2.8-git
geometrygridpart/indexset.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_GRIDPART_GEOMETRYGRIDPART_INDEXSET_HH
2 #define DUNE_FEM_GRIDPART_GEOMETRYGRIDPART_INDEXSET_HH
3 
4 #include <vector>
5 
6 #include <dune/common/typetraits.hh>
7 
8 #include <dune/grid/common/gridenums.hh>
9 #include <dune/grid/common/indexidset.hh>
10 
11 namespace Dune
12 {
13 
14  namespace Fem
15  {
16 
17  // GeometryGridPartIndexSet
18  // ----------
19 
20  template< class HostIndexSet >
22  {
24 
25  public:
27 
28  explicit GeometryGridPartIndexSet ( const HostIndexSet &hostIndexSet )
29  : hostIndexSet_( &hostIndexSet )
30  {}
31 
32  int size ( const GeometryType &type ) const { return hostIndexSet().size( type ); }
33  int size ( const int codim ) const { return hostIndexSet().size( codim ); }
34 
35  template< class Entity >
36  int index ( const Entity &entity ) const
37  {
38  return hostIndexSet().index( entity.impl().hostEntity() );
39  }
40 
41  template< class Entity >
42  int subIndex ( const Entity &entity, const int local, const unsigned int codim ) const
43  {
44  return hostIndexSet().subIndex( entity.impl().hostEntity(), local, codim );
45  }
46 
47  const std::vector< GeometryType > &geomTypes ( const int codim ) const
48  {
49  return hostIndexSet().geomTypes( codim );
50  }
51 
52  template< class Entity >
53  bool contains ( const Entity &entity ) const
54  {
55  return hostIndexSet().contains( entity.impl().hostEntity() );
56  }
57 
58  bool consecutive () const { return hostIndexSet().consecutive(); }
59  bool persistent () const { return hostIndexSet().persistent(); }
60 
61  int numberOfHoles ( const int codim ) const { return hostIndexSet().numberOfHoles( codim ); }
62 
63  int oldIndex ( const int hole, const int codim ) const
64  {
65  return hostIndexSet().oldIndex( hole, codim );
66  }
67 
68  int newIndex ( const int hole, const int codim ) const
69  {
70  return hostIndexSet().newIndex( hole, codim );
71  }
72 
73  std::string name () const { return "GeometryGridPart::IndexSet" ; }
74 
75  private:
76  const HostIndexSet &hostIndexSet () const
77  {
78  assert( hostIndexSet_ );
79  return *hostIndexSet_;
80  }
81 
82  const HostIndexSet *hostIndexSet_;
83  };
84 
85  } // namespace Fem
86 
87 } // namespace Dune
88 
89 #endif // #ifndef DUNE_FEM_GRIDPART_GEOMETRYGRIDPART_INDEXSET_HH
Definition: bindguard.hh:11
typename Impl::Index< Range >::Type IndexType
Definition: hybrid.hh:69
Definition: geometrygridpart/indexset.hh:22
int newIndex(const int hole, const int codim) const
Definition: geometrygridpart/indexset.hh:68
int index(const Entity &entity) const
Definition: geometrygridpart/indexset.hh:36
int oldIndex(const int hole, const int codim) const
Definition: geometrygridpart/indexset.hh:63
HostIndexSet::IndexType IndexType
Definition: geometrygridpart/indexset.hh:26
bool contains(const Entity &entity) const
Definition: geometrygridpart/indexset.hh:53
std::string name() const
Definition: geometrygridpart/indexset.hh:73
int subIndex(const Entity &entity, const int local, const unsigned int codim) const
Definition: geometrygridpart/indexset.hh:42
int numberOfHoles(const int codim) const
Definition: geometrygridpart/indexset.hh:61
GeometryGridPartIndexSet(const HostIndexSet &hostIndexSet)
Definition: geometrygridpart/indexset.hh:28
int size(const int codim) const
Definition: geometrygridpart/indexset.hh:33
int size(const GeometryType &type) const
Definition: geometrygridpart/indexset.hh:32
bool consecutive() const
Definition: geometrygridpart/indexset.hh:58
bool persistent() const
Definition: geometrygridpart/indexset.hh:59
const std::vector< GeometryType > & geomTypes(const int codim) const
Definition: geometrygridpart/indexset.hh:47