dune-grid  2.2.1
albertagrid/entitypointer.hh
Go to the documentation of this file.
1 #ifndef DUNE_ALBERTA_ENTITYPOINTER_HH
2 #define DUNE_ALBERTA_ENTITYPOINTER_HH
3 
5 
7 
8 #if HAVE_ALBERTA
9 
10 namespace Dune
11 {
12 
13  // External Forward Declarations
14  // -----------------------------
15 
16  template< int dim, int dimworld >
17  class AlbertaGrid;
18 
19 
20 
25  template< int codim, class GridImp >
26  class AlbertaGridEntityPointer
27  {
28  typedef AlbertaGridEntityPointer< codim, GridImp > This;
29 
30  friend class AlbertaGrid< GridImp::dimension, GridImp::dimensionworld >;
31 
32  public:
33  static const int dimension = GridImp::dimension;
34  static const int codimension = codim;
35  static const int mydimension = dimension - codimension;
36  static const int dimensionworld = GridImp::dimensionworld;
37 
38  typedef typename GridImp::template Codim< codimension >::Entity Entity;
39 
40  protected:
43 
44  public:
45  typedef AlbertaGridEntityPointer< codimension, GridImp > EntityPointerImp;
46 
47  typedef typename EntityImp::ElementInfo ElementInfo;
48 
50  AlbertaGridEntityPointer ( const GridImp &grid,
51  const ElementInfo &elementInfo,
52  int subEntity );
53 
55  AlbertaGridEntityPointer ( const GridImp &grid );
56 
58  AlbertaGridEntityPointer ( const EntityImp &entity );
59 
60 #if 0
61 
62  AlbertaGridEntityPointer ( const This &other );
63 #endif
64 
65 #if 0
66 
68 #endif
69 
70 #if 0
71 
72  This &operator= ( const This &other );
73 #endif
74 
76  bool equals ( const This &other ) const;
77 
79  Entity &dereference () const;
80 
82  int level () const;
83 
84  protected:
86  EntityImp &entityImp ();
87 
89  const EntityImp &entityImp () const;
90 
92  const GridImp &grid () const;
93 
94  private:
95  mutable EntityObject entity_;
96  };
97 
98 
99 
100  template< int codim, class GridImp >
101  inline AlbertaGridEntityPointer< codim, GridImp >
102  ::AlbertaGridEntityPointer ( const GridImp &grid,
103  const ElementInfo &elementInfo,
104  int subEntity )
105  : entity_( EntityImp( grid, elementInfo, subEntity ) )
106  {}
107 
108 
109  template<int codim, class GridImp >
112  : entity_( EntityImp( grid ) )
113  {}
114 
115 
116  template< int codim, class GridImp >
119  : entity_( entity )
120  {}
121 
122 
123 #if 0
124  template< int codim, class GridImp >
126  ::AlbertaGridEntityPointer ( const This &other )
127  : entity_( other.entity_ )
128  {}
129 #endif
130 
131 
132 #if 0
133  template<int codim, class GridImp >
134  inline AlbertaGridEntityPointer< codim, GridImp >::~AlbertaGridEntityPointer ()
135  {}
136 #endif
137 
138 
139 #if 0
140  template< int codim, class GridImp >
141  inline typename AlbertaGridEntityPointer< codim, GridImp >::This &
142  AlbertaGridEntityPointer< codim, GridImp >::operator= ( const This &other )
143  {
144  entityImp().setEntity( other.entityImp() );
145  return *this;
146  }
147 #endif
148 
149 
150  template<int codim, class GridImp >
151  inline bool
153  {
154  return entityImp().equals( other.entityImp() );
155  }
156 
157 
158  template<int codim, class GridImp >
161  {
162  return entity_;
163  }
164 
165 
166  template< int codim, class GridImp >
168  {
169  return entityImp().level();
170  }
171 
172 
173  template< int codim, class GridImp >
176  {
177  return GridImp::getRealImplementation( entity_ );
178  }
179 
180 
181  template< int codim, class GridImp >
184  {
185  return GridImp::getRealImplementation( entity_ );
186  }
187 
188 
189  template< int codim, class GridImp >
191  {
192  return entityImp().grid();
193  }
194 
195 }
196 
197 #endif // #if HAVE_ALBERTA
198 
199 #endif // #ifndef DUNE_ALBERTA_ENTITYPOINTER_HH