- Home
- About DUNE
- Download
- Documentation
- Community
- Development
00001 #ifndef DUNE_ALBERTA_ENTITY_HH 00002 #define DUNE_ALBERTA_ENTITY_HH 00003 00004 #include <dune/grid/common/entity.hh> 00005 00006 #include <dune/grid/albertagrid/elementinfo.hh> 00007 #include <dune/grid/albertagrid/entityseed.hh> 00008 #include <dune/grid/albertagrid/geometry.hh> 00009 00010 #if HAVE_ALBERTA 00011 00012 namespace Dune 00013 { 00014 00015 // Forward Declarations 00016 // -------------------- 00017 00018 template< int codim, class GridImp > 00019 class AlbertaGridEntityPointer; 00020 00021 template< int codim, class GridImp, bool leafIterator > 00022 class AlbertaGridTreeIterator; 00023 00024 template< class GridImp > 00025 class AlbertaGridHierarchicIterator; 00026 00027 template< class GridImp > 00028 class AlbertaGridLeafIntersection; 00029 00030 template< class GridImp > 00031 class AlbertaGridLeafIntersectionIterator; 00032 00033 00034 00035 // AlbertaGridEntity 00036 // ----------------- 00037 00044 template< int codim, int dim, class GridImp > 00045 class AlbertaGridEntity 00046 : public EntityDefaultImplementation< codim, dim, GridImp, AlbertaGridEntity > 00047 { 00048 typedef AlbertaGridEntity< codim, dim, GridImp > This; 00049 00050 enum { dimworld = GridImp::dimensionworld }; 00051 friend class AlbertaGrid< dim , dimworld >; 00052 friend class AlbertaGridEntity< 0, dim, GridImp>; 00053 00054 template< int, class, bool > friend class AlbertaGridTreeIterator; 00055 friend class AlbertaGridEntityPointer< codim, GridImp >; 00056 00057 public: 00058 static const int dimension = dim; 00059 static const int codimension = codim; 00060 static const int mydimension = dimension - codimension; 00061 00062 template< int cd > 00063 struct Codim 00064 { 00065 typedef typename GridImp::template Codim< cd >::EntityPointer EntityPointer; 00066 }; 00067 00068 typedef typename GridImp::template Codim< codim >::Entity Entity; 00069 typedef typename GridImp::template Codim< codim >::EntitySeed EntitySeed; 00070 typedef typename GridImp::template Codim< codim >::Geometry Geometry; 00071 typedef typename GridImp::template Codim< codim >::LevelIterator LevelIterator; 00072 00073 typedef Alberta::ElementInfo< dimension > ElementInfo; 00074 00075 private: 00076 typedef MakeableInterfaceObject< Geometry > GeometryObject; 00077 typedef typename GeometryObject::ImplementationType GeometryImp; 00078 00079 public: 00081 explicit AlbertaGridEntity ( const GridImp &grid ); 00082 00084 AlbertaGridEntity ( const GridImp &grid, const ElementInfo &elementInfo, int subEntity ); 00085 00087 int level () const; 00088 00090 PartitionType partitionType() const; 00091 00093 const Geometry & geometry () const; 00094 00096 GeometryType type () const; 00097 00099 EntitySeed seed () const 00100 { 00101 return EntitySeed( elementInfo(), subEntity() ); 00102 } 00103 00104 //*********************************************** 00105 // End of Interface methods 00106 //*********************************************** 00108 ALBERTA EL_INFO *getElInfo () const; 00109 00110 const ElementInfo &elementInfo () const 00111 { 00112 return elementInfo_; 00113 } 00114 00116 bool equals ( const This &other ) const; 00117 00118 void clearElement (); 00119 void setElement ( const ElementInfo &elementInfo, int subEntity ); 00120 00121 // same as setElInfo just with a entity given 00122 void setEntity ( const This &other ); 00123 00125 const GridImp &grid () const 00126 { 00127 return *grid_; 00128 } 00129 00131 int subEntity () const 00132 { 00133 return subEntity_; 00134 } 00135 00137 int twist () const 00138 { 00139 return elementInfo().template twist< codimension >( subEntity() ); 00140 } 00141 00142 private: 00143 const GeometryImp &geoImp () const 00144 { 00145 return GridImp :: getRealImplementation( geo_ ); 00146 } 00147 00148 GeometryImp &geoImp () 00149 { 00150 return GridImp :: getRealImplementation( geo_ ); 00151 } 00152 00153 private: 00154 // grid this entity belong to 00155 const GridImp *grid_; 00156 00157 // ALBERTA element info 00158 ElementInfo elementInfo_; 00159 00160 // number of the subentity within the element (in ALBERTA numbering) 00161 int subEntity_; 00162 00163 // current geometry 00164 GeometryObject geo_; 00165 }; 00166 00167 00168 00182 template< int dim, class GridImp > 00183 class AlbertaGridEntity< 0, dim, GridImp > 00184 : public EntityDefaultImplementation< 0, dim, GridImp, AlbertaGridEntity > 00185 { 00186 typedef AlbertaGridEntity< 0, dim, GridImp > This; 00187 00188 static const int dimworld = GridImp::dimensionworld; 00189 00190 friend class AlbertaGrid< dim, dimworld >; 00191 friend class AlbertaGridLeafIntersection< GridImp >; 00192 friend class AlbertaGridHierarchicIterator< GridImp >; 00193 template< int, class, bool > friend class AlbertaGridTreeIterator; 00194 friend class AlbertaGridEntityPointer<0,GridImp>; 00195 00196 public: 00197 static const int dimension = dim; 00198 static const int codimension = 0; 00199 static const int mydimension = dimension - codimension; 00200 00201 template< int codim > 00202 struct Codim 00203 { 00204 typedef typename GridImp::template Codim< codim >::EntityPointer 00205 EntityPointer; 00206 }; 00207 00208 typedef typename GridImp::template Codim< 0 >::Entity Entity; 00209 typedef typename GridImp::template Codim< 0 >::EntitySeed EntitySeed; 00210 typedef typename GridImp::template Codim< 0 >::Geometry Geometry; 00211 typedef typename GridImp::template Codim< 0 >::LocalGeometry LocalGeometry; 00212 typedef AlbertaGridGlobalGeometry< dimension, dimworld, GridImp > GeometryImp; 00213 00214 typedef typename GridImp::template Codim<0>::LevelIterator LevelIterator; 00215 typedef typename GridImp::HierarchicIterator HierarchicIterator; 00216 typedef typename GridImp::template Codim<0>::EntityPointer EntityPointer; 00217 00218 typedef Dune::AlbertaGridLeafIntersectionIterator< GridImp > AlbertaGridLeafIntersectionIterator; 00219 typedef AlbertaGridLeafIntersectionIterator AlbertaGridLevelIntersectionIterator; 00220 00221 typedef Alberta::ElementInfo< dimension > ElementInfo; 00222 00224 explicit AlbertaGridEntity ( const GridImp &grid ); 00225 00227 AlbertaGridEntity ( const GridImp &grid, const ElementInfo &elementInfo, int subEntity ); 00228 00230 int level () const; 00231 00233 int boundaryId () const; 00234 00236 const Geometry & geometry () const; 00237 00239 GeometryType type () const; 00240 00242 EntitySeed seed () const 00243 { 00244 return EntitySeed( elementInfo() ); 00245 } 00246 00253 template< int codim > 00254 int count () const 00255 { 00256 return Alberta::NumSubEntities< dimension, codim >::value; 00257 } 00258 00269 template< int codim > 00270 typename Codim< codim >::EntityPointer subEntity ( int i ) const; 00271 00277 AlbertaGridLeafIntersectionIterator ileafbegin () const; 00278 00280 AlbertaGridLeafIntersectionIterator ileafend () const; 00281 00282 AlbertaGridLevelIntersectionIterator ilevelbegin () const 00283 { 00284 DUNE_THROW( NotImplemented, "method ilevelbegin not implemented for AlbertaGrid." ); 00285 return ileafend(); 00286 } 00287 00288 AlbertaGridLevelIntersectionIterator ilevelend () const 00289 { 00290 DUNE_THROW( NotImplemented, "method ilevelend not implemented for AlbertaGrid." ); 00291 return ileafend(); 00292 } 00293 00295 bool isLeaf () const; 00296 00299 EntityPointer father () const; 00301 bool hasFather () const 00302 { 00303 return (this->level()>0); 00304 } 00305 00314 const LocalGeometry &geometryInFather () const; 00315 00320 HierarchicIterator hbegin (int maxlevel) const; 00321 00323 HierarchicIterator hend (int maxlevel) const; 00324 00326 bool isNew () const; 00327 00329 bool mightVanish () const; 00330 00333 bool hasBoundaryIntersections () const ; 00334 00336 PartitionType partitionType() const; 00337 00339 bool equals ( const AlbertaGridEntity<0,dim,GridImp> & i) const; 00340 00341 // needed for LevelIterator to compare 00342 ALBERTA EL_INFO *getElInfo () const; 00343 00344 const ElementInfo &elementInfo () const 00345 { 00346 return elementInfo_; 00347 } 00348 00349 void clearElement (); 00350 void setElement ( const ElementInfo &elementInfo, int subEntity ); 00351 00352 // same as setElInfo just with a entity given 00353 void setEntity ( const This &other ); 00354 00356 const GridImp &grid () const 00357 { 00358 return *grid_; 00359 } 00360 00362 int subEntity () const 00363 { 00364 return 0; 00365 } 00366 00368 int twist () const 00369 { 00370 return elementInfo().template twist< codimension >( subEntity() ); 00371 } 00372 00374 template< int codim > 00375 int twist ( int i ) const 00376 { 00377 return elementInfo().template twist< codim >( grid().generic2alberta( codim, i ) ); 00378 } 00379 00380 private: 00382 int nChild () const; 00383 00384 GeometryImp &geoImp () const 00385 { 00386 return GridImp::getRealImplementation( geo_ ); 00387 } 00388 00390 const GridImp *grid_; 00391 00392 // Alberta element info 00393 ElementInfo elementInfo_; 00394 00395 // local coordinates within father 00396 typedef MakeableInterfaceObject< Geometry > GeometryObject; 00397 00399 mutable GeometryObject geo_; 00400 mutable bool builtgeometry_; 00401 }; // end of AlbertaGridEntity codim = 0 00402 00403 } 00404 00405 #endif // #if HAVE_ALBERTA 00406 00407 #endif // #ifndef DUNE_ALBERTA_ENTITY_HH
Generated on Fri Apr 29 2011 with Doxygen (ver 1.7.1) [doxygen-log,error-log].