00001 #ifndef DUNE_ALU3DGRIDGRID_HH
00002 #define DUNE_ALU3DGRIDGRID_HH
00003
00004
00005 #include <vector>
00006
00007
00008 #include <dune/grid/utility/grapedataioformattypes.hh>
00009 #include <dune/grid/common/capabilities.hh>
00010 #include <dune/common/interfaces.hh>
00011 #include <dune/common/bigunsignedint.hh>
00012
00013 #include <dune/grid/common/grid.hh>
00014 #include <dune/grid/common/referenceelements.hh>
00015 #include <dune/grid/common/defaultindexsets.hh>
00016 #include <dune/grid/common/sizecache.hh>
00017 #include <dune/grid/common/intersectioniteratorwrapper.hh>
00018 #include <dune/grid/common/datahandleif.hh>
00019
00020
00021 #include "alu3dinclude.hh"
00022 #include "topology.hh"
00023 #include "indexsets.hh"
00024 #include "memory.hh"
00025 #include "datahandle.hh"
00026 #include "alu3dutility.hh"
00027
00028 #if ALU3DGRID_PARALLEL
00029 #include <dune/common/mpicollectivecommunication.hh>
00030 #else
00031 #include <dune/common/collectivecommunication.hh>
00032 #endif
00033
00034 namespace Dune {
00035
00036
00037 template<int cd, int dim, class GridImp>
00038 class ALU3dGridEntity;
00039 template<int cd, PartitionIteratorType pitype, class GridImp >
00040 class ALU3dGridLevelIterator;
00041 template<int cd, class GridImp >
00042 class ALU3dGridEntityPointerBase;
00043 template<int cd, class GridImp >
00044 class ALU3dGridEntityPointer;
00045 template<int mydim, int coorddim, class GridImp>
00046 class ALU3dGridGeometry;
00047 template<class GridImp>
00048 class ALU3dGridHierarchicIterator;
00049 template<class GridImp>
00050 class ALU3dGridIntersectionIterator;
00051 template<class GridImp>
00052 class ALU3dGridLevelIntersectionIterator;
00053 template<int codim, PartitionIteratorType pitype, class GridImp>
00054 class ALU3dGridLeafIterator;
00055 template <int mydim, int coorddim, class GridImp>
00056 class ALU3dGridMakeableEntity;
00057 template <class GridImp>
00058 class ALU3dGridFaceGeometryInfo;
00059 template<int dim, int dimworld, ALU3dGridElementType elType>
00060 class ALU3dGridGlobalIdSet;
00061 template<int dim, int dimworld, ALU3dGridElementType elType>
00062 class ALU3dGridLocalIdSet;
00063 template<int dim, int dimworld, ALU3dGridElementType elType>
00064 class ALU3dGridHierarchicIndexSet;
00065 template <class EntityImp>
00066 class ALUMemoryProvider;
00067 template<int dim, int dimworld, ALU3dGridElementType elType>
00068 class ALU3dGrid;
00069 template <class GridImp, int codim>
00070 struct ALU3dGridEntityFactory;
00071
00072
00073
00074
00075
00076
00077
00078 template <int dim, int dimworld, ALU3dGridElementType elType>
00079 struct ALU3dGridFamily
00080 {
00082 typedef ALU3dGridLocalIdSet<dim,dimworld,elType> LocalIdSetImp;
00083
00084 #if ALU3DGRID_PARALLEL
00086 typedef ALU3dGridGlobalIdSet<dim,dimworld,elType> GlobalIdSetImp;
00087 #else
00088 typedef ALU3dGridGlobalIdSet<dim,dimworld,elType> GlobalIdSetImp;
00089
00090 #endif
00091
00093 typedef DefaultLevelIndexSet<ALU3dGrid < dim, dimworld, elType > > LevelIndexSetImp;
00095 typedef DefaultLeafIndexSet<ALU3dGrid < dim, dimworld, elType > > LeafIndexSetImp;
00096
00098 typedef ALUGridId<ALUMacroKey> GlobalIdType;
00099
00101 typedef int LocalIdType;
00102
00103 typedef ALU3dGrid<dim,dimworld,elType> GridImp;
00104
00105 struct Traits
00106 {
00108 typedef int LocalIdType;
00109
00111 typedef ALUGridId<ALUMacroKey> GlobalIdType;
00112
00113 typedef ALU3dGrid<dim,dimworld,elType> Grid;
00114
00115 typedef Dune::IntersectionIterator<const GridImp, LeafIntersectionIteratorWrapper> IntersectionIterator;
00116
00117 typedef Dune::IntersectionIterator<const GridImp, LeafIntersectionIteratorWrapper > LeafIntersectionIterator;
00118 typedef Dune::IntersectionIterator<const GridImp, LevelIntersectionIteratorWrapper> LevelIntersectionIterator;
00119
00120 typedef Dune::HierarchicIterator<const GridImp, ALU3dGridHierarchicIterator> HierarchicIterator;
00121
00122 template <int cd>
00123 struct Codim
00124 {
00125
00126 typedef Dune::Geometry<dim-cd, dimworld, const GridImp, ALU3dGridGeometry> Geometry;
00127 typedef Dune::Geometry<dim-cd, dim, const GridImp, ALU3dGridGeometry> LocalGeometry;
00128
00129 typedef Dune::Entity<cd, dim, const GridImp, ALU3dGridEntity> Entity;
00130
00131 typedef Dune::LevelIterator<cd,All_Partition,const GridImp,ALU3dGridLevelIterator> LevelIterator;
00132
00133 typedef Dune::LeafIterator<cd,All_Partition,const GridImp,ALU3dGridLeafIterator> LeafIterator;
00134
00135 typedef Dune::EntityPointer<const GridImp,ALU3dGridEntityPointer<cd,const GridImp> > EntityPointer;
00136
00137 template <PartitionIteratorType pitype>
00138 struct Partition
00139 {
00140 typedef Dune::LevelIterator<cd,pitype,const GridImp,ALU3dGridLevelIterator> LevelIterator;
00141 typedef Dune::LeafIterator<cd,pitype,const GridImp,ALU3dGridLeafIterator> LeafIterator;
00142 };
00143
00144 };
00145
00146 typedef IndexSet<GridImp,LevelIndexSetImp,DefaultLevelIteratorTypes<GridImp> > LevelIndexSet;
00147 typedef IndexSet<GridImp,LeafIndexSetImp,DefaultLeafIteratorTypes<GridImp> > LeafIndexSet;
00148 typedef IdSet<GridImp,LocalIdSetImp,LocalIdType> LocalIdSet;
00149
00150 #if ALU3DGRID_PARALLEL
00151 typedef IdSet<GridImp,GlobalIdSetImp,GlobalIdType> GlobalIdSet;
00152 typedef CollectiveCommunication<MPI_Comm> CollectiveCommunication;
00153 #else
00154
00155
00156 typedef LocalIdSet GlobalIdSet;
00157 typedef CollectiveCommunication<Grid> CollectiveCommunication;
00158 #endif
00159 };
00160 };
00161
00181 template <int dim, int dimworld, ALU3dGridElementType elType>
00182 class ALU3dGrid :
00183 public GridDefaultImplementation<dim, dimworld, alu3d_ctype, ALU3dGridFamily <dim,dimworld,elType> >,
00184 public HasObjectStream,
00185 public HasHierarchicIndexSet
00186 {
00187
00188 typedef GridDefaultImplementation<dim, dimworld, alu3d_ctype, ALU3dGridFamily <dim,dimworld,elType> > BaseType;
00189
00190 CompileTimeChecker<(dim == 3)> ALU3dGrid_only_implemented_for_3dp;
00191 CompileTimeChecker<(dimworld == 3)> ALU3dGrid_only_implemented_for_3dw;
00192
00193 typedef ALU3dGrid<dim,dimworld,elType> MyType;
00194 typedef ALU3dGrid<dim,dimworld,elType> ThisType;
00195
00196 friend class ALU3dGridEntity <0,dim,MyType>;
00197 friend class ALU3dGridEntity <0,dim,const MyType>;
00198 friend class ALU3dGridEntity <1,dim,const MyType>;
00199 friend class ALU3dGridEntity <2,dim,const MyType>;
00200 friend class ALU3dGridEntity <3,dim,const MyType>;
00201 friend class ALU3dGridIntersectionIterator<MyType>;
00202
00203 friend class ALU3dGridEntityPointerBase<0,const MyType >;
00204 friend class ALU3dGridEntityPointerBase<1,const MyType >;
00205 friend class ALU3dGridEntityPointer<1,const MyType >;
00206 friend class ALU3dGridEntityPointerBase<2,const MyType >;
00207 friend class ALU3dGridEntityPointer<2,const MyType >;
00208 friend class ALU3dGridEntityPointerBase<3,const MyType >;
00209 friend class ALU3dGridEntityPointer<3,const MyType >;
00210
00211 friend class ALU3dGridIntersectionIterator<const MyType>;
00212 friend class ALU3dGridHierarchicIterator<const MyType>;
00213
00214 friend class ALU3dGridHierarchicIndexSet<dim,dimworld,elType>;
00215 friend class ALU3dGridGlobalIdSet<dim,dimworld,elType>;
00216 friend class ALU3dGridLocalIdSet<dim,dimworld,elType>;
00217
00218
00219
00220
00221 public:
00222 enum { refineStepsForHalf = 1 };
00223
00224 static const ALU3dGridElementType elementType = elType;
00225 typedef typename ALU3DSPACE GatherScatterType::ObjectStreamType ObjectStreamType;
00226
00227 typedef ALU3dGridFamily<dim,dimworld,elType> GridFamily;
00228
00229 friend class Conversion< ALU3dGrid<dim,dimworld,elementType> , HasObjectStream > ;
00230 friend class Conversion< const ALU3dGrid<dim,dimworld,elementType> , HasObjectStream > ;
00231
00232 friend class Conversion< ALU3dGrid<dim,dimworld,elementType> , HasHierarchicIndexSet > ;
00233 friend class Conversion< const ALU3dGrid<dim,dimworld,elementType> , HasHierarchicIndexSet > ;
00234
00236 typedef typename ALU3dGridFamily < dim , dimworld , elType > :: Traits Traits;
00237
00238 protected:
00239 typedef MakeableInterfaceObject<typename Traits::template Codim<0>::Geometry> GeometryObject;
00240 friend class LocalGeometryStorage< GeometryObject , 8 >;
00241
00242 public:
00243
00245 typedef ALU3dGridHierarchicIndexSet<dim,dimworld,elType> HierarchicIndexSet;
00246
00247
00249 typedef typename GridFamily :: LevelIndexSetImp LevelIndexSetImp;
00251 typedef typename GridFamily :: LeafIndexSetImp LeafIndexSetImp;
00252
00254 typedef typename SelectType<elType == tetra,
00255 ReferenceSimplex<alu3d_ctype, dim>,
00256 ReferenceCube <alu3d_ctype, dim> >::Type ReferenceElementType;
00257
00258 protected:
00260 typedef typename ALU3dGridFamily < dim , dimworld , elType > :: LocalIdSetImp LocalIdSetImp;
00261
00263 typedef typename ALU3dGridFamily < dim , dimworld , elType > :: GlobalIdSetImp GlobalIdSetImp;
00264
00266 typedef typename Traits :: GlobalIdSet GlobalIdSet;
00267
00269 typedef typename Traits :: LocalIdSet LocalIdSet;
00270
00272 typedef ALU3dGridLeafIterator<0, All_Partition, MyType> LeafIteratorImp;
00273 typedef typename Traits::template Codim<0>::LeafIterator LeafIteratorType;
00274 typedef typename Traits::template Codim<0>::LeafIterator LeafIterator;
00275
00276 typedef ALU3dGridHierarchicIterator<MyType> HierarchicIteratorImp;
00277
00278 typedef typename Traits :: CollectiveCommunication
00279 CollectiveCommunicationType;
00280
00282 enum {
00284 MAXL = 64 };
00285
00287 enum {
00289 newElementsChunk_ = 128 };
00290
00292 enum {
00296 refineEstimate_ = 8 };
00297
00298 protected:
00301 #if ALU3DGRID_PARALLEL
00302 ALU3dGrid(const std::string macroTriangFilename , MPI_Comm mpiComm = MPI_COMM_WORLD );
00303 #else
00304 ALU3dGrid(const std::string macroTriangFilename , int myrank = -1);
00305 #endif
00306 public:
00307
00309 ~ALU3dGrid();
00310
00312 std::string name () const;
00313
00317 int maxLevel() const;
00318
00320 template<int cd, PartitionIteratorType pitype>
00321 typename Traits::template Codim<cd>::template Partition<pitype>::LevelIterator
00322 lbegin (int level) const;
00323
00325 template<int cd, PartitionIteratorType pitype>
00326 typename Traits::template Codim<cd>::template Partition<pitype>::LevelIterator
00327 lend (int level) const;
00328
00330 template<int cd>
00331 typename Traits::template Codim<cd>::
00332 template Partition<All_Partition>::LevelIterator
00333 lbegin (int level) const;
00334
00336 template<int cd>
00337 typename Traits::template Codim<cd>::
00338 template Partition<All_Partition>::LevelIterator
00339 lend (int level) const;
00340
00341 private:
00343 template <int codim, PartitionIteratorType pitype>
00344 typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
00345 leafbegin(int level) const;
00346
00348 template <int codim, PartitionIteratorType pitype>
00349 typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
00350 leafend(int level) const;
00351
00353 template <int codim>
00354 typename Traits::template Codim<codim>::LeafIterator
00355 leafbegin(int level) const;
00356
00358 template <int codim>
00359 typename Traits::template Codim<codim>::LeafIterator
00360 leafend(int level) const;
00361
00363 LeafIteratorType leafbegin (int level) const;
00364
00366 LeafIteratorType leafend (int level) const;
00367
00369 LeafIteratorType leafbegin () const;
00370
00372 LeafIteratorType leafend () const;
00373
00374 public:
00376 template <int codim, PartitionIteratorType pitype>
00377 typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
00378 leafbegin() const;
00379
00381 template <int codim, PartitionIteratorType pitype>
00382 typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
00383 leafend() const;
00384
00386 template <int codim>
00387 typename Traits::template Codim<codim>::LeafIterator
00388 leafbegin() const;
00389
00391 template <int codim>
00392 typename Traits::template Codim<codim>::LeafIterator
00393 leafend() const;
00394
00395 private:
00397 template <int codim, PartitionIteratorType pitype>
00398 typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
00399 createLeafIteratorBegin (int level) const;
00400
00402 template <int codim, PartitionIteratorType pitype>
00403 typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
00404 createLeafIteratorEnd(int level) const;
00405
00406 public:
00408 int size (int level, int cd) const;
00409
00411 int size (int codim) const;
00412
00414 int size (int level, GeometryType type) const;
00415
00417 int size (GeometryType type) const;
00418
00420 int global_size (int cd) const ;
00421
00422
00423 int hierSetSize (int cd) const;
00424
00426 const GlobalIdSet & globalIdSet () const {
00427 #if ALU3DGRID_PARALLEL
00428 if(!globalIdSet_) globalIdSet_ = new GlobalIdSetImp(*this);
00429 return *globalIdSet_;
00430 #else
00431
00432 return localIdSet();
00433 #endif
00434 }
00435
00437 const LocalIdSet & localIdSet () const { return localIdSet_; }
00438
00440 const typename Traits :: LeafIndexSet & leafIndexSet () const;
00441
00443 const typename Traits :: LevelIndexSet & levelIndexSet (int level) const;
00444
00449 bool loadBalance ();
00450
00477 template <class DataHandle>
00478 bool loadBalance (DataHandle & data);
00479
00481 int ghostSize (int level, int codim) const;
00482
00484 int overlapSize (int level, int codim) const { return 0; }
00485
00487 int ghostSize (int codim) const;
00488
00490 int overlapSize (int codim) const { return 0; }
00491
00493 template<class DataHandleImp,class DataTypeImp>
00494 void communicate (CommDataHandleIF<DataHandleImp,DataTypeImp> & data, InterfaceType iftype, CommunicationDirection dir, int level) const;
00495
00499 template<class DataHandleImp,class DataTypeImp>
00500 void communicate (CommDataHandleIF<DataHandleImp,DataTypeImp> & data, InterfaceType iftype, CommunicationDirection dir) const;
00501
00502 private:
00503 typedef ALU3DSPACE GatherScatter GatherScatterType;
00505 void doCommunication (
00506 GatherScatterType & vertexData,
00507 GatherScatterType & edgeData,
00508 GatherScatterType & faceData,
00509 GatherScatterType & elementData,
00510 InterfaceType iftype, CommunicationDirection dir) const;
00511
00512 public:
00514 const CollectiveCommunicationType & comm () const { return ccobj_; }
00515
00517 bool preAdapt ( );
00518
00520 void postAdapt ( );
00521
00523 bool adapt ( );
00524
00531 template <class DofManagerType, class RestrictProlongOperatorType>
00532 bool adapt (DofManagerType &dm, RestrictProlongOperatorType &rp, bool verbose=false );
00533
00535 bool globalRefine(int refCount);
00536
00537
00538
00539
00542 template <GrapeIOFileFormatType ftype>
00543 bool writeGrid( const std::string filename, alu3d_ctype time ) const ;
00544
00545 bool writeGrid_Xdr( const std::string filename, alu3d_ctype time ) const ;
00546 bool writeGrid_Ascii( const std::string filename, alu3d_ctype time ) const ;
00547
00550 template <GrapeIOFileFormatType ftype>
00551 bool readGrid( const std::string filename, alu3d_ctype & time );
00552
00553
00554 const HierarchicIndexSet & hierarchicIndexSet () const { return hIndexSet_; }
00555
00556
00557
00558 void setMaxLevel (int mxl);
00559
00560
00561 void updateStatus ();
00562
00564 bool mark( int refCount , const typename Traits::template Codim<0>::EntityPointer & ep );
00565
00567 int getMark( const typename Traits::template Codim<0>::EntityPointer & ) const;
00568 private:
00569 bool mark( int refCount , const typename Traits::template Codim<0>::Entity & en );
00570
00571 public:
00572 template <class IntersectionInterfaceType>
00573 const typename BaseType::
00574 template ReturnImplementationType<IntersectionInterfaceType> :: ImplementationType &
00575 getRealIntersectionIterator(const IntersectionInterfaceType & it) const
00576 {
00577 return this->getRealImplementation(it);
00578 }
00579
00581 const std::vector<GeometryType>& geomTypes (int codim) const { return geomTypes_[codim]; }
00582
00583
00584
00585
00586 ALU3DSPACE GitterImplType & myGrid() const;
00587
00589 const ReferenceElementType & referenceElement() const { return referenceElement_; }
00590
00591 protected:
00593 ALU3dGrid( const MyType & g );
00594
00596 ALU3dGrid<dim,dimworld,elType>&
00597 operator = (const MyType & g);
00598
00600 void calcExtras();
00601
00603 void calcMaxLevel();
00604
00606 void recalcGlobalSize();
00607
00609 void checkMacroGridFile (const std::string filename);
00610
00612 void checkMacroGrid ();
00613
00614
00615 mutable ALU3DSPACE GitterImplType * mygrid_;
00616 #if ALU3DGRID_PARALLEL
00617 ALU3DSPACE MpAccessMPI mpAccess_;
00618 #endif
00619
00620
00621 CollectiveCommunicationType ccobj_;
00622
00623 public:
00624
00625 int nlinks () const {
00626 #if ALU3DGRID_PARALLEL
00627 return mpAccess_.nlinks();
00628 #else
00629
00630 return 0;
00631 #endif
00632 }
00633
00634 private:
00635
00636 int maxlevel_;
00637
00638
00639 mutable int coarsenMarked_;
00640 mutable int refineMarked_;
00641
00642
00643 enum { numberOfGeomTypes = 1 };
00644 std::vector< std::vector<GeometryType> > geomTypes_;
00645
00646
00647 void makeGeomTypes ();
00648
00649
00650 HierarchicIndexSet hIndexSet_;
00651
00652
00653 mutable GlobalIdSetImp * globalIdSet_;
00654
00655
00656 LocalIdSetImp localIdSet_;
00657
00658
00659 mutable std::vector < LevelIndexSetImp * > levelIndexVec_;
00660
00661
00662 mutable LeafIndexSetImp * leafIndexSet_;
00663
00664
00665 public:
00666 typedef MakeableInterfaceObject<typename Traits::template Codim<0>::Entity> EntityObject;
00667 private:
00668 typedef ALUMemoryProvider< EntityObject > EntityProvider;
00669
00670 template <int codim>
00671 inline MakeableInterfaceObject<typename Traits::template Codim<codim>::Entity> *
00672 getNewEntity ( int level = -1 ) const
00673 {
00674 return ALU3dGridEntityFactory<MyType,codim>::getNewEntity(*this,entityProvider_,level);
00675 }
00676
00677 template <int codim>
00678 inline void freeEntity (MakeableInterfaceObject<typename Traits::template Codim<codim>::Entity> * en) const
00679 {
00680 ALU3dGridEntityFactory<MyType,codim>::freeEntity(entityProvider_, en);
00681 }
00682
00683 mutable EntityProvider entityProvider_;
00684
00685
00686 ReferenceElementType referenceElement_;
00687
00688 typedef ALU3dGridVertexList VertexListType;
00689 mutable VertexListType vertexList_[MAXL];
00690
00691 mutable ALU3dGridItemListType ghostLeafList_[dim];
00692 mutable ALU3dGridItemListType ghostLevelList_[dim][MAXL];
00693
00694 mutable ALU3dGridItemListType levelEdgeList_[MAXL];
00695
00696 typedef ALU3dGridLeafVertexList LeafVertexListType;
00697 mutable LeafVertexListType leafVertexList_;
00698 public:
00699 LeafVertexListType & getLeafVertexList() const
00700 {
00701 if( !leafVertexList_.up2Date() ) leafVertexList_.setupVxList(*this);
00702 return leafVertexList_;
00703 }
00704
00705 int getLevelOfLeafVertex(const ALU3DSPACE VertexType & vertex) const
00706 {
00707 assert( leafVertexList_.up2Date() );
00708 return leafVertexList_.getLevel(vertex);
00709 }
00710
00711 VertexListType & getVertexList(int level) const
00712 {
00713 assert( level >= 0 );
00714 assert( level <= maxLevel() );
00715 VertexListType & vxList = vertexList_[level];
00716 if(!vxList.up2Date()) vxList.setupVxList(*this,level);
00717 return vxList;
00718 }
00719
00720 ALU3dGridItemListType & getGhostLeafList(int codim) const
00721 {
00722 assert( codim >= 1 );
00723 assert( codim <= 3 );
00724 return ghostLeafList_[codim-1];
00725 }
00726
00727 ALU3dGridItemListType & getGhostLevelList(int codim, int level) const
00728 {
00729 assert( codim >= 1 );
00730 assert( codim <= 3 );
00731
00732 assert( level >= 0 );
00733 assert( level <= maxLevel() );
00734 return ghostLevelList_[codim-1][level];
00735 }
00736
00737 ALU3dGridItemListType & getEdgeList(int level) const
00738 {
00739 assert( level >= 0 );
00740 assert( level <= maxLevel() );
00741 return levelEdgeList_[level];
00742 }
00743 private:
00744
00745
00746 typedef SingleTypeSizeCache<MyType> SizeCacheType;
00747 SizeCacheType * sizeCache_;
00748
00749
00750 public:
00751 typedef ALU3dGridIntersectionIterator<const ThisType>
00752 IntersectionIteratorImp;
00753 typedef ALU3dGridIntersectionIterator<const ThisType>
00754 LeafIntersectionIteratorImp;
00755 typedef ALU3dGridLevelIntersectionIterator<const ThisType>
00756 LevelIntersectionIteratorImp;
00757
00758 typedef ALUMemoryProvider< LeafIntersectionIteratorImp > LeafIntersectionIteratorProviderType;
00759 typedef ALUMemoryProvider< LevelIntersectionIteratorImp > LevelIntersectionIteratorProviderType;
00760 private:
00761 friend class LeafIntersectionIteratorWrapper < const ThisType > ;
00762 friend class LevelIntersectionIteratorWrapper< const ThisType > ;
00763
00764 LeafIntersectionIteratorProviderType & leafIntersetionIteratorProvider() const { return leafInterItProvider_; }
00765 mutable LeafIntersectionIteratorProviderType leafInterItProvider_;
00766 LevelIntersectionIteratorProviderType & levelIntersetionIteratorProvider() const { return levelInterItProvider_; }
00767 mutable LevelIntersectionIteratorProviderType levelInterItProvider_;
00768
00769 };
00770
00771
00772 template <class GridImp, int codim>
00773 struct ALU3dGridEntityFactory
00774 {
00775 typedef typename GridImp :: template Codim<codim> :: Entity Entity;
00776 typedef MakeableInterfaceObject<Entity> EntityObject;
00777 typedef typename EntityObject :: ImplementationType EntityImp;
00778
00779 template <class EntityProviderType>
00780 static EntityObject *
00781 getNewEntity (const GridImp & grid, EntityProviderType & ep, int level)
00782 {
00783 return new EntityObject(EntityImp( grid, level ));
00784 }
00785
00786 template <class EntityProviderType>
00787 static void freeEntity( EntityProviderType & ep, EntityObject * e )
00788 {
00789 delete e;
00790 }
00791 };
00792
00793 template <class GridImp>
00794 struct ALU3dGridEntityFactory<GridImp,0>
00795 {
00796 enum { codim = 0 };
00797 typedef typename GridImp :: template Codim<codim> :: Entity Entity;
00798 typedef MakeableInterfaceObject<Entity> EntityObject;
00799 typedef typename EntityObject :: ImplementationType EntityImp;
00800
00801 template <class EntityProviderType>
00802 inline static EntityObject *
00803 getNewEntity (const GridImp & grid, EntityProviderType & ep, int level)
00804 {
00805 return ep.getEntityObject( grid, level, (EntityImp *) 0);
00806 }
00807
00808 template <class EntityProviderType>
00809 inline static void freeEntity( EntityProviderType & ep, EntityObject * e )
00810 {
00811 ep.freeObject( e );
00812 }
00813 };
00814
00815
00816 bool checkMacroGrid ( ALU3dGridElementType elType ,
00817 const std::string filename );
00818 const char* elType2Name( ALU3dGridElementType elType );
00819
00820 namespace Capabilities {
00821
00822 template<int dim, int dimw, Dune::ALU3dGridElementType elType, int cdim>
00823 struct hasEntity<Dune::ALU3dGrid<dim, dimw, elType>, cdim >
00824 {
00825 static const bool v = true;
00826 };
00827
00828 template <int dim, int dimw, ALU3dGridElementType elType>
00829 struct isParallel<const ALU3dGrid<dim, dimw, elType> > {
00830 static const bool v = true;
00831 };
00832
00833 template<int dim, int dimw, Dune::ALU3dGridElementType elType>
00834 struct isLevelwiseConforming< ALU3dGrid<dim,dimw,elType> >
00835 {
00836 static const bool v = true;
00837 };
00838
00839 template<int dim, int dimw, Dune::ALU3dGridElementType elType>
00840 struct hasHangingNodes< ALU3dGrid<dim,dimw,elType> >
00841 {
00842 static const bool v = true;
00843 };
00844
00845 template<int dim, int dimw, Dune::ALU3dGridElementType elType>
00846 struct hasBackupRestoreFacilities< ALU3dGrid<dim,dimw,elType> >
00847 {
00848 static const bool v = true;
00849 };
00850
00851 }
00852
00853 }
00854
00855 #include "grid_imp.cc"
00856 #endif