00001 #ifndef DUNE_ALBERTAGRID_IMP_HH
00002 #define DUNE_ALBERTAGRID_IMP_HH
00003 #include <iostream>
00004 #include <fstream>
00005 #include <dune/common/deprecated.hh>
00006
00007 #include <vector>
00008 #include <assert.h>
00009 #include <algorithm>
00010
00016
00017 #if defined GRIDDIM && GRIDDIM > 1 && GRIDDIM < 4
00018 #define DIM GRIDDIM
00019 #if defined GRIDDIMWORLD
00020 #define DIM_OF_WORLD GRIDDIMWORLD
00021 #else
00022
00023 #define DIM_OF_WORLD GRIDDIM
00024 #endif
00025 #else
00026 #ifndef ALBERTA_DIM
00027 #error "ALBERTA_DIM needed to compile AlbertaGrid! \n"
00028 #endif
00029
00030 #ifndef ALBERTA_WORLD_DIM
00031 #ifdef ALBERTA_DIM
00032 #define ALBERTA_WORLD_DIM ALBERTA_DIM
00033 #else
00034 #error "ALBERTA_WORLD_DIM needed to compile AlbertaGrid! \n"
00035 #endif
00036 #endif
00037
00038 #define DIM ALBERTA_DIM
00039 #define DIM_OF_WORLD ALBERTA_WORLD_DIM
00040 #endif
00041
00042
00043 #include <dune/common/misc.hh>
00044 #include <dune/common/interfaces.hh>
00045 #include <dune/common/fvector.hh>
00046 #include <dune/common/fmatrix.hh>
00047 #include <dune/grid/common/capabilities.hh>
00048 #include <dune/common/stdstreams.hh>
00049
00050 #if HAVE_MPI
00051 #include <dune/common/mpicollectivecommunication.hh>
00052 #else
00053 #include <dune/common/collectivecommunication.hh>
00054 #endif
00055
00056 #include <dune/common/exceptions.hh>
00057
00058 #include <dune/grid/common/grid.hh>
00059 #include <dune/grid/common/defaultindexsets.hh>
00060 #include <dune/grid/common/sizecache.hh>
00061 #include <dune/grid/common/intersectioniteratorwrapper.hh>
00062
00063
00064 #include <dune/grid/common/indexstack.hh>
00065
00066
00067
00068 #include "albertaheader.hh"
00069
00070
00071 #include <dune/grid/utility/grapedataioformattypes.hh>
00072
00073
00074
00075 typedef Dune::IndexStack<int,10000> IndexManagerType;
00076
00077
00078
00079 #include "albertaextra.hh"
00080
00081 namespace Dune {
00082
00083 class AlbertaError : public Exception {};
00084 class AlbertaIOError : public IOError {};
00085 }
00086
00087
00088 #include "agmemory.hh"
00089
00090 #include "referencetopo.hh"
00091 #include "indexsets.hh"
00092
00093
00094 #include "agcommunicator.hh"
00095
00096 namespace Dune
00097 {
00098
00099
00100 typedef ALBERTA REAL albertCtype;
00101
00102 template<int codim, int dim, class GridImp> class AlbertaGridEntity;
00103 template<int codim, int dim, class GridImp> class AlbertaGridMakeableEntity;
00104 template<int codim, PartitionIteratorType pitype, class GridImp> class AlbertaGridTreeIterator;
00105 template<int codim, PartitionIteratorType pitype, class GridImp> class AlbertaGridLeafIterator;
00106 template<int cd, class GridImp> class AlbertaGridEntityPointer;
00107
00108 template <int mydim, int cdim, class GridImp> class AlbertaGridGeometry;
00109 template<class GridImp> class AlbertaGridHierarchicIterator;
00110 template<class GridImp> class AlbertaGridIntersectionIterator;
00111 template<int dim, int dimworld> class AlbertaGrid;
00112 template<int dim, int dimworld> class AlbertaGridHierarchicIndexSet;
00113
00114 template <int codim, int dim, class GridImp>
00115 struct SelectEntityImp
00116 {
00117 typedef AlbertaGridEntity<codim,dim,GridImp> EntityImp;
00118 typedef Dune::Entity<codim, dim, const GridImp, AlbertaGridEntity> Entity;
00119 typedef MakeableInterfaceObject<Entity> EntityObject;
00120 };
00121
00125 class AlbertaMarkerVector
00126 {
00127 friend class AlbertaGrid<2,2>;
00128 friend class AlbertaGrid<2,3>;
00129 friend class AlbertaGrid<3,3>;
00130
00131 enum { vxBufferSize_ = 10000 };
00132 public:
00135 AlbertaMarkerVector (bool meLevel=true) : up2Date_(false), meLevel_(meLevel) {} ;
00136
00138 bool vertexNotOnElement(const int elIndex, const int vertex) const;
00139
00141 bool edgeNotOnElement(const int elIndex, const int edge) const;
00142
00144 bool faceNotOnElement(const int elIndex, const int face) const;
00145
00147 template <class GridType>
00148 void markNewVertices(GridType &grid, int level);
00149
00151 template <class GridType>
00152 void markNewLeafVertices(GridType &grid);
00153
00155 bool up2Date () const { return up2Date_; }
00156
00158 void unsetUp2Date () { up2Date_ = false; }
00159
00161 void print() const;
00162
00163 private:
00164 typedef std::vector<int> ArrayType;
00165
00166
00167 ArrayType vec_;
00168 ArrayType edgevec_;
00169 ArrayType facevec_;
00170
00171
00172 int numVertex_;
00173
00174
00175 bool up2Date_;
00176 bool meLevel_;
00177 };
00178
00179
00180
00181
00194
00195
00196
00197
00198
00199 template <int mydim, int cdim, class GridImp>
00200 class AlbertaGridGeometry :
00201 public GeometryDefaultImplementation<mydim,cdim,GridImp,AlbertaGridGeometry>
00202 {
00203
00204 typedef AlbertaGridGeometry<mydim,cdim,GridImp> ThisType;
00205
00207 enum { dimbary=mydim+1};
00208 public:
00210 AlbertaGridGeometry();
00211
00213 AlbertaGridGeometry(const int child, const int orientation );
00214
00217 const GeometryType & type () const;
00218
00220 int corners () const;
00221
00223 const FieldVector<albertCtype, cdim> & operator[] (int i) const;
00224
00227 FieldVector<albertCtype, cdim> global (const FieldVector<albertCtype, mydim>& local) const;
00228
00231 FieldVector<albertCtype, mydim> local (const FieldVector<albertCtype, cdim>& global) const;
00232
00234 bool checkInside(const FieldVector<albertCtype, mydim>& local) const;
00235
00259
00260 albertCtype integrationElement (const FieldVector<albertCtype, mydim>& local) const;
00261
00262
00263 albertCtype volume () const;
00264
00269 const FieldMatrix<albertCtype,mydim,mydim>& jacobianInverseTransposed (const FieldVector<albertCtype, mydim>& local) const;
00270
00271
00273
00276 typedef GridImp GridType;
00277 bool builtGeom(const GridImp & grid, ALBERTA EL_INFO *elInfo, int face, int edge, int vertex);
00278
00281 template <class GeometryType, class LocalGeomType >
00282 bool builtLocalGeom(const GeometryType & geo , const LocalGeomType & lg,
00283 ALBERTA EL_INFO *elInfo, int face);
00284
00285
00287 void initGeom();
00288 FieldVector<albertCtype, cdim>& getCoordVec (int i);
00289
00292 void print (std::ostream& ss) const;
00293
00294 private:
00295
00296 void buildGeomInFather(const int child, const int orientation);
00297
00298
00299 void calcElMatrix () const;
00300
00302 void buildJacobianInverseTransposed () const;
00303
00304
00305
00306 int mapVertices (int i) const;
00307
00308
00309 albertCtype elDeterminant () const;
00310
00311
00312 mutable FieldVector<albertCtype, mydim+1> tmpVec_;
00313
00315 mutable FieldMatrix<albertCtype,mydim+1,cdim> coord_;
00316
00318 mutable FieldVector<albertCtype, cdim> globalCoord_;
00319
00321 mutable FieldVector<albertCtype, mydim> localCoord_;
00322
00323
00324 ALBERTA EL_INFO * makeEmptyElInfo();
00325
00326 ALBERTA EL_INFO * elInfo_;
00327
00329 int face_;
00330
00332 int edge_;
00333
00335 int vertex_;
00336
00337 enum { matdim = (mydim > 0) ? mydim : 1 };
00338 mutable FieldMatrix<albertCtype,matdim,matdim> Jinv_;
00339 mutable FieldMatrix<albertCtype,matdim,matdim> Mtmp_;
00340
00341 mutable FieldMatrix<albertCtype,cdim,mydim> elMat_;
00342 mutable FieldMatrix<albertCtype,matdim,matdim> elMatT_elMat_;
00343
00345 mutable bool builtElMat_;
00347 mutable bool builtinverse_;
00348
00349
00350 mutable bool calcedDet_;
00351 mutable albertCtype elDet_;
00352
00353
00354 mutable FieldVector<albertCtype,cdim> tmpV_;
00355 mutable FieldVector<albertCtype,cdim> tmpU_;
00356 mutable FieldVector<albertCtype,cdim> tmpZ_;
00357
00358 mutable FieldVector<albertCtype,mydim> AT_x_;
00359 const GeometryType myGeomType_;
00360 const albertCtype detFactor_;
00361 };
00362
00363
00364
00365
00366
00367
00374 template<int cd, int dim, class GridImp>
00375 class AlbertaGridEntity :
00376 public EntityDefaultImplementation <cd,dim,GridImp,AlbertaGridEntity>
00377 {
00378 enum { dimworld = GridImp::dimensionworld };
00379 friend class AlbertaGrid < dim , dimworld >;
00380 friend class AlbertaGridEntity < 0, dim, GridImp>;
00381 friend class AlbertaGridTreeIterator < cd, All_Partition,GridImp>;
00382 friend class AlbertaGridMakeableEntity<cd,dim,GridImp>;
00383 friend class AlbertaGridEntityPointer<cd,GridImp>;
00384
00385 typedef AlbertaGridGeometry<dim-cd,dimworld,GridImp> GeometryImp;
00386 public:
00387 template <int cc>
00388 struct Codim
00389 {
00390 typedef typename GridImp::template Codim<cc>::EntityPointer EntityPointer;
00391 };
00392
00393 typedef typename GridImp::template Codim<cd>::Entity Entity;
00394 typedef typename GridImp::template Codim<0>::EntityPointer EntityPointer;
00395 typedef typename GridImp::template Codim<cd>::Geometry Geometry;
00396 typedef typename GridImp::template Codim<cd>::LevelIterator LevelIterator;
00397
00399 int level () const;
00400
00402 int boundaryId () const ;
00403
00405 AlbertaGridEntity(const GridImp &grid, int level,
00406 ALBERTA TRAVERSE_STACK * travStack);
00407
00409 AlbertaGridEntity(const GridImp &grid, int level, bool);
00410
00412 AlbertaGridEntity(const AlbertaGridEntity & org);
00413
00415 PartitionType partitionType() const;
00416
00418 const Geometry & geometry () const;
00419
00421 GeometryType type () const;
00422
00423
00424
00425
00427 ALBERTA EL_INFO *getElInfo () const;
00429 ALBERTA EL *getElement () const;
00430
00432 void removeElInfo();
00433
00436 int getFEVnum () const;
00437
00439 bool equals ( const AlbertaGridEntity<cd,dim,GridImp> & i) const;
00440
00441
00442 bool leafIt () const { return false; }
00443
00444
00445 void setTraverseStack (ALBERTA TRAVERSE_STACK *travStack);
00446 void setElInfo (ALBERTA EL_INFO *elInfo, int face,
00447 int edge, int vertex );
00448
00449
00450 void setEntity (const AlbertaGridEntity<cd,dim,GridImp> & org);
00451
00452
00453 void setLevel ( int newLevel );
00454 void setNewLevel ( int newLevel , bool ) { setLevel(level); }
00455
00456 private:
00457
00458 const GridImp &grid_;
00459
00460
00461 ALBERTA EL_INFO *elInfo_;
00462
00463
00464 ALBERTA EL * element_;
00465
00466
00467 ALBERTA TRAVERSE_STACK * travStack_;
00468
00470 int level_;
00471
00472
00473 typedef MakeableInterfaceObject<Geometry> GeometryObject;
00474
00476 GeometryObject geo_;
00478 mutable GeometryImp & geoImp_;
00479
00481 mutable bool builtgeometry_;
00482
00484 mutable FieldVector<albertCtype, dim> localFatherCoords_;
00485 mutable bool localFCoordCalced_;
00486
00488 int face_;
00489
00491 int edge_;
00492
00494 int vertex_;
00495 };
00496
00510
00511
00512
00513
00514
00515
00516 template<int dim, class GridImp>
00517 class AlbertaGridEntity<0,dim,GridImp> :
00518 public EntityDefaultImplementation <0,dim,GridImp,AlbertaGridEntity>
00519 {
00520 enum { dimworld = GridImp::dimensionworld };
00521 friend class AlbertaGrid < dim , GridImp::dimensionworld >;
00522 friend class AlbertaMarkerVector;
00523 friend class AlbertaGridIntersectionIterator <GridImp>;
00524 friend class AlbertaGridHierarchicIterator <GridImp>;
00525 friend class AlbertaGridTreeIterator <0,All_Partition,GridImp>;
00526 friend class AlbertaGridMakeableEntity<0,dim,GridImp>;
00527 friend class AlbertaGridEntityPointer<0,GridImp>;
00528 public:
00529 template <int cd>
00530 struct Codim
00531 {
00532 typedef typename GridImp::template Codim<cd>::EntityPointer EntityPointer;
00533 };
00534
00535 typedef typename GridImp::template Codim<0>::Entity Entity;
00536 typedef typename GridImp::template Codim<0>::Geometry Geometry;
00537 typedef AlbertaGridGeometry<dim,dimworld,GridImp> GeometryImp;
00538
00539 typedef typename GridImp::template Codim<0>::LevelIterator LevelIterator;
00540 typedef typename GridImp::template Codim<0>::HierarchicIterator HierarchicIterator;
00541 typedef typename GridImp::template Codim<0>::EntityPointer EntityPointer;
00542
00543 typedef LeafIntersectionIteratorWrapper<GridImp> AlbertaGridLeafIntersectionIteratorType;
00544 typedef AlbertaGridLeafIntersectionIteratorType AlbertaGridIntersectionIteratorType;
00545 typedef AlbertaGridLeafIntersectionIteratorType AlbertaGridLevelIntersectionIteratorType;
00546
00547 enum { dimension = dim };
00548
00552 ~AlbertaGridEntity() {};
00553
00555 AlbertaGridEntity(const GridImp &grid, int level, bool leafIt );
00556
00557 AlbertaGridEntity(const AlbertaGridEntity & org);
00558
00560 int level () const;
00561
00563 int boundaryId () const;
00564
00566 const Geometry & geometry () const;
00567
00569 GeometryType type () const;
00570
00574
00575 template<int cc> int count () const;
00576
00579 template<int cc> typename Codim<cc>::EntityPointer entity (int i) const;
00580
00583
00584
00590 AlbertaGridLeafIntersectionIteratorType ileafbegin () const;
00591 AlbertaGridIntersectionIteratorType ibegin () const
00592 {
00593 return ileafbegin();
00594 }
00595
00596 AlbertaGridLevelIntersectionIteratorType ilevelbegin () const
00597 {
00598 DUNE_THROW(NotImplemented,"method ilevelbegin not implemented!");
00599 return ileafbegin();
00600 }
00601
00603 AlbertaGridIntersectionIteratorType ileafend () const;
00604 AlbertaGridIntersectionIteratorType iend () const{ return ileafend();}
00605 AlbertaGridLeafIntersectionIteratorType ilevelend () const
00606 {
00607 DUNE_THROW(NotImplemented,"method ilevelend not implemented!");
00608 return ibegin();
00609 }
00610
00612 bool isLeaf () const ;
00613
00616 EntityPointer father () const;
00617
00628 const Geometry & geometryInFather () const;
00629
00634 AlbertaGridHierarchicIterator<GridImp> hbegin (int maxlevel) const;
00635
00637 AlbertaGridHierarchicIterator<GridImp> hend (int maxlevel) const;
00638
00641 bool wasRefined () const ;
00642
00645 bool mightBeCoarsened () const ;
00646
00649 bool hasBoundaryIntersections () const ;
00650
00652 PartitionType partitionType() const;
00653
00655 bool equals ( const AlbertaGridEntity<0,dim,GridImp> & i) const;
00656
00657
00658
00659
00660
00661 void setLeafData( int proc );
00662
00663
00664 bool master() const;
00665
00666
00667 int getFEVnum () const { return 0; }
00668
00669
00670 ALBERTA EL_INFO *getElInfo () const;
00671
00672
00673 ALBERTA EL *getElement () const;
00674
00675
00676 void removeElInfo();
00677
00678
00679 bool leafIt () const { return leafIt_; }
00680
00681
00682
00683 void setTraverseStack (ALBERTA TRAVERSE_STACK *travStack);
00684 void setElInfo (ALBERTA EL_INFO *elInfo,
00685 int face = 0,
00686 int edge = 0,
00687 int vertex = 0 );
00688
00689
00690 void setEntity (const AlbertaGridEntity<0,dim,GridImp> & org);
00691
00692 private:
00694 int nChild () const;
00695
00697 void makeDescription();
00698
00700 const GridImp & grid_;
00701
00703 int level_;
00704
00706 ALBERTA TRAVERSE_STACK * travStack_;
00707
00709 ALBERTA EL_INFO *elInfo_;
00710
00712 ALBERTA EL *element_;
00713
00714
00715 typedef MakeableInterfaceObject<Geometry> GeometryObject;
00716
00718 mutable GeometryObject geoObj_;
00719 mutable GeometryImp & geo_;
00720 mutable bool builtgeometry_;
00721
00722
00723 bool leafIt_;
00724
00725 };
00726
00727
00728
00729
00730
00731
00732
00736 template<int cd, class GridImp>
00737 class AlbertaGridEntityPointer :
00738 public EntityPointerDefaultImplementation <cd, GridImp, AlbertaGridEntityPointer<cd,GridImp> >
00739 {
00740 enum { dim = GridImp::dimension };
00741 enum { dimworld = GridImp::dimensionworld };
00742
00743 friend class AlbertaGridEntity<cd,dim,GridImp>;
00744 friend class AlbertaGridEntity< 0,dim,GridImp>;
00745 friend class AlbertaGrid < dim , dimworld >;
00746
00747 public:
00748 typedef typename GridImp::template Codim<cd>::Entity Entity;
00749 typedef typename SelectEntityImp<cd,dim,GridImp>::EntityImp EntityImp;
00750 typedef typename SelectEntityImp<cd,dim,GridImp>::EntityObject EntityObject;
00751 typedef AlbertaGridEntityPointer<cd,GridImp> Base;
00752
00754 typedef AlbertaGridEntityPointer<cd,GridImp> AlbertaGridEntityPointerType;
00755
00757 AlbertaGridEntityPointer(const GridImp & grid,
00758 int level, ALBERTA EL_INFO *elInfo,int face,int edge,int vertex);
00759
00761 AlbertaGridEntityPointer(const GridImp & grid, ALBERTA TRAVERSE_STACK * stack,
00762 int level, ALBERTA EL_INFO *elInfo,int face,int edge,int vertex);
00763
00765 AlbertaGridEntityPointer(const GridImp & grid, int level , bool isLeaf, bool done);
00766
00768 AlbertaGridEntityPointer(const AlbertaGridEntityPointerType & org);
00769
00771 AlbertaGridEntityPointer(const GridImp & , const EntityImp & en);
00772
00774 AlbertaGridEntityPointer& operator= (const AlbertaGridEntityPointer& org);
00775
00777 ~AlbertaGridEntityPointer();
00778
00780 bool equals (const AlbertaGridEntityPointerType& i) const;
00781
00783 Entity & dereference () const ;
00784
00786 int level () const ;
00787
00789 void done ();
00790
00791 protected:
00793 bool leafIt () const { return isLeaf_; }
00794
00796 EntityImp & entityImp ();
00797
00799 const EntityImp & entityImp () const;
00800
00801
00802 const GridImp & grid_;
00803
00805 bool isLeaf_;
00806
00807
00808 EntityObject * entity_;
00809 };
00810
00811
00812
00813
00814
00815
00825 template<class GridImp>
00826 class AlbertaGridHierarchicIterator :
00827 public AlbertaGridEntityPointer<0,GridImp> ,
00828 public HierarchicIteratorDefaultImplementation <GridImp,AlbertaGridHierarchicIterator>
00829 {
00830 public:
00831 typedef typename GridImp::template Codim<0>::Entity Entity;
00832 typedef typename GridImp::ctype ctype;
00833
00834
00835 typedef typename SelectEntityImp<0,GridImp::dimension,GridImp>::EntityImp EntityImp;
00836
00838 AlbertaGridHierarchicIterator(const GridImp &grid,
00839 ALBERTA TRAVERSE_STACK *travStack,
00840 int actLevel, int maxLevel, bool leafIt );
00841
00843 AlbertaGridHierarchicIterator(const GridImp &grid,
00844 int actLevel,int maxLevel);
00845
00847 AlbertaGridHierarchicIterator(const AlbertaGridHierarchicIterator<GridImp> &org);
00848
00850 AlbertaGridHierarchicIterator<GridImp> & operator = (const AlbertaGridHierarchicIterator<GridImp> &org);
00851
00853 void increment();
00854
00855 private:
00856 const int startLevel_;
00857
00859 int level_;
00860
00862 int maxlevel_;
00863
00865 EntityImp & virtualEntity_;
00866
00869 ALBERTA ManageTravStack manageStack_;
00870
00872 bool end_;
00873
00875 ALBERTA EL_INFO * recursiveTraverse(ALBERTA TRAVERSE_STACK * stack);
00876
00878 ALBERTA EL_INFO * firstChild(ALBERTA TRAVERSE_STACK * stack);
00879
00881 void makeIterator();
00882 };
00883
00884
00885
00886
00887
00888
00896 template<class GridImp>
00897 class AlbertaGridIntersectionIterator :
00898
00899 public IntersectionIteratorDefaultImplementation <GridImp,AlbertaGridIntersectionIterator>
00900 {
00901 enum { dim = GridImp::dimension };
00902 enum { dimworld = GridImp::dimensionworld };
00903
00904 friend class AlbertaGridEntity<0,dim,GridImp>;
00905 typedef AlbertaGridIntersectionIterator<GridImp> ThisType;
00906 public:
00907 typedef AGMemoryProvider< ThisType > StorageType;
00908 typedef typename GridImp::template Codim<0>::Entity Entity;
00909 typedef typename GridImp::template Codim<1>::Geometry Geometry;
00910 typedef typename GridImp::template Codim<1>::LocalGeometry LocalGeometry;
00911
00912 typedef typename SelectEntityImp<0,dim,GridImp>::EntityImp EntityImp;
00913
00914
00915 typedef AlbertaGridGeometry<dim-1,dimworld,GridImp> LocalGeometryImp;
00916 typedef typename GridImp::template Codim<0>::EntityPointer EntityPointer;
00917
00919 enum { dimension=dim };
00921 enum { dimensionworld=dimworld };
00923 typedef typename GridImp::ctype ctype;
00924
00926 bool equals (const AlbertaGridIntersectionIterator<GridImp> & i) const;
00927
00929 void increment();
00930
00932 bool operator==(const AlbertaGridIntersectionIterator<GridImp>& i) const;
00933
00935 EntityPointer outside() const;
00936
00938 EntityPointer inside() const;
00939
00941 AlbertaGridIntersectionIterator(const GridImp & grid,
00942 int level);
00943
00945 AlbertaGridIntersectionIterator(const GridImp & grid,
00946 int level,
00947 ALBERTA EL_INFO *elInfo,
00948 bool leafIt );
00950 AlbertaGridIntersectionIterator(const AlbertaGridIntersectionIterator<GridImp> & org);
00951
00953 void assign (const AlbertaGridIntersectionIterator<GridImp> & org);
00954
00956
00957
00959 bool boundary () const;
00960
00962 bool neighbor () const;
00963
00965 int boundaryId () const;
00966
00971 const LocalGeometry& intersectionSelfLocal () const;
00975 const LocalGeometry& intersectionNeighborLocal () const;
00979 const Geometry& intersectionGlobal () const;
00980
00982 int numberInSelf () const;
00984 int numberInNeighbor () const;
00985
00987 int twistInSelf() const;
00988
00990 int twistInNeighbor() const;
00991
00994 typedef FieldVector<albertCtype, GridImp::dimensionworld> NormalVecType;
00995 typedef FieldVector<albertCtype, GridImp::dimension-1> LocalCoordType;
00996
00997 const NormalVecType & unitOuterNormal (const LocalCoordType & local) const;
00998
01001 const NormalVecType & outerNormal (const LocalCoordType & local) const;
01002
01005 const NormalVecType & integrationOuterNormal (const LocalCoordType & local) const;
01006
01008 int level () const;
01009
01010
01011
01012
01013
01014
01015 template <class EntityType>
01016 void first(const EntityType & en, int level );
01017
01018
01019 void done ();
01020
01021 private:
01022
01023 bool neighborHasSameLevel () const;
01024
01026 void makeBegin (const GridImp & grid,
01027 int level,
01028 ALBERTA EL_INFO * elInfo ) const;
01029
01031 void makeEnd (const GridImp & grid,int level ) const;
01032
01033
01034 void freeObjects () const;
01035
01037 void setupVirtEn () const;
01038
01040 void calcOuterNormal () const;
01041
01042
01043
01044 bool leafIt () const { return leafIt_; }
01046
01048
01050 const GridImp& grid_;
01051
01053 mutable int level_;
01054
01056 mutable int neighborCount_;
01057
01061 mutable bool builtNeigh_;
01062
01063 bool leafIt_;
01064
01066 mutable ALBERTA EL_INFO * elInfo_;
01067
01068 typedef MakeableInterfaceObject<LocalGeometry> LocalGeometryObject;
01069
01070
01071 mutable LocalGeometryObject fakeNeighObj_;
01072 mutable LocalGeometryObject fakeSelfObj_;
01073 mutable LocalGeometryObject neighGlobObj_;
01074
01077 mutable LocalGeometryImp & fakeNeigh_;
01080 mutable LocalGeometryImp & fakeSelf_;
01083 mutable LocalGeometryImp & neighGlob_;
01084
01086 mutable ALBERTA EL_INFO neighElInfo_;
01087
01088 mutable NormalVecType outNormal_;
01089 mutable NormalVecType unitNormal_;
01090
01091
01092 mutable FieldVector<albertCtype, dimworld> tmpU_;
01093 mutable FieldVector<albertCtype, dimworld> tmpV_;
01094
01095
01096 mutable int twist_;
01097
01099 bool done_;
01100 };
01101
01102
01103
01104
01105
01106
01107
01108
01109
01110
01111
01112
01113 namespace AlbertaTreeIteratorHelp {
01114 template <class IteratorImp, int dim, int codim>
01115 struct GoNextEntity;
01116 }
01117
01121 template<int cd, PartitionIteratorType pitype, class GridImp>
01122 class AlbertaGridTreeIterator :
01123 public AlbertaGridEntityPointer<cd,GridImp>
01124 {
01125 enum { dim = GridImp::dimension };
01126 friend class AlbertaGridEntity<2,dim,GridImp>;
01127 friend class AlbertaGridEntity<1,dim,GridImp>;
01128 friend class AlbertaGridEntity<0,dim,GridImp>;
01129 friend class AlbertaGrid < dim , GridImp::dimensionworld >;
01130
01131
01132 typedef AlbertaGridTreeIterator<cd,pitype,GridImp> AlbertaGridTreeIteratorType;
01133 typedef AlbertaGridTreeIteratorType ThisType;
01134 friend class AlbertaTreeIteratorHelp::GoNextEntity<ThisType,dim,cd>;
01135 public:
01136
01137 typedef typename GridImp::template Codim<cd>::Entity Entity;
01138 typedef typename SelectEntityImp<cd,dim,GridImp>::EntityImp EntityImp;
01139
01140
01142 AlbertaGridTreeIterator(const AlbertaGridTreeIterator<cd,pitype,GridImp> & org );
01143
01145 AlbertaGridTreeIterator<cd,pitype,GridImp> & operator = (const AlbertaGridTreeIterator<cd,pitype,GridImp> & org );
01146
01148 AlbertaGridTreeIterator(const GridImp & grid, int
01149 travLevel, int proc, bool leafIt=false );
01150
01152 AlbertaGridTreeIterator(const GridImp & grid,
01153 const AlbertaMarkerVector * vec,
01154 int travLevel,
01155 int proc,
01156 bool leafIt=false);
01157
01159 void increment();
01161
01162 private:
01163
01164 void makeIterator();
01165
01166 ALBERTA EL_INFO * goFirstElement(ALBERTA TRAVERSE_STACK *stack,
01167 ALBERTA MESH *mesh,
01168 int level, ALBERTA FLAGS fill_flag);
01169 ALBERTA EL_INFO * traverseElLevel(ALBERTA TRAVERSE_STACK * stack);
01170 ALBERTA EL_INFO * traverseElLevelInteriorBorder(ALBERTA TRAVERSE_STACK * stack);
01171 ALBERTA EL_INFO * traverseElLevelGhosts(ALBERTA TRAVERSE_STACK * stack);
01172
01173
01174
01175 ALBERTA EL_INFO * goNextEntity(ALBERTA TRAVERSE_STACK *stack,ALBERTA EL_INFO *elinfo_old);
01176
01177
01178 ALBERTA EL_INFO * goNextElInfo(ALBERTA TRAVERSE_STACK *stack,ALBERTA EL_INFO *elinfo_old);
01179 ALBERTA EL_INFO * goNextFace(ALBERTA TRAVERSE_STACK *stack,
01180 ALBERTA EL_INFO *elInfo);
01181 ALBERTA EL_INFO * goNextEdge(ALBERTA TRAVERSE_STACK *stack,
01182 ALBERTA EL_INFO *elInfo);
01183 ALBERTA EL_INFO * goNextVertex(ALBERTA TRAVERSE_STACK *stack,
01184 ALBERTA EL_INFO *elInfo);
01185
01186
01187 ALBERTA MACRO_EL * nextGhostMacro(ALBERTA MACRO_EL *mel);
01188
01190 int level_;
01191
01193 int enLevel_;
01194
01196 EntityImp & virtualEntity_;
01197
01198
01199 ALBERTA ManageTravStack manageStack_;
01200
01202 int face_;
01203 int edge_;
01204 int vertex_;
01205
01206
01207 const AlbertaMarkerVector * vertexMarker_;
01208
01209
01210 bool okReturn_;
01211
01212
01213
01214
01215 const int proc_;
01216 };
01217
01220 template<int cd, PartitionIteratorType pitype, class GridImp>
01221 class AlbertaGridLevelIterator :
01222 public AlbertaGridTreeIterator<cd,pitype,GridImp> ,
01223 public LevelIteratorDefaultImplementation <cd,pitype,GridImp,AlbertaGridLevelIterator>
01224 {
01225 public:
01226 typedef typename GridImp::template Codim<cd>::Entity Entity;
01227
01229 AlbertaGridLevelIterator(const GridImp & grid, int level, int proc) :
01230 AlbertaGridTreeIterator<cd,pitype,GridImp> (grid,level,proc)
01231 {
01232 }
01233
01235 AlbertaGridLevelIterator(const GridImp & grid,
01236 const AlbertaMarkerVector * vec, int level, int proc) :
01237 AlbertaGridTreeIterator<cd,pitype,GridImp> (grid,vec,level,proc)
01238 {
01239 }
01240
01242 void increment ()
01243 {
01244 AlbertaGridTreeIterator<cd,pitype,GridImp>::increment();
01245 }
01246 };
01247
01248
01249
01250
01251
01252
01253
01255 template<int codim, PartitionIteratorType pitype, class GridImp>
01256 class AlbertaGridLeafIterator :
01257 public AlbertaGridTreeIterator<codim, pitype, GridImp>,
01258 public LeafIteratorDefaultImplementation<codim, pitype, GridImp, AlbertaGridLeafIterator>
01259 {
01260 public:
01261 typedef typename GridImp::template Codim<codim>::Entity Entity;
01262
01264 AlbertaGridLeafIterator(const GridImp & grid, int level, int proc) :
01265 AlbertaGridTreeIterator<codim,pitype,GridImp> (grid,level,proc,true)
01266 {
01267 }
01268
01270 AlbertaGridLeafIterator(const GridImp & grid,
01271 const AlbertaMarkerVector * vec, int level, int proc) :
01272 AlbertaGridTreeIterator<codim, pitype, GridImp> (grid,vec,level,proc,true)
01273 {
01274 }
01275
01277 void increment ()
01278 {
01279 AlbertaGridTreeIterator<codim, pitype, GridImp>::increment();
01280 }
01281 };
01282
01283
01284
01285
01286
01287
01288
01289
01290 template <int dim, int dimworld>
01291 struct AlbertaGridFamily
01292 {
01293 typedef AlbertaGrid<dim,dimworld> GridImp;
01294
01295 typedef DefaultLevelIndexSet< AlbertaGrid<dim,dimworld> > LevelIndexSetImp;
01296 typedef DefaultLeafIndexSet< AlbertaGrid<dim,dimworld> > LeafIndexSetImp;
01297
01298 typedef AlbertaGridIdSet<dim,dimworld> IdSetImp;
01299 typedef int IdType;
01300
01301 struct Traits
01302 {
01303 typedef GridImp Grid;
01304
01305 typedef Dune::IntersectionIterator<const GridImp, LeafIntersectionIteratorWrapper > LeafIntersectionIterator;
01306
01307 typedef Dune::IntersectionIterator<const GridImp, LeafIntersectionIteratorWrapper > LeafIntersection;
01308 typedef Dune::IntersectionIterator<const GridImp, LeafIntersectionIteratorWrapper > LevelIntersectionIterator;
01309
01310 typedef Dune::IntersectionIterator<const GridImp, LeafIntersectionIteratorWrapper > LevelIntersection;
01311
01312 typedef Dune::HierarchicIterator<const GridImp, AlbertaGridHierarchicIterator> HierarchicIterator;
01313
01314 typedef IdType GlobalIdType;
01315 typedef IdType LocalIdType;
01316
01317 template <int cd>
01318 struct Codim
01319 {
01320
01321 typedef Dune::Geometry<dim-cd, dimworld, const GridImp, AlbertaGridGeometry> Geometry;
01322 typedef Dune::Geometry<dim-cd, dim, const GridImp, AlbertaGridGeometry> LocalGeometry;
01323
01324
01325 typedef typename SelectEntityImp<cd,dim,GridImp>::Entity Entity;
01326
01327 typedef Dune::LevelIterator<cd,All_Partition,const GridImp,AlbertaGridLevelIterator> LevelIterator;
01328
01329 typedef Dune::LeafIterator<cd,All_Partition,const GridImp,AlbertaGridLeafIterator> LeafIterator;
01330
01331 typedef Dune::EntityPointer<const GridImp,AlbertaGridEntityPointer<cd,const GridImp> > EntityPointer;
01332
01333 template <PartitionIteratorType pitype>
01334 struct Partition
01335 {
01336 typedef Dune::LevelIterator<cd,pitype,const GridImp,AlbertaGridLevelIterator> LevelIterator;
01337 typedef Dune::LeafIterator<cd,pitype,const GridImp,AlbertaGridLeafIterator> LeafIterator;
01338 };
01339
01340 };
01341
01342 typedef IndexSet<GridImp,LevelIndexSetImp,DefaultLevelIteratorTypes<GridImp> > LevelIndexSet;
01343 typedef IndexSet<GridImp,LeafIndexSetImp,DefaultLeafIteratorTypes<GridImp> > LeafIndexSet;
01344 typedef IdSet<GridImp,IdSetImp,IdType> GlobalIdSet;
01345 typedef IdSet<GridImp,IdSetImp,IdType> LocalIdSet;
01346
01347
01348
01349
01350
01351
01352 typedef CollectiveCommunication<GridImp> CollectiveCommunication;
01353
01354 };
01355 };
01356
01402 template <int dim, int dimworld>
01403 class AlbertaGrid :
01404 public GridDefaultImplementation <dim,dimworld,albertCtype, AlbertaGridFamily<dim,dimworld> >,
01405 public HasObjectStream ,
01406 public HasHierarchicIndexSet
01407 {
01408 friend class AlbertaGridEntity <0,dim,const AlbertaGrid<dim,dimworld> >;
01409 friend class AlbertaGridEntity <1,dim,const AlbertaGrid<dim,dimworld> >;
01410 friend class AlbertaGridEntity <2,dim,const AlbertaGrid<dim,dimworld> >;
01411 friend class AlbertaGridEntity <dim,dim,const AlbertaGrid<dim,dimworld> >;
01412
01413 friend class AlbertaGridEntityPointer <0,const AlbertaGrid<dim,dimworld> >;
01414 friend class AlbertaGridEntityPointer <1,const AlbertaGrid<dim,dimworld> >;
01415 friend class AlbertaGridEntityPointer <2,const AlbertaGrid<dim,dimworld> >;
01416 friend class AlbertaGridEntityPointer <3,const AlbertaGrid<dim,dimworld> >;
01417
01418
01419 friend class AlbertaGridTreeIterator<0,All_Partition,AlbertaGrid<dim,dimworld> >;
01420 friend class AlbertaGridTreeIterator<1,All_Partition,AlbertaGrid<dim,dimworld> >;
01421 friend class AlbertaGridTreeIterator<2,All_Partition,AlbertaGrid<dim,dimworld> >;
01422 friend class AlbertaGridTreeIterator<3,All_Partition,AlbertaGrid<dim,dimworld> >;
01423
01424 friend class AlbertaGridHierarchicIterator<AlbertaGrid<dim,dimworld> >;
01425
01426 friend class AlbertaGridIntersectionIterator<AlbertaGrid<dim,dimworld> >;
01427 friend class AlbertaGridIntersectionIterator<const AlbertaGrid<dim,dimworld> >;
01428
01431
01432
01433 typedef AlbertaGrid<dim,dimworld> MyType;
01434
01435 friend class AlbertaMarkerVector;
01436 friend class AlbertaGridHierarchicIndexSet<dim,dimworld>;
01437
01438
01439 enum { defaultElementChunk_ = 100 };
01440
01441
01442
01443
01444 public:
01446 typedef AlbertaGridFamily<dim,dimworld> GridFamily;
01447 typedef GridDefaultImplementation <dim,dimworld,albertCtype,
01448 AlbertaGridFamily<dim,dimworld> > BaseType;
01449
01451 typedef typename AlbertaGridFamily<dim,dimworld> :: Traits Traits;
01452
01454 typedef AlbertaGridHierarchicIndexSet<dim,dimworld> HierarchicIndexSet;
01455
01456 private:
01458 typedef typename Traits:: CollectiveCommunication CollectiveCommunicationType;
01459
01461 typedef typename Traits::template Codim<0>::LeafIterator LeafIterator;
01462
01464 typedef typename GridFamily:: LevelIndexSetImp LevelIndexSetImp;
01465 typedef typename GridFamily:: LeafIndexSetImp LeafIndexSetImp;
01466
01468 typedef typename Traits :: LeafIndexSet LeafIndexSet;
01469
01471 typedef AlbertaGridIdSet<dim,dimworld> IdSetImp;
01472 typedef typename Traits :: GlobalIdSet GlobalIdSet;
01473 typedef typename Traits :: LocalIdSet LocalIdSet;
01474
01475 public:
01477 typedef typename ALBERTA AlbertHelp::AlbertLeafData<dimworld,dim+1> LeafDataType;
01478
01479 typedef ObjectStream ObjectStreamType;
01480
01481 enum {
01483 numCodim = dim+1 };
01484
01485 enum {
01487 MAXL = 64 };
01488
01489
01490
01491
01492
01493
01495 AlbertaGrid(const std::string macroTriangFilename);
01496
01497
01498
01499
01500
01501
01502
01503
01504
01505
01507 AlbertaGrid();
01508
01510 ~AlbertaGrid();
01511
01514 int maxLevel() const;
01515
01517 template<int cd, PartitionIteratorType pitype>
01518 typename Traits::template Codim<cd>::template Partition<pitype>::LevelIterator
01519 lbegin (int level) const;
01520
01522 template<int cd, PartitionIteratorType pitype>
01523 typename Traits::template Codim<cd>::template Partition<pitype>::LevelIterator
01524 lend (int level) const;
01525
01527 template<int cd> typename Traits::template Codim<cd>::
01528 template Partition<All_Partition>::LevelIterator
01529 lbegin (int level) const;
01530
01532 template<int cd> typename Traits::template Codim<cd>::
01533 template Partition<All_Partition>::LevelIterator
01534 lend (int level) const;
01535
01537 template <int codim, PartitionIteratorType pitype>
01538 typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
01539 leafbegin () const;
01540
01542 template <int codim>
01543 typename Traits::template Codim<codim>::LeafIterator
01544 leafbegin () const;
01545
01547 template <int codim, PartitionIteratorType pitype>
01548 typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
01549 leafend () const;
01550
01552 template <int codim>
01553 typename Traits::template Codim<codim>::LeafIterator
01554 leafend () const;
01555
01556 private:
01558 template <int codim, PartitionIteratorType pitype>
01559 typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
01560 leafbegin ( int maxlevel, int proc = -1 ) const;
01561
01563 template <int codim>
01564 typename Traits::template Codim<codim>::LeafIterator
01565 leafbegin ( int maxlevel, int proc = -1 ) const;
01566
01568 template <int codim, PartitionIteratorType pitype>
01569 typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
01570 leafend ( int maxlevel, int proc = -1 ) const;
01571
01573 template <int codim>
01574 typename Traits::template Codim<codim>::LeafIterator
01575 leafend ( int maxlevel, int proc = -1 ) const;
01576
01578 LeafIterator leafbegin ( int maxlevel, int proc = -1 ) const;
01579
01581 LeafIterator leafend ( int maxlevel, int proc = -1 ) const;
01582
01584 LeafIterator leafbegin () const;
01585
01587 LeafIterator leafend () const;
01588
01589 public:
01594 int size (int level, int codim) const;
01595
01597 int size (int level, GeometryType type) const;
01598
01600 int size (int codim) const;
01601
01603 int size (GeometryType type) const;
01604
01605 public:
01606
01607
01608
01615 bool mark( int refCount , const typename Traits::template Codim<0>::EntityPointer & en ) const;
01616
01618 int getMark( const typename Traits::template Codim<0>::EntityPointer & ) const;
01619 private:
01620 bool mark( int refCount , const typename Traits::template Codim<0>::Entity & en ) const;
01621
01622 public:
01624 bool globalRefine(int refCount);
01625
01629 bool adapt ( );
01630
01632 template <class DofManagerType, class RestrictProlongOperatorType>
01633 bool adapt (DofManagerType &, RestrictProlongOperatorType &, bool verbose=false );
01634
01636 bool preAdapt ();
01637
01639 bool postAdapt();
01640
01643 const CollectiveCommunicationType & comm () const
01644 {
01645 return comm_;
01646 }
01647
01649 std::string name () const { return "AlbertaGrid"; };
01650
01651
01652
01653
01655 template <GrapeIOFileFormatType ftype>
01656 bool writeGrid( const std::basic_string<char> filename, albertCtype time ) const;
01657
01659 template <GrapeIOFileFormatType ftype>
01660 bool readGrid( const std::basic_string<char> filename, albertCtype & time );
01661
01662
01663
01664
01665
01666
01667 int global_size (int codim) const;
01668
01669
01670 int myRank () const { return myRank_; };
01671
01673 void setNewCoords(const FieldVector<albertCtype, dimworld> & trans, const albertCtype scalar);
01674
01675
01676 const HierarchicIndexSet & hierarchicIndexSet () const { return hIndexSet_; }
01677
01679 const typename Traits :: LevelIndexSet & levelIndexSet (int level) const;
01680
01682 const typename Traits :: LeafIndexSet & leafIndexSet () const;
01683
01685 const GlobalIdSet & globalIdSet () const { return globalIdSet_; }
01686
01688 const LocalIdSet & localIdSet () const { return globalIdSet_; }
01689
01690
01691 ALBERTA MESH* getMesh () const { return mesh_; };
01692
01693
01694 template <int cd>
01695 AlbertaGridEntity<cd,dim,const AlbertaGrid<dim,dimworld> >&
01696 getRealEntity(typename Traits::template Codim<cd>::Entity& entity)
01697 {
01698 return this->getRealImplementation(entity);
01699 }
01700
01701 private:
01703 template <int cd>
01704 const AlbertaGridEntity<cd,dim,const AlbertaGrid<dim,dimworld> >&
01705 getRealEntity(const typename Traits::template Codim<cd>::Entity& entity) const
01706 {
01707 return this->getRealImplementation(entity);
01708 }
01709
01710 public:
01711
01712 void createGhosts ();
01713
01714
01715 template <class EntityType>
01716 int owner (const EntityType & ) const;
01717
01718
01719
01720 template <class EntityType>
01721 bool partition( int proc , EntityType & );
01722
01723
01724 void unpackAll ( ObjectStreamType & os );
01725
01726
01727 template <class EntityType>
01728 void packAll ( ObjectStreamType & os, EntityType & en );
01729
01730
01731 template <class EntityType>
01732 void packBorder ( ObjectStreamType & os, EntityType & en );
01733
01734
01735 bool isGhost( const ALBERTA MACRO_EL * mel) const;
01736
01737
01738 bool isNoElement( const ALBERTA MACRO_EL * mel) const;
01739
01741 const std::vector < GeometryType > & geomTypes (int codim) const
01742 {
01743 assert( codim >= 0 );
01744 assert( codim < dim+1 );
01745 return geomTypes_[codim];
01746 }
01747
01748 private:
01749 friend class Conversion<AlbertaGrid<dim, dimworld>, HasObjectStream>;
01750 friend class Conversion<const AlbertaGrid<dim, dimworld>, HasObjectStream>;
01751
01752 friend class Conversion<AlbertaGrid<dim, dimworld>, HasHierarchicIndexSet >;
01753 friend class Conversion<const AlbertaGrid<dim, dimworld>, HasHierarchicIndexSet>;
01754
01755
01756 AlbertaGrid(const MyType& other);
01757
01758 MyType& operator=(const MyType& other);
01759
01760 private:
01761 typedef std::vector<int> ArrayType;
01762
01763 ArrayType ghostFlag_;
01764
01765
01766 void initGrid(int proc);
01767
01768
01769
01770 void calcExtras();
01771
01772
01773 bool writeGridXdr ( const std::basic_string<char> filename, albertCtype time ) const;
01774
01776 bool readGridXdr ( const std::basic_string<char> filename, albertCtype & time );
01777
01779 bool readGridAscii ( const std::basic_string<char> filename, albertCtype & time );
01780
01781
01782 void removeMesh();
01783
01784
01785 ALBERTA MESH *mesh_;
01786
01787
01788 CollectiveCommunicationType comm_;
01789
01790
01791 int maxlevel_;
01792
01793
01794 bool wasChanged_;
01795
01796
01797 mutable ArrayType macroVertices_;
01798
01799 public:
01800
01801
01802
01803
01804 void fillElInfo(int ichild, int actLevel ,const ALBERTA EL_INFO *elinfo_old,
01805 ALBERTA EL_INFO *elinfo, bool hierachical, bool leaf=false ) const;
01806
01807
01808 void firstNeigh(const int ichild,const ALBERTA EL_INFO *elinfo_old,
01809 ALBERTA EL_INFO *elinfo, const bool leafLevel) const;
01810
01811
01812 void secondNeigh(const int ichild, const ALBERTA EL_INFO *elinfo_old,
01813 ALBERTA EL_INFO *elinfo, const bool leafLevel) const;
01814
01815
01816 void thirdNeigh(const int ichild, const ALBERTA EL_INFO *elinfo_old,
01817 ALBERTA EL_INFO *elinfo, const bool leafLevel) const;
01818
01819 private:
01820
01821 mutable AlbertaMarkerVector vertexMarkerLeaf_;
01822
01823
01824 mutable AlbertaMarkerVector vertexMarkerLevel_[MAXL];
01825
01826
01827
01828
01829 typedef typename SelectEntityImp<0,dim,const MyType>::EntityObject EntityObject;
01830
01831 public:
01832 typedef AGMemoryProvider< EntityObject > EntityProvider;
01833
01834 typedef AlbertaGridIntersectionIterator< const MyType > IntersectionIteratorImp;
01835 typedef IntersectionIteratorImp LeafIntersectionIteratorImp;
01836 typedef AGMemoryProvider< LeafIntersectionIteratorImp > LeafIntersectionIteratorProviderType;
01837 friend class LeafIntersectionIteratorWrapper< const MyType > ;
01838
01839 typedef LeafIntersectionIteratorWrapper<const MyType >
01840 AlbertaGridIntersectionIteratorType;
01841
01842 LeafIntersectionIteratorProviderType & leafIntersetionIteratorProvider() const { return leafInterItProvider_; }
01843
01844 private:
01845 mutable EntityProvider entityProvider_;
01846 mutable LeafIntersectionIteratorProviderType leafInterItProvider_;
01847
01848 public:
01849 template <class IntersectionInterfaceType>
01850 const typename BaseType::
01851 template ReturnImplementationType<IntersectionInterfaceType> :: ImplementationType &
01852 getRealIntersectionIterator(const IntersectionInterfaceType & it) const
01853 {
01854 return this->getRealImplementation(it);
01855 }
01856
01857
01858 template <int codim>
01859 typename SelectEntityImp<codim,dim,const MyType>::EntityObject *
01860 getNewEntity (int level, bool leafIt ) const;
01861
01862
01863 template <int codim>
01864 void freeEntity (typename SelectEntityImp<codim,dim,const MyType>::EntityObject * en) const;
01865
01866 private:
01867
01868
01869
01870
01871 IndexManagerType indexStack_[AlbertHelp::numOfElNumVec];
01872
01873
01874
01875 mutable ALBERTA AlbertHelp::DOFVEC_STACK dofvecs_;
01876
01877 const ALBERTA DOF_ADMIN * elAdmin_;
01878
01879 const ALBERTA REAL_D * coordsVec_;
01880
01881
01882 const int * elNewVec_;
01883
01884
01885 const int nv_;
01886 const int dof_;
01887
01888 public:
01889
01890 void arrangeDofVec();
01891
01892
01893 bool checkElNew ( const ALBERTA EL * el ) const;
01894
01895
01896 const ALBERTA REAL_D & getCoord ( const ALBERTA EL_INFO * elInfo, int vx ) const
01897 {
01898 assert( vx>= 0);
01899 assert( vx < dim+1 );
01900 #ifndef CALC_COORD
01901 assert(coordsVec_);
01902 return coordsVec_[elInfo->el->dof[vx][0]];
01903 #else
01904 return elInfo->coord[vx];
01905 #endif
01906 }
01907
01908
01909 int getLevelOfElement ( const ALBERTA EL * el ) const;
01910
01911
01912 int getElementNumber ( const ALBERTA EL * el ) const;
01913
01914
01915 int getEdgeNumber ( const ALBERTA EL * el, int edge ) const;
01916
01917
01918 int getFaceNumber ( const ALBERTA EL * el, int face ) const;
01919
01920
01921 int getVertexNumber ( const ALBERTA EL * el, int vx ) const;
01922
01923
01924
01925
01926
01927
01928 bool setOwner ( const ALBERTA EL * el , int proc );
01929
01930
01931 int getOwner ( const ALBERTA EL * el ) const;
01932
01933
01934 PartitionType partitionType ( ALBERTA EL_INFO * elinfo) const;
01935
01936 private:
01937
01938
01939
01940 int * ownerVec_;
01941
01942
01943 const int myRank_;
01944
01945
01946 AlbertaGridHierarchicIndexSet<dim,dimworld> hIndexSet_;
01947
01948
01949 IdSetImp globalIdSet_;
01950
01951
01952
01953 mutable std::vector < LevelIndexSetImp * > levelIndexVec_;
01954
01955
01956
01957 mutable LeafIndexSetImp* leafIndexSet_;
01958
01960 std::vector < std::vector< GeometryType > > geomTypes_;
01961
01962
01963 void makeGeomTypes();
01964
01965
01966 std::stack < BOUNDARY * > bndStack_;
01967
01968 typedef SingleTypeSizeCache<MyType> SizeCacheType;
01969 SizeCacheType * sizeCache_;
01970
01971
01972 mutable int coarsenMarked_;
01973 mutable int refineMarked_;
01974
01975 mutable bool lockPostAdapt_;
01976 };
01977
01978
01979 namespace Capabilities
01980 {
01981
01993 template<int dim, int dimw, int cdim>
01994 struct hasEntity<AlbertaGrid<dim,dimw>, cdim >
01995 {
01996 static const bool v = true;
01997 };
01998
02002 template<int dim, int dimw>
02003 struct isLevelwiseConforming< AlbertaGrid<dim,dimw> >
02004 {
02005 static const bool v = false;
02006 };
02007
02011 template<int dim, int dimw>
02012 struct isLeafwiseConforming< AlbertaGrid<dim,dimw> >
02013 {
02014 static const bool v = true;
02015 };
02016
02020 template<int dim, int dimw>
02021 struct hasHangingNodes< AlbertaGrid<dim,dimw> >
02022 {
02023 static const bool v = false;
02024 };
02025
02029 template<int dim, int dimw>
02030 struct hasBackupRestoreFacilities< AlbertaGrid<dim,dimw> >
02031 {
02032 static const bool v = true;
02033 };
02034
02035 }
02036
02037 }
02038
02039 #include "agmemory.hh"
02040 #include "albertagrid.cc"
02041
02042
02043 #undef DIM
02044 #undef DIM_OF_WORLD
02045 #undef CALC_COORD
02046 #include "alberta_undefs.hh"
02047 #endif