Dune Core Modules (2.9.0)

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 
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
Traits for type conversions and type information.
Dune namespace.
Definition: alignedallocator.hh:13
Static tag representing a codimension.
Definition: dimension.hh:24
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
type of multi index
Definition: entityseed.hh:52
Grid::Traits::ReferenceCube ReferenceCube
type of reference cube
Definition: entityseed.hh:37
MultiIndex id() const
obtain the multi index of the seeded entity
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)
constructor
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
obtain number of the partition, the seeded entity belongs to
Definition: entityseed.hh:104
int level() const
obtain level of the seeded entity
Definition: entityseed.hh:82
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (Apr 27, 22:29, 2024)