1 #ifndef DUNE_ALU3DGRIDENTITY_HH
2 #define DUNE_ALU3DGRIDENTITY_HH
3 
4 // System includes
5 #include <type_traits>
6 
7 // Dune includes
8 #include <dune/grid/common/entity.hh>
9 #include <dune/alugrid/common/intersectioniteratorwrapper.hh>
10 #include <dune/alugrid/common/twists.hh>
11 
12 // Local includes
13 #include "alu3dinclude.hh"
14 #include "indexsets.hh"
15 #include "iterator.hh"
16 #include "entityseed.hh"
17 
18 namespace Dune
19 {
20 
21   // Forward declarations
22   template<int cd, int dim, class GridImp>
23   class ALU3dGridEntity;
24   template<int cd, PartitionIteratorType pitype, class GridImp >
25   class ALU3dGridLevelIterator;
26   template<int cd, class GridImp >
27   class ALU3dGridEntityPointer;
28   template<int mydim, int coorddim, class GridImp>
29   class ALU3dGridGeometry;
30   template<class GridImp>
31   class ALU3dGridHierarchicIterator;
32   template<class GridImp>
33   class ALU3dGridIntersectionIterator;
34   template<int codim, PartitionIteratorType, class GridImp>
35   class ALU3dGridLeafIterator;
36   template<int dim, int dimworld, ALU3dGridElementType, class >
37   class ALU3dGrid;
38 
39 /*!
40   A Grid is a container of grid entities. An entity is parametrized by the codimension.
41   An entity of codimension c in dimension d is a d-c dimensional object.
42 
43   Here: the general template
44  */
45 template<int cd, int dim, class GridImp>
46 class ALU3dGridEntity :
47 public EntityDefaultImplementation <cd,dim,GridImp,ALU3dGridEntity>
48 {
49   // default just returns level
50   template <class GridType, int dm, int cdim>
51   struct GetLevel
52   {
53     template <class ItemType>
getLevelDune::ALU3dGridEntity::GetLevel54     static int getLevel(const GridType & grid, const ItemType & item )
55     {
56       return item.level();
57     }
58   };
59 
60   // for leaf vertices the level is somewhat difficult to obtain, because
61   // this the maximum of levels of elements that have this vertex as sub
62   // entity
63   template <class GridType>
64   struct GetLevel<GridType,dim,dim>
65   {
66     template <class ItemType>
getLevelDune::ALU3dGridEntity::GetLevel67     static int getLevel(const GridType & grid, const ItemType & item)
68     {
69       return (item.isLeafEntity()) ? grid.getLevelOfLeafVertex(item) : item.level();
70     }
71   };
72 
73   enum { dimworld = GridImp::dimensionworld };
74 
75   typedef typename GridImp::MPICommunicatorType Comm;
76 
77   friend class ALU3dGrid< GridImp::dimension, GridImp::dimensionworld, GridImp::elementType, Comm >;
78   friend class ALU3dGridEntity < 0, dim, GridImp >;
79   friend class ALU3dGridLevelIterator < cd, All_Partition, GridImp >;
80 
81   friend class ALU3dGridHierarchicIndexSet< GridImp::dimension, GridImp::dimensionworld, GridImp::elementType, Comm >;
82 
83   template< class > friend class ALU3dGridFactory;
84 
85   typedef typename GridImp::Traits::template Codim< cd >::GeometryImpl GeometryImpl;
86 
87 public:
88   typedef ALU3dImplTraits< GridImp::elementType, Comm > ImplTraits;
89   typedef typename ImplTraits::template Codim<dim, cd>::InterfaceType      HItemType;
90   typedef typename ImplTraits::template Codim<dim, cd>::ImplementationType ItemType;
91   typedef typename ImplTraits::VertexType   VertexType;
92   typedef typename ImplTraits::HBndSegType  HBndSegType;
93 
94   typedef typename GridImp::template Codim<cd>::Entity Entity;
95   typedef typename GridImp::template Codim<cd>::Geometry Geometry;
96 
97   //! typedef of my type
98   typedef typename GridImp::template Codim<cd>::EntitySeed EntitySeed;
99 
100   //! Constructor
101   ALU3dGridEntity();
102 
103   //! construct entity from seed
104   ALU3dGridEntity( const EntitySeed& seed );
105 
106   //! geometry of this entity
107   Geometry geometry () const;
108 
109   //! type of geometry of this entity
type() const110   GeometryType type () const { return geo_.type(); }
111 
112   // set element as normal entity
113   void setElement(const HItemType & item);
114   void setElement(const HItemType & item, const GridImp& grid );
115   void setElement(const HItemType & item, const int level, int twist=0);
116 
117   /* set entity from seed */
118   void setElement(const EntitySeed& seed);
119 
120   //! setGhost is not valid for this codim
121   void setGhost(const HBndSegType  &ghost);
122 
123   //! reset item pointer to NULL
removeElement()124   void removeElement ()
125   {
126     seed_.clear();
127     geo_.invalidate();
128   }
129 
130   //! compare 2 elements by comparing the item pointers
equals(const ALU3dGridEntity<cd,dim,GridImp> & org) const131   bool equals ( const ALU3dGridEntity<cd,dim,GridImp> & org ) const
132   {
133     return seed_ == org.seed_;
134   }
135 
136   //! set item from other entity, mainly for copy constructor of entity pointer
137   void setEntity ( const ALU3dGridEntity<cd,dim,GridImp> & org );
138 
subIndex(int i,unsigned int codim) const139   int subIndex ( int i, unsigned int codim ) const
140   {
141     DUNE_THROW( NotImplemented, "Method subIndex for higher codimension not implemented, yet." );
142   }
143 
144   // return reference to internal item
getItem() const145   const ItemType& getItem () const { return *(static_cast<ItemType *> (seed_.item())); }
146 
147   //! return seed of entity
seed() const148   EntitySeed seed() const { return seed_; }
149 
150   //! level of this element
level() const151   int level () const { return seed_.level(); }
152 
153   //! return partition type of this entity ( see grid.hh )
partitionType() const154   PartitionType partitionType() const { return this->convertBndId( getItem() ); }
155 
156 protected:
157   //! index is unique within the grid hierarchy and per codim
getIndex() const158   int getIndex () const { return getItem().getIndex(); }
159 
160   //! convert ALUGrid partition type to dune partition type
161   PartitionType convertBndId(const HItemType & item) const ;
162 
163   //! the current geometry
164   mutable GeometryImpl geo_;
165 
166   //! the information necessary to make sense of this entity
167   EntitySeed seed_;
168 };
169 
170 /*!
171   A Grid is a container of grid entities. An entity is parametrized by the codimension.
172   An entity of codimension c in dimension d is a d-c dimensional object.
173 
174   Entities of codimension 0 ("elements") are defined through template specialization. Note
175   that this specialization has an extended interface compared to the general case
176 
177   Entities of codimension 0  allow to visit all neighbors, where
178   a neighbor is an entity of codimension 0 which has a common entity of codimension 1 with the
179   These neighbors are accessed via an iterator. This allows the implementation of
180   non-matching meshes. The number of neigbors may be different from the number of faces/edges
181   of an element!
182  */
183 //***********************
184 //
185 //  --ALU3dGridEntity
186 //  --0Entity
187 //
188 //***********************
189 template<int dim, class GridImp>
190 class ALU3dGridEntity<0,dim,GridImp>
191 : public EntityDefaultImplementation<0,dim,GridImp,ALU3dGridEntity>
192 {
193   static const int dimworld = std::remove_const< GridImp >::type::dimensionworld;
194   static const ALU3dGridElementType elementType = std::remove_const< GridImp >::type::elementType;
195 
196   typedef typename GridImp::MPICommunicatorType Comm;
197 
198   typedef ALU3dImplTraits< elementType, Comm > ImplTraits;
199   typedef typename ImplTraits::template Codim<dim, 0>::InterfaceType     HElementType;
200 
201   typedef typename ImplTraits::GEOElementType  GEOElementType;
202   typedef typename ImplTraits::BNDFaceType  BNDFaceType;
203   typedef typename ImplTraits::IMPLElementType IMPLElementType;
204   typedef typename ImplTraits::HBndSegType     HBndSegType;
205 
206   enum { refine_element_t  = ImplTraits::RefinementRules::refine_element_t  };
207   enum { bisect_element_t  = ImplTraits::RefinementRules::bisect_element_t  };
208   enum { coarse_element_t  = ImplTraits::RefinementRules::coarse_element_t  };
209   enum { nosplit_element_t = ImplTraits::RefinementRules::nosplit_element_t };
210 
211   typedef typename ImplTraits::MarkRuleType MarkRuleType;
212 
213   friend class ALU3dGrid< GridImp::dimension, GridImp::dimensionworld, elementType, Comm >;
214   friend class ALU3dGridIntersectionIterator < GridImp >;
215   friend class ALU3dGridIntersectionIterator < const GridImp >;
216   friend class ALU3dGridHierarchicIterator   < const GridImp >;
217   friend class ALU3dGridHierarchicIterator   < GridImp >;
218   friend class ALU3dGridLevelIterator <0,All_Partition,GridImp>;
219   friend class ALU3dGridLevelIterator <1,All_Partition,GridImp>;
220   friend class ALU3dGridLevelIterator <2,All_Partition,GridImp>;
221   friend class ALU3dGridLevelIterator <3,All_Partition,GridImp>;
222   friend class ALU3dGridLeafIterator <0, All_Partition,GridImp>;
223   friend class ALU3dGridLeafIterator <1, All_Partition,GridImp>;
224   friend class ALU3dGridLeafIterator <2, All_Partition,GridImp>;
225   friend class ALU3dGridLeafIterator <3, All_Partition,GridImp>;
226 
227   friend class ALU3dGridHierarchicIndexSet< GridImp::dimension, GridImp::dimensionworld, elementType, Comm >;
228 
229   template< class > friend class ALU3dGridFactory;
230 
231   // type of reference element
232   typedef typename GridImp :: ReferenceElementType ReferenceElementType;
233 
234   typedef typename GridImp::Traits::template Codim< 0 >::GeometryImpl GeometryImpl;
235   typedef typename GridImp::Traits::template Codim< 0 >::LocalGeometryImpl LocalGeometryImpl;
236 
237 public:
238   typedef typename GridImp::template Codim< 0 >::Geometry Geometry;
239   typedef typename GridImp::template Codim< 0 >::LocalGeometry LocalGeometry;
240   typedef ALU3dGridIntersectionIterator<GridImp> IntersectionIteratorImp;
241 
242   typedef LeafIntersectionIteratorWrapper <GridImp>  ALU3dGridIntersectionIteratorType;
243   typedef LeafIntersectionIteratorWrapper <GridImp>  ALU3dGridLeafIntersectionIteratorType;
244   typedef LevelIntersectionIteratorWrapper<GridImp>  ALU3dGridLevelIntersectionIteratorType;
245 
246   typedef typename GridImp::template Codim<0>::Entity        Entity;
247 
248   template <int cd>
249   struct Codim
250   {
251     typedef typename GridImp::Traits::template Codim< cd >::Twists::Twist Twist;
252     typedef typename GridImp::template Codim< cd >::Entity Entity;
253   };
254 
255   //! typedef of my type
256   typedef typename GridImp::template Codim<0>::EntitySeed  EntitySeed;
257 
258   //! Constructor creating empty Entity
259   ALU3dGridEntity();
260 
261   //! Constructor taking an EntitySeed
262   ALU3dGridEntity( const EntitySeed& seed );
263 
264   //! Constructor taking an interior Element
265   ALU3dGridEntity( const HElementType& element );
266 
267   //! Constructor taking a ghost element
268   ALU3dGridEntity( const HBndSegType& ghost );
269 
270   //! level of this element
271   int level () const ;
272 
273   //! geometry of this entity
274   Geometry geometry () const;
275 
276   //! type of geometry of this entity
277   GeometryType type () const;
278 
279   //! return partition type of this entity ( see grid.hh )
280   PartitionType partitionType() const;
281 
282   /*! Intra-element access to entities of codimension cc > codim. Return number of entities
283       with codimension cc.
284   */
285   template<int cc> int count () const ;
286 
287   /*! Intra-element access to entities of codimension cc > codim. Return number of entities
288       with codimension cc.
289    */
290   unsigned int subEntities (unsigned int codim) const;
291 
292   //! Provide access to mesh entity i of given codimension. Entities
293   //!  are numbered 0 ... count<cc>()-1
294   template< int codim >
295   typename Codim< codim >::Entity subEntity ( int i ) const;
296 
297   template< int codim >
298   typename Codim< codim >::Twist twist ( int i ) const;
299 
300   //! returns true if Entity is leaf (i.e. has no children)
301   bool isLeaf () const;
302 
303   //! Inter-level access to father element on coarser grid.
304   //! Assumes that meshes are nested.
305   Entity father () const;
306 
307   //! returns true if father entity exists
hasFather() const308   bool hasFather () const
309   {
310     return (this->level()>0);
311   }
312 
313   /*! Location of this element relative to the reference element
314     of the father. This is sufficient to interpolate all
315     dofs in conforming case. Nonconforming may require access to
316     neighbors of father and computations with local coordinates.
317     On the fly case is somewhat inefficient since dofs  are visited
318     several times. If we store interpolation matrices, this is tolerable.
319     We assume that on-the-fly implementation of numerical algorithms
320     is only done for simple discretizations. Assumes that meshes are nested.
321   */
322   LocalGeometry geometryInFather () const;
323 
324   /*! Inter-level access to son elements on higher levels<=maxlevel.
325     This is provided for sparsely stored nested unstructured meshes.
326     Returns iterator to first son.
327   */
328   ALU3dGridHierarchicIterator<GridImp> hbegin (int maxlevel) const;
329 
330   //! Returns iterator to one past the last son
331   ALU3dGridHierarchicIterator<GridImp> hend (int maxlevel) const;
332 
333   //***************************************************************
334   //  Interface for Adaptation
335   //***************************************************************
336 
337   //! returns true, if entity was created during last adaptation cycle
338   bool isNew () const;
339 
340   //! returns true, if entity might be coarsened during next adaptation cycle
341   bool mightVanish () const;
342 
343   //! returns true, if entity has intersections with boundary
344   bool hasBoundaryIntersections () const;
345 
346   // private method
347   //! marks an element for refCount refines. if refCount is negative the
348   //! element is coarsend -refCount times
349   //! mark returns true if element was marked, otherwise false
350   bool mark( const int refCount, const bool conformingRefinement ) const;
351 
352   //! \brief return current adaptation mark for this entity
353   int getMark() const;
354 
355   /*! private methods, but public because of datahandle and template
356       arguments of these methods
357   */
358   void setElement(HElementType &element);
359 
360   /* set entity from seed */
361   void setElement(const EntitySeed& seed);
362 
363   //! set original element pointer to fake entity
364   void setGhost(HBndSegType & ghost);
365 
366   //! set actual walk level
367   void reset ( int l );
368 
369   //! set item pointer to NULL
370   void removeElement();
371 
372   //! compare 2 entities, which means compare the item pointers
373   bool equals ( const ALU3dGridEntity<0,dim,GridImp> & org ) const;
374 
375   void setEntity ( const ALU3dGridEntity<0,dim,GridImp> & org );
376 
377   //! return index of sub entity with codim = cc and local number i
378   //! i.e. return global number of vertex i
379   //! for use in hierarchical index set
380   template<int cc> int getSubIndex (int i) const;
381 
382   //! return index of sub entity with codim = cc and local number i
383   //! i.e. return global number of vertex i
384   //! for use in hierarchical index set
385   int subIndex(int i, unsigned int codim) const;
386 
387   // return reference to internal item
getItem() const388   const IMPLElementType& getItem () const { return *item_; }
389 
390   // return reference to internal item
getGhost() const391   const BNDFaceType& getGhost () const
392   {
393     alugrid_assert ( isGhost() );
394     return *ghost_;
395   }
396 
397   //! returns true if entity is ghost
isGhost() const398   bool isGhost () const{ return ImplTraits::isGhost( ghost_ ); }
399 
400   //! return key for this entity
seed() const401   EntitySeed seed() const
402   {
403     if( isGhost() )
404       return EntitySeed( getGhost () );
405     else
406       return EntitySeed( getItem() );
407   }
408 
409   //! return macro id of this entity
macroId() const410   int macroId() const
411   {
412     return (isGhost()) ? getGhost().ldbVertexIndex() : getItem().ldbVertexIndex();
413   }
414 
415   //! weight of entity (ie number of leaf elements underneath)
weight() const416   int weight() const
417   {
418     return (isGhost()) ? 0 : getItem().weight();
419   }
420 
421   //! return rank number of master process
master() const422   int master() const
423   {
424     return (isGhost()) ? getGhost().master() : getItem().master();
425   }
426 
427 protected:
428   //! index is unique within the grid hierachy and per codim
429   int getIndex () const;
430 
431   //! the entity's geometry
432   mutable GeometryImpl geo_;
433 
434   // the current element of grid
435   mutable IMPLElementType* item_;
436 
437   //! not zero if entity is ghost entity
438   mutable BNDFaceType*  ghost_;
439 
440 }; // end of ALU3dGridEntity codim = 0
441 
442 
443 
444 //**********************************************************************
445 //
446 // --ALU3dGridEntityPointer
447 // --EntityPointer
448 // --EnPointer
449 /*!
450  Enables iteration over all entities of a given codimension and level of a grid.
451  */
452 template< int codim, class GridImp >
453 class ALU3dGridEntityPointerBase
454 {
455   typedef ALU3dGridEntityPointerBase< codim, GridImp > ThisType;
456   enum { dim       = GridImp::dimension };
457   enum { dimworld  = GridImp::dimensionworld };
458 
459   typedef typename GridImp::MPICommunicatorType Comm;
460 
461   friend class ALU3dGridEntity<codim,dim,GridImp>;
462   friend class ALU3dGridEntity< 0,dim,GridImp>;
463   friend class ALU3dGrid < GridImp::dimension, GridImp::dimensionworld, GridImp::elementType, Comm >;
464 
465   typedef ALU3dImplTraits< GridImp::elementType, Comm > ImplTraits;
466   typedef typename ImplTraits::template Codim<dim, codim>::InterfaceType HElementType;
467 
468   typedef typename ImplTraits::HBndSegType  HBndSegType;
469   typedef typename ImplTraits::BNDFaceType BNDFaceType;
470 public:
471   enum { codimension = codim };
472 
473   //! type of Entity
474   typedef typename GridImp::template Codim<codimension>::Entity Entity;
475   typedef Entity  EntityObject;
476   typedef ALU3dGridEntity<codimension,dim, GridImp> EntityImp;
477 
478   //! typedef of my type
479   typedef ThisType ALU3dGridEntityPointerType;
480 
481   //! make type of entity pointer implementation available in derived classes
482   typedef ALU3dGridEntityPointer<codimension,GridImp> EntityPointerImp;
483 
484   //! type of entity seed
485   typedef ALU3dGridEntitySeed<codimension, GridImp> ALU3dGridEntitySeedType;
486 
487   //! Constructor for EntityPointer that points to an element
488   ALU3dGridEntityPointerBase(const HElementType & item);
489 
490   //! Constructor for EntityPointer that points to an ghost
491   ALU3dGridEntityPointerBase(const HBndSegType & ghostFace );
492 
493   //! Constructor for EntityPointer that points to an ghost
494   ALU3dGridEntityPointerBase(const ALU3dGridEntitySeedType& seed );
495 
496   //! copy constructor
497   ALU3dGridEntityPointerBase(const ALU3dGridEntityPointerType & org);
498 
499   //! equality
500   bool equals (const ALU3dGridEntityPointerType& i) const;
501 
502   //! assignment operator
503   ThisType & operator = (const ThisType & org);
504 
505   //! dereferencing
dereference() const506   Entity& dereference () const
507   {
508     // don't dereference empty entity pointer
509     alugrid_assert ( seed_.isValid() );
510     alugrid_assert ( seed_.item() == & entityImp().getItem() );
511     return entity_;
512   }
513 
514   //! ask for level of entities
level() const515   int level () const { return seed_.level(); }
516 
517   //! default empty constructor
518   ALU3dGridEntityPointerBase();
519 
520 protected:
521   // clones object
522   void clone (const ALU3dGridEntityPointerType & org);
523 
524   //! has to be called when iterator is finished
525   void done ();
526 
527   // update underlying item pointer and set ghost entity
528   void updateGhostPointer( HBndSegType & ghostFace );
529 
530   // update underlying item pointer and set entity
531   void updateEntityPointer( HElementType * item , int level = -1 );
532 
533   // key to gererate entity
534   ALU3dGridEntitySeedType seed_;
535 
536   // entity that this EntityPointer points to
537   mutable EntityObject entity_;
538 
539   // return reference to internal entity implementation
entityImp() const540   EntityImp & entityImp () const {
541     return entity_.impl();
542   }
543 };
544 
545 //! ALUGridEntityPointer points to an entity
546 //! this class is the specialisation for codim 0,
547 //! it has exactly the same functionality as the ALU3dGridEntityPointerBase
548 template<class GridImp>
549 class ALU3dGridEntityPointer<0,GridImp> :
550 public ALU3dGridEntityPointerBase<0,GridImp>
551 {
552 protected:
553   typedef ALU3dGridEntityPointerBase<0,GridImp> BaseType;
554 
555   enum { cd = 0 };
556   typedef ALU3dGridEntityPointer <cd,GridImp> ThisType;
557   enum { dim       = GridImp::dimension };
558   enum { dimworld  = GridImp::dimensionworld };
559 
560   typedef typename GridImp::MPICommunicatorType Comm;
561 
562   friend class ALU3dGridEntity<cd,dim,GridImp>;
563   friend class ALU3dGridEntity< 0,dim,GridImp>;
564   friend class ALU3dGrid < GridImp::dimension, GridImp::dimensionworld, GridImp::elementType, Comm >;
565 
566   typedef ALU3dImplTraits< GridImp::elementType, Comm > ImplTraits;
567   typedef typename ImplTraits::template Codim<dim, cd>::InterfaceType HElementType;
568 
569   typedef typename ImplTraits::HBndSegType HBndSegType;
570   typedef typename ImplTraits::BNDFaceType BNDFaceType;
571 
572   typedef ALU3dGridEntity< 0,dim,GridImp> ALU3dGridEntityType ;
573 
574   using BaseType :: seed_;
575   using BaseType :: entity_;
576   using BaseType :: entityImp;
577 public:
578   //! type of entity seed
579   typedef ALU3dGridEntitySeed<cd, GridImp> ALU3dGridEntitySeedType;
580 
581   //! type of Entity
582   typedef typename GridImp::template Codim<cd>::Entity Entity;
583 
584   //! typedef of my type
585   typedef ThisType ALU3dGridEntityPointerType;
586 
587   //! Constructor for EntityPointer that points to an interior element
ALU3dGridEntityPointer(const HElementType & item)588   ALU3dGridEntityPointer(const HElementType & item)
589     : ALU3dGridEntityPointerBase<cd,GridImp> ( item )
590   {}
591 
592   //! Constructor for EntityPointer that points to an ghost
ALU3dGridEntityPointer(const HBndSegType & ghostFace)593   ALU3dGridEntityPointer(const HBndSegType & ghostFace )
594     : ALU3dGridEntityPointerBase<cd,GridImp> ( ghostFace )
595   {}
596 
597   //! Constructor for EntityPointer that points to given entity
ALU3dGridEntityPointer(const ALU3dGridEntitySeedType & seed)598   ALU3dGridEntityPointer(const ALU3dGridEntitySeedType& seed)
599     : ALU3dGridEntityPointerBase<cd,GridImp> ( seed )
600   {
601   }
602 
603   //! Constructor for EntityPointer that points to an entity (interior or ghost)
ALU3dGridEntityPointer(const ALU3dGridEntityType & entity)604   ALU3dGridEntityPointer(const ALU3dGridEntityType& entity)
605     : ALU3dGridEntityPointerBase<cd,GridImp> ( entity.seed() )
606   {
607   }
608 
609   //! Constructor for EntityPointer init of Level-, and Leaf-, and
610   //! HierarchicIterator
ALU3dGridEntityPointer()611   ALU3dGridEntityPointer()
612     : ALU3dGridEntityPointerBase<cd,GridImp> ()
613   {}
614 };
615 
616 
617 template<int cd, class GridImp>
618 class ALU3dGridEntityPointer :
619 public ALU3dGridEntityPointerBase<cd,GridImp>
620 {
621 protected:
622   typedef ALU3dGridEntityPointerBase<cd,GridImp> BaseType ;
623   typedef ALU3dGridEntityPointer <cd,GridImp> ThisType;
624   enum { dim       = GridImp::dimension };
625   enum { dimworld  = GridImp::dimensionworld };
626 
627   typedef typename GridImp::MPICommunicatorType Comm;
628 
629   friend class ALU3dGridEntity<cd,dim,GridImp>;
630   friend class ALU3dGridEntity< 0,dim,GridImp>;
631   friend class ALU3dGrid < GridImp::dimension, GridImp::dimensionworld, GridImp::elementType, Comm >;
632 
633   typedef ALU3dImplTraits< GridImp::elementType, Comm > ImplTraits;
634   typedef typename ImplTraits::template Codim<dim, cd>::InterfaceType HElementType;
635 
636   typedef typename ImplTraits::HBndSegType HBndSegType;
637   typedef typename ImplTraits::BNDFaceType BNDFaceType;
638   typedef ALU3dGridEntity<cd,dim,GridImp> ALU3dGridEntityType;
639 
640   using BaseType :: seed_;
641   using BaseType :: entity_;
642   using BaseType :: entityImp;
643 
644 public:
645   //! type of entity seed
646   typedef ALU3dGridEntitySeed<cd, GridImp> ALU3dGridEntitySeedType;
647 
648   //! type of Entity
649   typedef typename GridImp::template Codim<cd>::Entity Entity;
650 
651   //! typedef of my type
652   typedef ALU3dGridEntityPointer<cd,GridImp> ALU3dGridEntityPointerType;
653 
654 protected:
655   static const int defaultValue = -665; //ALU3dGridEntityPointerType :: defaultValue;
656 
657 public:
658   //! Constructor for EntityPointer that points to given entity
ALU3dGridEntityPointer(const ALU3dGridEntityType & entity)659   ALU3dGridEntityPointer(const ALU3dGridEntityType& entity)
660     : ALU3dGridEntityPointerBase<cd,GridImp> ( entity.seed() )
661   {}
662 
663   //! Constructor for EntityPointer that points to given entity
ALU3dGridEntityPointer(const ALU3dGridEntitySeedType & seed)664   ALU3dGridEntityPointer(const ALU3dGridEntitySeedType& seed)
665     : ALU3dGridEntityPointerBase<cd,GridImp> ( seed )
666   {}
667 
668   //! Constructor for EntityPointer init of Level-, and Leaf-, and
669   //! HierarchicIterator
ALU3dGridEntityPointer()670   ALU3dGridEntityPointer()
671     : ALU3dGridEntityPointerBase<cd,GridImp> ()
672   {}
673 
674 protected:
675   void updateEntityPointer( HElementType * item , int level );
676 };
677 
678 } // end namespace Dune
679 
680 #include "entity_inline.hh"
681 
682 #if COMPILE_ALUGRID_INLINE
683   #include "entity_imp.cc"
684 #endif
685 #endif
686