dune-grid  2.2.0
albertagrid/entityseed.hh
Go to the documentation of this file.
1 #ifndef DUNE_ALBERTA_ENTITYSEED_HH
2 #define DUNE_ALBERTA_ENTITYSEED_HH
3 
6 
7 namespace Dune
8 {
9 
10  // Internal Forward Declarations
11  // -----------------------------
12 
13  template< int codim, class Grid >
14  class AlbertaGridEntitySeed;
15 
16 
17 
18  // External Forward Declarations
19  // -----------------------------
20 
21  template< int dim, int dimworld >
22  class AlbertaGrid;
23 
24 
25 
26 #if HAVE_ALBERTA
27 
28  // AlbertaGridEntitySeed (for higher codimension)
29  // ----------------------------------------------
30 
31  template< int codim, int dim, int dimworld >
32  class AlbertaGridEntitySeed< codim, const AlbertaGrid< dim, dimworld > >
33  {
34  public:
36 
37  static const int codimension = codim;
38  static const int dimension = dim;
39  static const int mydimension = dimension - codimension;
40  static const int dimensionworld = dimworld;
41 
44  typedef typename ElementInfo::Seed Seed;
45 
46  typedef typename Grid::template Codim< codimension >::Entity Entity;
47 
48  AlbertaGridEntitySeed ( const ElementInfo &elementInfo, int subEntity )
49  : seed_( elementInfo.seed() ),
50  subEntity_( subEntity )
51  {}
52 
53  ElementInfo elementInfo ( const MeshPointer &mesh ) const { return ElementInfo( mesh, seed_ ); }
54  int subEntity () const { return subEntity_; }
55 
56  private:
57  Seed seed_;
58  int subEntity_;
59  };
60 
61 
62 
63  // AlbertaGridEntitySeed (for codimension 0)
64  // -----------------------------------------
65 
66  template< int dim, int dimworld >
67  class AlbertaGridEntitySeed< 0, const AlbertaGrid< dim, dimworld > >
68  {
69  public:
71 
72  static const int codimension = 0;
73  static const int dimension = dim;
74  static const int mydimension = dimension - codimension;
75  static const int dimensionworld = dimworld;
76 
79  typedef typename ElementInfo::Seed Seed;
80 
81  typedef typename Grid::template Codim< codimension >::Entity Entity;
82 
83  explicit AlbertaGridEntitySeed ( const ElementInfo &elementInfo )
84  : seed_( elementInfo.seed() )
85  {}
86 
87  ElementInfo elementInfo ( const MeshPointer &mesh ) const { return ElementInfo( mesh, seed_ ); }
88  int subEntity () const { return 0; }
89 
90  private:
91  Seed seed_;
92  };
93 
94 #endif // #if HAVE_ALBERTA
95 
96 } // end namespace Dune
97 
98 #endif // #ifndef DUNE_ALBERTA_ENTITYSEED_HH