dune-grid  2.4
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 >
28  class AlbertaGridEntityPointer
29  {
30  typedef AlbertaGridEntityPointer< codim, GridImp > This;
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 
54  AlbertaGridEntityPointer ( const GridImp &grid,
55  const ElementInfo &elementInfo,
56  int subEntity );
57 
59  AlbertaGridEntityPointer ( const GridImp &grid );
60 
62  AlbertaGridEntityPointer ( const EntityImp &entity );
63 
64 #if 0
67 #endif
68 
70  bool equals ( const This &other ) const;
71 
73  Entity &dereference () const;
74 
76  int level () const;
77 
78  protected:
80  EntityImp &entityImp ();
81 
83  const EntityImp &entityImp () const;
84 
86  const GridImp &grid () const;
87 
88  private:
89  mutable Entity entity_;
90  };
91 
92 
93 
94  template< int codim, class GridImp >
95  inline AlbertaGridEntityPointer< codim, GridImp >
97  {}
98 
99 
100  template< int codim, class GridImp >
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  {}
127 #endif
128 
129 
130  template<int codim, class GridImp >
131  inline bool
133  {
134  return entityImp().equals( other.entityImp() );
135  }
136 
137 
138  template<int codim, class GridImp >
141  {
142  return entity_;
143  }
144 
145 
146  template< int codim, class GridImp >
148  {
149  return entityImp().level();
150  }
151 
152 
153  template< int codim, class GridImp >
156  {
157  return GridImp::getRealImplementation( entity_ );
158  }
159 
160 
161  template< int codim, class GridImp >
164  {
165  return GridImp::getRealImplementation( entity_ );
166  }
167 
168 
169  template< int codim, class GridImp >
171  {
172  return entityImp().grid();
173  }
174 
175 }
176 
177 #endif // #if HAVE_ALBERTA
178 
179 #endif // #ifndef DUNE_ALBERTA_ENTITYPOINTER_HH
bool equals(const This &other) const
equality
Definition: albertagrid/entitypointer.hh:132
EntityImp & entityImp()
obtain reference to internal entity implementation
Definition: albertagrid/entitypointer.hh:155
AlbertaGridEntityPointer()
Definition: albertagrid/entitypointer.hh:96
Include standard header files.
Definition: agrid.hh:59
Entity & dereference() const
dereferencing
Definition: albertagrid/entitypointer.hh:140
const GridImp & grid() const
obtain a reference to the grid
Definition: albertagrid/entitypointer.hh:170
int level() const
ask for level of entities
Definition: albertagrid/entitypointer.hh:147
EntityPointer implementation for AlbertaGrid.
Definition: albertagrid/entity.hh:21
Wrapper and interface class for a static iterator (EntityPointer)
Definition: objectfactory.hh:23
[ provides Dune::Grid ]
Definition: agrid.hh:137
static const int dimension
Definition: albertagrid/entitypointer.hh:35
EntityObject::ImplementationType EntityImp
Definition: albertagrid/entitypointer.hh:44
static const int codimension
Definition: albertagrid/entitypointer.hh:36
Entity::Implementation ImplementationType
Definition: common/grid.hh:1468
provides a wrapper for ALBERTA's el_info structure
GridImp::template Codim< codimension >::Entity Entity
Definition: albertagrid/entitypointer.hh:40
static const int mydimension
Definition: albertagrid/entitypointer.hh:37
static const int dimensionworld
Definition: albertagrid/entitypointer.hh:38
EntityImp::ElementInfo ElementInfo
Definition: albertagrid/entitypointer.hh:49