dune-spgrid  2.7
entityseed.hh
Go to the documentation of this file.
1 #ifndef DUNE_SPGRID_ENTITYSEED_HH
2 #define DUNE_SPGRID_ENTITYSEED_HH
3 
4 #include <cassert>
5 
6 #include <dune/common/typetraits.hh>
7 
13 namespace Dune
14 {
15 
30  template< int codim, class Grd >
31  struct SPEntitySeed
32  {
34  typedef typename std::remove_const< Grd >::type Grid;
35 
37  typedef typename Grid::Traits::ReferenceCube ReferenceCube;
38 
40  static const int dimension = ReferenceCube::dimension;
42  static const int codimension = codim;
44  static const int mydimension = dimension - codimension;
46  static const int dimensionworld = dimension;
47 
49  typedef typename Grid::Traits::template Codim< codimension >::Entity Entity;
50 
52  typedef typename ReferenceCube::MultiIndex MultiIndex;
53 
59  : level_( -1 )
60  {}
61 
70  SPEntitySeed ( const int level, const MultiIndex &id, const unsigned int partitionNumber )
71  : level_( level ), id_( id ), partitionNumber_( partitionNumber )
72  {}
73 
75  bool isValid () const { return (level_ >= 0); }
76 
82  int level () const
83  {
84  assert( isValid() );
85  return level_;
86  }
87 
93  MultiIndex id () const
94  {
95  assert( isValid() );
96  return id_;
97  }
98 
104  unsigned int partitionNumber () const
105  {
106  assert( isValid() );
107  return partitionNumber_;
108  }
109 
110  private:
111  int level_;
112  MultiIndex id_;
113  unsigned int partitionNumber_;
114  };
115 
116 } // namespace Dune
117 
118 #endif // #ifndef DUNE_SPGRID_ENTITYSEED_HH
Definition: iostream.hh:7
entity seed for SPGrid
Definition: entityseed.hh:32
std::remove_const< Grd >::type Grid
type of grid this entity seed belongs to
Definition: entityseed.hh:34
static const int dimension
dimension of the grid
Definition: entityseed.hh:40
bool isValid() const
check whether this seed generates a valid entity
Definition: entityseed.hh:75
SPEntitySeed()
default constructor
Definition: entityseed.hh:58
ReferenceCube::MultiIndex MultiIndex
Definition: entityseed.hh:52
Grid::Traits::ReferenceCube ReferenceCube
Definition: entityseed.hh:37
MultiIndex id() const
Definition: entityseed.hh:93
static const int dimensionworld
world dimension of the grid
Definition: entityseed.hh:46
static const int mydimension
dimension of the seeded entity
Definition: entityseed.hh:44
SPEntitySeed(const int level, const MultiIndex &id, const unsigned int partitionNumber)
Definition: entityseed.hh:70
static const int codimension
codimension of the seeded entity
Definition: entityseed.hh:42
Grid::Traits::template Codim< codimension >::Entity Entity
type of the seeded entity
Definition: entityseed.hh:49
unsigned int partitionNumber() const
Definition: entityseed.hh:104
int level() const
Definition: entityseed.hh:82