3#ifndef ALU2DGRID_ENTITYKEY_HH
4#define ALU2DGRID_ENTITYKEY_HH
9 template<
int cd,
class Gr
idImp>
10 class ALU2dGridEntitySeed ;
17 template<
int codim,
class Gr
idImp >
18 class ALU2dGridEntitySeedBase
21 typedef ALU2dGridEntitySeedBase< codim, GridImp > ThisType;
22 enum { dim = GridImp::dimension };
23 enum { dimworld = GridImp::dimensionworld };
26 friend class ALU2dGridEntity<codim,dim,GridImp>;
27 friend class ALU2dGridEntity< 0,dim,GridImp>;
28 friend class ALU2dGrid <GridImp :: dimension, GridImp::dimensionworld, GridImp::elementType >;
30 typedef ALU2dImplTraits< GridImp::dimensionworld, GridImp::elementType > ImplTraits;
31 typedef typename ImplTraits::template Codim<codim>
::InterfaceType ImplementationType;
32 typedef ImplementationType HElementType;
33 typedef ImplementationType KeyType;
36 static const int defaultValue = -1 ;
38 enum { codimension = codim };
41 typedef typename GridImp::template Codim<codimension>::Entity Entity;
43 typedef MakeableInterfaceObject<Entity> EntityObject;
44 typedef typename EntityObject :: ImplementationType EntityImp;
47 typedef ThisType ALU2dGridEntitySeedType;
50 typedef ALU2dGridEntitySeed<codimension,GridImp> EntitySeedImp;
53 ~ALU2dGridEntitySeedBase()
62 ALU2dGridEntitySeedBase();
65 ALU2dGridEntitySeedBase(
const HElementType& item);
73 ALU2dGridEntitySeedBase(
const ALU2dGridEntitySeedType & org);
76 bool operator == (
const ALU2dGridEntitySeedType& i)
const
82 bool operator != (
const ALU2dGridEntitySeedType& i)
const
88 ThisType & operator = (
const ThisType & org);
102 bool equals (
const ALU2dGridEntitySeedType& i)
const;
111 HElementType* item()
const {
return item_; }
113 KeyType* toKey(
const HElementType* item)
115 return static_cast< KeyType*
> (
const_cast< ImplementationType*
> (
static_cast<const ImplementationType*
> (item)));
118 void set(
const HElementType& item,
const int level = -1 ,
const int face = -1 )
120 item_ = toKey( &item );
123 int level ()
const {
return ( item_ ) ? item_->level() : defaultValue; }
124 int face ()
const {
return defaultValue; }
128 mutable KeyType* item_;
131 template<
int cd,
class Gr
idImp>
132 class ALU2dGridEntitySeed :
133 public ALU2dGridEntitySeedBase<cd,GridImp>
135 typedef ALU2dGridEntitySeedBase<cd,GridImp> BaseType;
137 typedef ALU2dGridEntitySeed <cd,GridImp> ThisType;
138 enum { dim = GridImp::dimension };
139 enum { dimworld = GridImp::dimensionworld };
141 friend class ALU2dGridEntity<cd,dim,GridImp>;
142 friend class ALU2dGridEntity< 0,dim,GridImp>;
143 friend class ALU2dGrid <GridImp :: dimension, GridImp::dimensionworld, GridImp::elementType >;
145 typedef ALU2dImplTraits< GridImp::dimensionworld, GridImp::elementType > ImplTraits;
146 typedef typename ImplTraits::template Codim<cd>
::InterfaceType ImplementationType;
147 typedef ImplementationType HElementType;
149 typedef ALU2dGridEntity<cd,dim,GridImp> ALU2dGridEntityType;
152 using BaseType :: defaultValue ;
155 typedef typename GridImp::template Codim<cd>::Entity Entity;
158 typedef ALU2dGridEntitySeed<cd,GridImp> ALU2dGridEntitySeedType;
161 ALU2dGridEntitySeed(const ImplementationType & item)
169 ALU2dGridEntitySeed(
const HElementType & item,
171 const int duneFace = defaultValue
175 ALU2dGridEntitySeed()
176 : BaseType(), level_(defaultValue), face_(defaultValue) {}
179 ALU2dGridEntitySeed(
const ALU2dGridEntityType& entity)
180 : ALU2dGridEntitySeedBase<cd,GridImp> (entity.getItem()),
181 level_(entity.level()), face_(defaultValue)
185 ALU2dGridEntitySeed(
const ALU2dGridEntitySeedType & org);
188 ThisType & operator = (
const ThisType & org);
194 void set(
const HElementType & item,
const int level,
const int duneFace )
196 BaseType :: set( item );
202 int level ()
const {
return level_ ; }
204 int face ()
const {
return face_ ; }
206 using BaseType :: set ;
208 bool operator == (
const ALU2dGridEntitySeedType& i)
const
213 bool operator != (
const ALU2dGridEntitySeedType& i)
const
215 return ! equals( i );
219 bool equals (
const ALU2dGridEntitySeedType& key)
const
222 return BaseType :: equals( key ) && (level() == key.level());
235 template<
class Gr
idImp>
236 class ALU2dGridEntitySeed<0,GridImp> :
237 public ALU2dGridEntitySeedBase<0,GridImp>
240 typedef ALU2dGridEntitySeedBase<0,GridImp> BaseType;
243 typedef ALU2dGridEntitySeed <cd,GridImp> ThisType;
244 enum { dim = GridImp::dimension };
245 enum { dimworld = GridImp::dimensionworld };
249 friend class ALU2dGrid <GridImp :: dimension, GridImp::dimensionworld, GridImp::elementType >;
251 typedef ALU2dImplTraits< GridImp::dimensionworld, GridImp::elementType > ImplTraits;
253 typedef ImplementationType HElementType;
258 using BaseType :: defaultValue ;
261 typedef typename GridImp::template
Codim<cd>::Entity Entity;
264 typedef ThisType ALU2dGridEntitySeedType;
267 ALU2dGridEntitySeed() : BaseType() {}
271 : ALU2dGridEntitySeedBase<cd,GridImp> (item) {}
275 : ALU2dGridEntitySeedBase<cd,GridImp> (item) {}
279 : ALU2dGridEntitySeedBase<cd,GridImp> (org)
285 template <
int cd,
class Gr
idImp>
287 const ALU2dGridEntitySeed<cd,GridImp>& key)
289 out << key.item() <<
" " << key.level() <<
" " << key.face();
299 template<
int codim,
class Gr
idImp >
300 inline ALU2dGridEntitySeedBase<codim,GridImp> ::
301 ALU2dGridEntitySeedBase()
305 template<
int codim,
class Gr
idImp >
306 inline ALU2dGridEntitySeedBase<codim,GridImp> ::
307 ALU2dGridEntitySeedBase(
const HElementType &item)
308 : item_( toKey(&item) )
311 template<
int codim,
class Gr
idImp >
312 inline ALU2dGridEntitySeedBase<codim,GridImp> ::
313 ALU2dGridEntitySeedBase(
const ALU2dGridEntitySeedType & org)
317 template<
int codim,
class Gr
idImp >
318 inline ALU2dGridEntitySeedBase<codim,GridImp> &
319 ALU2dGridEntitySeedBase<codim,GridImp> ::
320 operator = (
const ALU2dGridEntitySeedType & org)
326 template<
int codim,
class Gr
idImp >
327 inline bool ALU2dGridEntitySeedBase<codim,GridImp>::
328 equals (
const ALU2dGridEntitySeedBase<codim,GridImp>& i)
const
331 return (item_ == i.item_);
340 template<
int codim,
class Gr
idImp >
341 inline ALU2dGridEntitySeed<codim,GridImp> ::
342 ALU2dGridEntitySeed(
const HElementType &item,
345 : ALU2dGridEntitySeedBase<codim,GridImp> (item)
349 assert( (codim == 1) ? (face_ >= 0) : 1 );
352 template<
int codim,
class Gr
idImp >
353 inline ALU2dGridEntitySeed<codim,GridImp> ::
354 ALU2dGridEntitySeed(
const ALU2dGridEntitySeedType & org)
355 : ALU2dGridEntitySeedBase<codim,GridImp>(org)
360 template<
int codim,
class Gr
idImp >
361 inline ALU2dGridEntitySeed<codim,GridImp> &
362 ALU2dGridEntitySeed<codim,GridImp>::
363 operator = (
const ALU2dGridEntitySeedType & org)
366 BaseType :: operator = ( org );
374 template<
int codim,
class Gr
idImp >
376 ALU2dGridEntitySeed<codim,GridImp>::clear ()
379 level_ = defaultValue ;
380 face_ = defaultValue ;
ALU2dGridEntitySeed(const HElementType &item)
Constructor for EntitySeed that points to an interior element.
Definition: entityseed.hh:270
ALU2dGridEntitySeed(const ALU2dGridEntitySeedType &org)
copy constructor
Definition: entityseed.hh:278
ALU2dGridEntitySeed(const HElementType &item, int, int)
Constructor for EntitySeed that points to an interior element.
Definition: entityseed.hh:274
Definition: entity.hh:212
[ provides Dune::Grid ]
Definition: grid.hh:212
std::ostream & operator<<(std::ostream &s, const array< T, N > &e)
Output operator for array.
Definition: array.hh:26
EnableIfInterOperable< T1, T2, bool >::type operator==(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for equality.
Definition: iteratorfacades.hh:230
EnableIfInterOperable< T1, T2, bool >::type operator!=(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for inequality.
Definition: iteratorfacades.hh:252
Dune namespace.
Definition: alignment.hh:10
Static tag representing a codimension.
Definition: dimension.hh:22