dune-grid  2.3.1
albertagrid/entitypointer.hh
Go to the documentation of this file.
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 #ifndef DUNE_ALBERTA_ENTITYPOINTER_HH
4 #define DUNE_ALBERTA_ENTITYPOINTER_HH
5 
7 
9 
10 #if HAVE_ALBERTA
11 
12 namespace Dune
13 {
14 
15  // External Forward Declarations
16  // -----------------------------
17 
18  template< int dim, int dimworld >
19  class AlbertaGrid;
20 
21 
22 
27  template< int codim, class GridImp >
29  {
31 
32  friend class AlbertaGrid< GridImp::dimension, GridImp::dimensionworld >;
33 
34  public:
35  static const int dimension = GridImp::dimension;
36  static const int codimension = codim;
37  static const int mydimension = dimension - codimension;
38  static const int dimensionworld = GridImp::dimensionworld;
39 
40  typedef typename GridImp::template Codim< codimension >::Entity Entity;
41 
42  protected:
45 
46  public:
47  typedef AlbertaGridEntityPointer< codimension, GridImp > EntityPointerImp;
48 
49  typedef typename EntityImp::ElementInfo ElementInfo;
50 
52  AlbertaGridEntityPointer ( const GridImp &grid,
53  const ElementInfo &elementInfo,
54  int subEntity );
55 
57  AlbertaGridEntityPointer ( const GridImp &grid );
58 
60  AlbertaGridEntityPointer ( const EntityImp &entity );
61 
62 #if 0
63 
64  AlbertaGridEntityPointer ( const This &other );
65 #endif
66 
67 #if 0
68 
70 #endif
71 
72 #if 0
73 
74  This &operator= ( const This &other );
75 #endif
76 
78  bool equals ( const This &other ) const;
79 
81  Entity &dereference () const;
82 
84  int level () const;
85 
86  protected:
88  EntityImp &entityImp ();
89 
91  const EntityImp &entityImp () const;
92 
94  const GridImp &grid () const;
95 
96  private:
97  mutable EntityObject entity_;
98  };
99 
100 
101 
102  template< int codim, class GridImp >
103  inline AlbertaGridEntityPointer< codim, GridImp >
104  ::AlbertaGridEntityPointer ( const GridImp &grid,
105  const ElementInfo &elementInfo,
106  int subEntity )
107  : entity_( EntityImp( grid, elementInfo, subEntity ) )
108  {}
109 
110 
111  template<int codim, class GridImp >
114  : entity_( EntityImp( grid ) )
115  {}
116 
117 
118  template< int codim, class GridImp >
121  : entity_( entity )
122  {}
123 
124 
125 #if 0
126  template< int codim, class GridImp >
128  ::AlbertaGridEntityPointer ( const This &other )
129  : entity_( other.entity_ )
130  {}
131 #endif
132 
133 
134 #if 0
135  template<int codim, class GridImp >
136  inline AlbertaGridEntityPointer< codim, GridImp >::~AlbertaGridEntityPointer ()
137  {}
138 #endif
139 
140 
141 #if 0
142  template< int codim, class GridImp >
143  inline typename AlbertaGridEntityPointer< codim, GridImp >::This &
144  AlbertaGridEntityPointer< codim, GridImp >::operator= ( const This &other )
145  {
146  entityImp().setEntity( other.entityImp() );
147  return *this;
148  }
149 #endif
150 
151 
152  template<int codim, class GridImp >
153  inline bool
155  {
156  return entityImp().equals( other.entityImp() );
157  }
158 
159 
160  template<int codim, class GridImp >
163  {
164  return entity_;
165  }
166 
167 
168  template< int codim, class GridImp >
170  {
171  return entityImp().level();
172  }
173 
174 
175  template< int codim, class GridImp >
178  {
179  return GridImp::getRealImplementation( entity_ );
180  }
181 
182 
183  template< int codim, class GridImp >
186  {
187  return GridImp::getRealImplementation( entity_ );
188  }
189 
190 
191  template< int codim, class GridImp >
193  {
194  return entityImp().grid();
195  }
196 
197 }
198 
199 #endif // #if HAVE_ALBERTA
200 
201 #endif // #ifndef DUNE_ALBERTA_ENTITYPOINTER_HH