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 <cassert>
00009 #include <cstring>
00010 #include <algorithm>
00011
00017
00018 #if defined GRIDDIM && GRIDDIM > 1 && GRIDDIM < 4
00019 #define DIM GRIDDIM
00020 #if defined GRIDDIMWORLD
00021 #define DIM_OF_WORLD GRIDDIMWORLD
00022 #else
00023
00024 #define DIM_OF_WORLD GRIDDIM
00025 #endif
00026 #else
00027 #ifndef ALBERTA_DIM
00028 #error "ALBERTA_DIM needed to compile AlbertaGrid! \n"
00029 #endif
00030
00031 #ifndef ALBERTA_WORLD_DIM
00032 #ifdef ALBERTA_DIM
00033 #define ALBERTA_WORLD_DIM ALBERTA_DIM
00034 #else
00035 #error "ALBERTA_WORLD_DIM needed to compile AlbertaGrid! \n"
00036 #endif
00037 #endif
00038
00039 #define DIM ALBERTA_DIM
00040 #define DIM_OF_WORLD ALBERTA_WORLD_DIM
00041 #endif
00042
00043
00044 #include <dune/common/misc.hh>
00045 #include <dune/common/interfaces.hh>
00046 #include <dune/common/fvector.hh>
00047 #include <dune/common/fmatrix.hh>
00048 #include <dune/grid/common/capabilities.hh>
00049 #include <dune/common/stdstreams.hh>
00050
00051 #if HAVE_MPI
00052 #include <dune/common/mpicollectivecommunication.hh>
00053 #else
00054 #include <dune/common/collectivecommunication.hh>
00055 #endif
00056
00057 #include <dune/common/exceptions.hh>
00058
00059 #include <dune/grid/common/grid.hh>
00060 #include <dune/grid/common/defaultindexsets.hh>
00061 #include <dune/grid/common/sizecache.hh>
00062 #include <dune/grid/common/intersectioniteratorwrapper.hh>
00063
00064
00065 #include <dune/grid/common/indexstack.hh>
00066
00067
00068
00069 #include "albertaheader.hh"
00070
00071
00072 #include <dune/grid/utility/grapedataioformattypes.hh>
00073
00074
00075
00076 typedef Dune::IndexStack<int,10000> IndexManagerType;
00077
00078
00079
00080 #include "albertaextra.hh"
00081
00082 namespace Dune {
00083
00084 class AlbertaError : public Exception {};
00085 class AlbertaIOError : public IOError {};
00086 }
00087
00088
00089 #include "agmemory.hh"
00090
00091 #include "referencetopo.hh"
00092 #include "indexsets.hh"
00093
00094
00095 #include "agcommunicator.hh"
00096
00097 namespace Dune
00098 {
00099
00100
00101 typedef ALBERTA REAL albertCtype;
00102
00103 template<int codim, int dim, class GridImp> class AlbertaGridEntity;
00104 template<int codim, int dim, class GridImp> class AlbertaGridMakeableEntity;
00105 template<int codim, PartitionIteratorType pitype, class GridImp> class AlbertaGridTreeIterator;
00106 template<int codim, PartitionIteratorType pitype, class GridImp> class AlbertaGridLeafIterator;
00107 template<int cd, class GridImp> class AlbertaGridEntityPointer;
00108
00109 template <int mydim, int cdim, class GridImp> class AlbertaGridGeometry;
00110 template<class GridImp> class AlbertaGridHierarchicIterator;
00111 template<class GridImp> class AlbertaGridIntersectionIterator;
00112 template<int dim, int dimworld> class AlbertaGrid;
00113 template<int dim, int dimworld> class AlbertaGridHierarchicIndexSet;
00114
00115 template <int codim, int dim, class GridImp>
00116 struct SelectEntityImp
00117 {
00118 typedef AlbertaGridEntity<codim,dim,GridImp> EntityImp;
00119 typedef Dune::Entity<codim, dim, const GridImp, AlbertaGridEntity> Entity;
00120 typedef MakeableInterfaceObject<Entity> EntityObject;
00121 };
00122
00126 class AlbertaMarkerVector
00127 {
00128 friend class AlbertaGrid<2,2>;
00129 friend class AlbertaGrid<2,3>;
00130 friend class AlbertaGrid<3,3>;
00131
00132 enum { vxBufferSize_ = 10000 };
00133 public:
00136 AlbertaMarkerVector (bool meLevel=true) : up2Date_(false), meLevel_(meLevel) {} ;
00137
00139 bool vertexNotOnElement(const int elIndex, const int vertex) const;
00140
00142 bool edgeNotOnElement(const int elIndex, const int edge) const;
00143
00145 bool faceNotOnElement(const int elIndex, const int face) const;
00146
00148 template <class GridType>
00149 void markNewVertices(GridType &grid, int level);
00150
00152 template <class GridType>
00153 void markNewLeafVertices(GridType &grid);
00154
00156 bool up2Date () const { return up2Date_; }
00157
00159 void unsetUp2Date () { up2Date_ = false; }
00160
00162 void print() const;
00163
00164 private:
00165 typedef std::vector<int> ArrayType;
00166
00167
00168 ArrayType vec_;
00169 ArrayType edgevec_;
00170 ArrayType facevec_;
00171
00172
00173 int numVertex_;
00174
00175
00176 bool up2Date_;
00177 bool meLevel_;
00178 };
00179
00180
00181
00182
00195
00196
00197
00198
00199
00200 template <int mydim, int cdim, class GridImp>
00201 class AlbertaGridGeometry :
00202 public GeometryDefaultImplementation<mydim,cdim,GridImp,AlbertaGridGeometry>
00203 {
00204
00205 typedef AlbertaGridGeometry<mydim,cdim,GridImp> ThisType;
00206
00208 enum { dimbary=mydim+1};
00209 public:
00211 AlbertaGridGeometry();
00212
00214 AlbertaGridGeometry(const int child, const int orientation );
00215
00218 const GeometryType & type () const;
00219
00221 int corners () const;
00222
00224 const FieldVector<albertCtype, cdim> & operator[] (int i) const;
00225
00228 FieldVector<albertCtype, cdim> global (const FieldVector<albertCtype, mydim>& local) const;
00229
00232 FieldVector<albertCtype, mydim> local (const FieldVector<albertCtype, cdim>& global) const;
00233
00235 bool checkInside(const FieldVector<albertCtype, mydim>& local) const;
00236
00260
00261 albertCtype integrationElement (const FieldVector<albertCtype, mydim>& local) const;
00262
00263
00264 albertCtype volume () const;
00265
00270 const FieldMatrix<albertCtype,mydim,mydim>& jacobianInverseTransposed (const FieldVector<albertCtype, mydim>& local) const;
00271
00272
00274
00277 typedef GridImp GridType;
00278 bool builtGeom(const GridImp & grid, ALBERTA EL_INFO *elInfo, int face, int edge, int vertex);
00279
00282 template <class GeometryType, class LocalGeomType >
00283 bool builtLocalGeom(const GeometryType & geo , const LocalGeomType & lg,
00284 ALBERTA EL_INFO *elInfo, int face);
00285
00286
00288 void initGeom();
00289 FieldVector<albertCtype, cdim>& getCoordVec (int i);
00290
00293 void print (std::ostream& ss) const;
00294
00295 private:
00296
00297 void buildGeomInFather(const int child, const int orientation);
00298
00299
00300 void calcElMatrix () const;
00301
00303 void buildJacobianInverseTransposed () const;
00304
00305
00306
00307 int mapVertices (int i) const;
00308
00309
00310 albertCtype elDeterminant () const;
00311
00312
00313 mutable FieldVector<albertCtype, mydim+1> tmpVec_;
00314
00316 mutable FieldMatrix<albertCtype,mydim+1,cdim> coord_;
00317
00319 mutable FieldVector<albertCtype, cdim> globalCoord_;
00320
00322 mutable FieldVector<albertCtype, mydim> localCoord_;
00323
00324
00325 ALBERTA EL_INFO * makeEmptyElInfo();
00326
00327 ALBERTA EL_INFO * elInfo_;
00328
00330 int face_;
00331
00333 int edge_;
00334
00336 int vertex_;
00337
00338 enum { matdim = (mydim > 0) ? mydim : 1 };
00339 mutable FieldMatrix<albertCtype,matdim,matdim> Jinv_;
00340 mutable FieldMatrix<albertCtype,matdim,matdim> Mtmp_;
00341
00342 mutable FieldMatrix<albertCtype,cdim,mydim> elMat_;
00343 mutable FieldMatrix<albertCtype,matdim,matdim> elMatT_elMat_;
00344
00346 mutable bool builtElMat_;
00348 mutable bool builtinverse_;
00349
00350
00351 mutable bool calcedDet_;
00352 mutable albertCtype elDet_;
00353
00354
00355 mutable FieldVector<albertCtype,cdim> tmpV_;
00356 mutable FieldVector<albertCtype,cdim> tmpU_;
00357 mutable FieldVector<albertCtype,cdim> tmpZ_;
00358
00359 mutable FieldVector<albertCtype,mydim> AT_x_;
00360 const GeometryType myGeomType_;
00361 const albertCtype detFactor_;
00362 };
00363
00364
00365
00366
00367
00368
00375 template<int cd, int dim, class GridImp>
00376 class AlbertaGridEntity :
00377 public EntityDefaultImplementation <cd,dim,GridImp,AlbertaGridEntity>
00378 {
00379 enum { dimworld = GridImp::dimensionworld };
00380 friend class AlbertaGrid < dim , dimworld >;
00381 friend class AlbertaGridEntity < 0, dim, GridImp>;
00382 friend class AlbertaGridTreeIterator < cd, All_Partition,GridImp>;
00383 friend class AlbertaGridMakeableEntity<cd,dim,GridImp>;
00384 friend class AlbertaGridEntityPointer<cd,GridImp>;
00385
00386 typedef AlbertaGridGeometry<dim-cd,dimworld,GridImp> GeometryImp;
00387 public:
00388 template <int cc>
00389 struct Codim
00390 {
00391 typedef typename GridImp::template Codim<cc>::EntityPointer EntityPointer;
00392 };
00393
00394 typedef typename GridImp::template Codim<cd>::Entity Entity;
00395 typedef typename GridImp::template Codim<0>::EntityPointer EntityPointer;
00396 typedef typename GridImp::template Codim<cd>::Geometry Geometry;
00397 typedef typename GridImp::template Codim<cd>::LevelIterator LevelIterator;
00398
00400 int level () const;
00401
00403 int boundaryId () const ;
00404
00406 AlbertaGridEntity(const GridImp &grid, int level,
00407 ALBERTA TRAVERSE_STACK * travStack);
00408
00410 AlbertaGridEntity(const GridImp &grid, int level, bool);
00411
00413 AlbertaGridEntity(const AlbertaGridEntity & org);
00414
00416 PartitionType partitionType() const;
00417
00419 const Geometry & geometry () const;
00420
00422 GeometryType type () const;
00423
00424
00425
00426
00428 ALBERTA EL_INFO *getElInfo () const;
00430 ALBERTA EL *getElement () const;
00431
00433 void removeElInfo();
00434
00437 int getFEVnum () const;
00438
00440 bool equals ( const AlbertaGridEntity<cd,dim,GridImp> & i) const;
00441
00442
00443 bool leafIt () const { return false; }
00444
00445
00446 void setTraverseStack (ALBERTA TRAVERSE_STACK *travStack);
00447 void setElInfo (ALBERTA EL_INFO *elInfo, int face,
00448 int edge, int vertex );
00449
00450
00451 void setEntity (const AlbertaGridEntity<cd,dim,GridImp> & org);
00452
00453
00454 void setLevel ( int newLevel );
00455 void setNewLevel ( int newLevel , bool ) { setLevel(level); }
00456
00457 private:
00458
00459 const GridImp &grid_;
00460
00461
00462 ALBERTA EL_INFO *elInfo_;
00463
00464
00465 ALBERTA EL * element_;
00466
00467
00468 ALBERTA TRAVERSE_STACK * travStack_;
00469
00471 int level_;
00472
00473
00474 typedef MakeableInterfaceObject<Geometry> GeometryObject;
00475
00477 GeometryObject geo_;
00479 mutable GeometryImp & geoImp_;
00480
00482 mutable bool builtgeometry_;
00483
00485 mutable FieldVector<albertCtype, dim> localFatherCoords_;
00486 mutable bool localFCoordCalced_;
00487
00489 int face_;
00490
00492 int edge_;
00493
00495 int vertex_;
00496 };
00497
00511
00512
00513
00514
00515
00516
00517 template<int dim, class GridImp>
00518 class AlbertaGridEntity<0,dim,GridImp> :
00519 public EntityDefaultImplementation <0,dim,GridImp,AlbertaGridEntity>
00520 {
00521 enum { dimworld = GridImp::dimensionworld };
00522 friend class AlbertaGrid < dim , GridImp::dimensionworld >;
00523 friend class AlbertaMarkerVector;
00524 friend class AlbertaGridIntersectionIterator <GridImp>;
00525 friend class AlbertaGridHierarchicIterator <GridImp>;
00526 friend class AlbertaGridTreeIterator <0,All_Partition,GridImp>;
00527 friend class AlbertaGridMakeableEntity<0,dim,GridImp>;
00528 friend class AlbertaGridEntityPointer<0,GridImp>;
00529 public:
00530 template <int cd>
00531 struct Codim
00532 {
00533 typedef typename GridImp::template Codim<cd>::EntityPointer EntityPointer;
00534 };
00535
00536 typedef typename GridImp::template Codim<0>::Entity Entity;
00537 typedef typename GridImp::template Codim<0>::Geometry Geometry;
00538 typedef AlbertaGridGeometry<dim,dimworld,GridImp> GeometryImp;
00539
00540 typedef typename GridImp::template Codim<0>::LevelIterator LevelIterator;
00541 typedef typename GridImp::template Codim<0>::HierarchicIterator HierarchicIterator;
00542 typedef typename GridImp::template Codim<0>::EntityPointer EntityPointer;
00543
00544 typedef LeafIntersectionIteratorWrapper<GridImp> AlbertaGridLeafIntersectionIteratorType;
00545 typedef AlbertaGridLeafIntersectionIteratorType AlbertaGridIntersectionIteratorType;
00546 typedef AlbertaGridLeafIntersectionIteratorType AlbertaGridLevelIntersectionIteratorType;
00547
00548 enum { dimension = dim };
00549
00553 ~AlbertaGridEntity() {};
00554
00556 AlbertaGridEntity(const GridImp &grid, int level, bool leafIt );
00557
00558 AlbertaGridEntity(const AlbertaGridEntity & org);
00559
00561 int level () const;
00562
00564 int boundaryId () const;
00565
00567 const Geometry & geometry () const;
00568
00570 GeometryType type () const;
00571
00575
00576 template<int cc> int count () const;
00577
00580 template<int cc> typename Codim<cc>::EntityPointer entity (int i) const;
00581
00584
00585
00591 AlbertaGridLeafIntersectionIteratorType ileafbegin () const;
00592 AlbertaGridIntersectionIteratorType ibegin () const
00593 {
00594 return ileafbegin();
00595 }
00596
00597 AlbertaGridLevelIntersectionIteratorType ilevelbegin () const
00598 {
00599 DUNE_THROW(NotImplemented,"method ilevelbegin not implemented!");
00600 return ileafbegin();
00601 }
00602
00604 AlbertaGridIntersectionIteratorType ileafend () const;
00605 AlbertaGridIntersectionIteratorType iend () const{ return ileafend();}
00606 AlbertaGridLeafIntersectionIteratorType ilevelend () const
00607 {
00608 DUNE_THROW(NotImplemented,"method ilevelend not implemented!");
00609 return ibegin();
00610 }
00611
00613 bool isLeaf () const ;
00614
00617 EntityPointer father () const;
00618
00629 const Geometry & geometryInFather () const;
00630
00635 AlbertaGridHierarchicIterator<GridImp> hbegin (int maxlevel) const;
00636
00638 AlbertaGridHierarchicIterator<GridImp> hend (int maxlevel) const;
00639
00642 bool wasRefined () const ;
00643
00646 bool mightBeCoarsened () const ;
00647
00650 bool hasBoundaryIntersections () const ;
00651
00653 PartitionType partitionType() const;
00654
00656 bool equals ( const AlbertaGridEntity<0,dim,GridImp> & i) const;
00657
00658
00659
00660
00661
00662 void setLeafData( int proc );
00663
00664
00665 bool master() const;
00666
00667
00668 int getFEVnum () const { return 0; }
00669
00670
00671 ALBERTA EL_INFO *getElInfo () const;
00672
00673
00674 ALBERTA EL *getElement () const;
00675
00676
00677 void removeElInfo();
00678
00679
00680 bool leafIt () const { return leafIt_; }
00681
00682
00683
00684 void setTraverseStack (ALBERTA TRAVERSE_STACK *travStack);
00685 void setElInfo (ALBERTA EL_INFO *elInfo,
00686 int face = 0,
00687 int edge = 0,
00688 int vertex = 0 );
00689
00690
00691 void setEntity (const AlbertaGridEntity<0,dim,GridImp> & org);
00692
00693 private:
00695 int nChild () const;
00696
00698 void makeDescription();
00699
00701 const GridImp & grid_;
00702
00704 int level_;
00705
00707 ALBERTA TRAVERSE_STACK * travStack_;
00708
00710 ALBERTA EL_INFO *elInfo_;
00711
00713 ALBERTA EL *element_;
00714
00715
00716 typedef MakeableInterfaceObject<Geometry> GeometryObject;
00717
00719 mutable GeometryObject geoObj_;
00720 mutable GeometryImp & geo_;
00721 mutable bool builtgeometry_;
00722
00723
00724 bool leafIt_;
00725
00726 };
00727
00728
00729
00730
00731
00732
00733
00737 template<int cd, class GridImp>
00738 class AlbertaGridEntityPointer :
00739 public EntityPointerDefaultImplementation <cd, GridImp, AlbertaGridEntityPointer<cd,GridImp> >
00740 {
00741 enum { dim = GridImp::dimension };
00742 enum { dimworld = GridImp::dimensionworld };
00743
00744 friend class AlbertaGridEntity<cd,dim,GridImp>;
00745 friend class AlbertaGridEntity< 0,dim,GridImp>;
00746 friend class AlbertaGrid < dim , dimworld >;
00747
00748 public:
00749 typedef typename GridImp::template Codim<cd>::Entity Entity;
00750 typedef typename SelectEntityImp<cd,dim,GridImp>::EntityImp EntityImp;
00751 typedef typename SelectEntityImp<cd,dim,GridImp>::EntityObject EntityObject;
00752 typedef AlbertaGridEntityPointer<cd,GridImp> Base;
00753
00755 typedef AlbertaGridEntityPointer<cd,GridImp> AlbertaGridEntityPointerType;
00756
00758 AlbertaGridEntityPointer(const GridImp & grid,
00759 int level, ALBERTA EL_INFO *elInfo,int face,int edge,int vertex);
00760
00762 AlbertaGridEntityPointer(const GridImp & grid, ALBERTA TRAVERSE_STACK * stack,
00763 int level, ALBERTA EL_INFO *elInfo,int face,int edge,int vertex);
00764
00766 AlbertaGridEntityPointer(const GridImp & grid, int level , bool isLeaf, bool done);
00767
00769 AlbertaGridEntityPointer(const AlbertaGridEntityPointerType & org);
00770
00772 AlbertaGridEntityPointer(const GridImp & , const EntityImp & en);
00773
00775 AlbertaGridEntityPointer& operator= (const AlbertaGridEntityPointer& org);
00776
00778 ~AlbertaGridEntityPointer();
00779
00781 bool equals (const AlbertaGridEntityPointerType& i) const;
00782
00784 Entity & dereference () const ;
00785
00787 int level () const ;
00788
00790 void done ();
00791
00792 protected:
00794 bool leafIt () const { return isLeaf_; }
00795
00797 EntityImp & entityImp ();
00798
00800 const EntityImp & entityImp () const;
00801
00802
00803 const GridImp & grid_;
00804
00806 bool isLeaf_;
00807
00808
00809 EntityObject * entity_;
00810 };
00811
00812
00813
00814
00815
00816
00826 template<class GridImp>
00827 class AlbertaGridHierarchicIterator :
00828 public AlbertaGridEntityPointer<0,GridImp> ,
00829 public HierarchicIteratorDefaultImplementation <GridImp,AlbertaGridHierarchicIterator>
00830 {
00831 public:
00832 typedef typename GridImp::template Codim<0>::Entity Entity;
00833 typedef typename GridImp::ctype ctype;
00834
00835
00836 typedef typename SelectEntityImp<0,GridImp::dimension,GridImp>::EntityImp EntityImp;
00837
00839 AlbertaGridHierarchicIterator(const GridImp &grid,
00840 ALBERTA TRAVERSE_STACK *travStack,
00841 int actLevel, int maxLevel, bool leafIt );
00842
00844 AlbertaGridHierarchicIterator(const GridImp &grid,
00845 int actLevel,int maxLevel);
00846
00848 AlbertaGridHierarchicIterator(const AlbertaGridHierarchicIterator<GridImp> &org);
00849
00851 AlbertaGridHierarchicIterator<GridImp> & operator = (const AlbertaGridHierarchicIterator<GridImp> &org);
00852
00854 void increment();
00855
00856 private:
00857 const int startLevel_;
00858
00860 int level_;
00861
00863 int maxlevel_;
00864
00866 EntityImp & virtualEntity_;
00867
00870 ALBERTA ManageTravStack manageStack_;
00871
00873 bool end_;
00874
00876 ALBERTA EL_INFO * recursiveTraverse(ALBERTA TRAVERSE_STACK * stack);
00877
00879 ALBERTA EL_INFO * firstChild(ALBERTA TRAVERSE_STACK * stack);
00880
00882 void makeIterator();
00883 };
00884
00885
00886
00887
00888
00889
00897 template<class GridImp>
00898 class AlbertaGridIntersectionIterator :
00899
00900 public IntersectionIteratorDefaultImplementation <GridImp,AlbertaGridIntersectionIterator>
00901 {
00902 enum { dim = GridImp::dimension };
00903 enum { dimworld = GridImp::dimensionworld };
00904
00905 friend class AlbertaGridEntity<0,dim,GridImp>;
00906 typedef AlbertaGridIntersectionIterator<GridImp> ThisType;
00907 public:
00908 typedef AGMemoryProvider< ThisType > StorageType;
00909 typedef typename GridImp::template Codim<0>::Entity Entity;
00910 typedef typename GridImp::template Codim<1>::Geometry Geometry;
00911 typedef typename GridImp::template Codim<1>::LocalGeometry LocalGeometry;
00912
00913 typedef typename SelectEntityImp<0,dim,GridImp>::EntityImp EntityImp;
00914
00915
00916 typedef AlbertaGridGeometry<dim-1,dimworld,GridImp> LocalGeometryImp;
00917 typedef typename GridImp::template Codim<0>::EntityPointer EntityPointer;
00918
00920 enum { dimension=dim };
00922 enum { dimensionworld=dimworld };
00924 typedef typename GridImp::ctype ctype;
00925
00927 bool equals (const AlbertaGridIntersectionIterator<GridImp> & i) const;
00928
00930 void increment();
00931
00933 bool operator==(const AlbertaGridIntersectionIterator<GridImp>& i) const;
00934
00936 EntityPointer outside() const;
00937
00939 EntityPointer inside() const;
00940
00942 AlbertaGridIntersectionIterator(const GridImp & grid,
00943 int level);
00944
00946 AlbertaGridIntersectionIterator(const GridImp & grid,
00947 int level,
00948 ALBERTA EL_INFO *elInfo,
00949 bool leafIt );
00951 AlbertaGridIntersectionIterator(const AlbertaGridIntersectionIterator<GridImp> & org);
00952
00954 void assign (const AlbertaGridIntersectionIterator<GridImp> & org);
00955
00957
00958
00960 bool boundary () const;
00961
00963 bool neighbor () const;
00964
00966 int boundaryId () const;
00967
00972 const LocalGeometry& intersectionSelfLocal () const;
00976 const LocalGeometry& intersectionNeighborLocal () const;
00980 const Geometry& intersectionGlobal () const;
00981
00983 int numberInSelf () const;
00985 int numberInNeighbor () const;
00986
00988 int twistInSelf() const;
00989
00991 int twistInNeighbor() const;
00992
00995 typedef FieldVector<albertCtype, GridImp::dimensionworld> NormalVecType;
00996 typedef FieldVector<albertCtype, GridImp::dimension-1> LocalCoordType;
00997
00998 const NormalVecType & unitOuterNormal (const LocalCoordType & local) const;
00999
01002 const NormalVecType & outerNormal (const LocalCoordType & local) const;
01003
01006 const NormalVecType & integrationOuterNormal (const LocalCoordType & local) const;
01007
01009 int level () const;
01010
01011
01012
01013
01014
01015
01016 template <class EntityType>
01017 void first(const EntityType & en, int level );
01018
01019
01020 void done ();
01021
01022 private:
01023
01024 bool neighborHasSameLevel () const;
01025
01027 void makeBegin (const GridImp & grid,
01028 int level,
01029 ALBERTA EL_INFO * elInfo ) const;
01030
01032 void makeEnd (const GridImp & grid,int level ) const;
01033
01034
01035 void freeObjects () const;
01036
01038 void setupVirtEn () const;
01039
01041 void calcOuterNormal () const;
01042
01043
01044
01045 bool leafIt () const { return leafIt_; }
01047
01049
01051 const GridImp& grid_;
01052
01054 mutable int level_;
01055
01057 mutable int neighborCount_;
01058
01062 mutable bool builtNeigh_;
01063
01064 bool leafIt_;
01065
01067 mutable ALBERTA EL_INFO * elInfo_;
01068
01069 typedef MakeableInterfaceObject<LocalGeometry> LocalGeometryObject;
01070
01071
01072 mutable LocalGeometryObject fakeNeighObj_;
01073 mutable LocalGeometryObject fakeSelfObj_;
01074 mutable LocalGeometryObject neighGlobObj_;
01075
01078 mutable LocalGeometryImp & fakeNeigh_;
01081 mutable LocalGeometryImp & fakeSelf_;
01084 mutable LocalGeometryImp & neighGlob_;
01085
01087 mutable ALBERTA EL_INFO neighElInfo_;
01088
01089 mutable NormalVecType outNormal_;
01090 mutable NormalVecType unitNormal_;
01091
01092
01093 mutable FieldVector<albertCtype, dimworld> tmpU_;
01094 mutable FieldVector<albertCtype, dimworld> tmpV_;
01095
01096
01097 mutable int twist_;
01098
01100 bool done_;
01101 };
01102
01103
01104
01105
01106
01107
01108
01109
01110
01111
01112
01113
01114 namespace AlbertaTreeIteratorHelp {
01115 template <class IteratorImp, int dim, int codim>
01116 struct GoNextEntity;
01117 }
01118
01122 template<int cd, PartitionIteratorType pitype, class GridImp>
01123 class AlbertaGridTreeIterator :
01124 public AlbertaGridEntityPointer<cd,GridImp>
01125 {
01126 enum { dim = GridImp::dimension };
01127 friend class AlbertaGridEntity<2,dim,GridImp>;
01128 friend class AlbertaGridEntity<1,dim,GridImp>;
01129 friend class AlbertaGridEntity<0,dim,GridImp>;
01130 friend class AlbertaGrid < dim , GridImp::dimensionworld >;
01131
01132
01133 typedef AlbertaGridTreeIterator<cd,pitype,GridImp> AlbertaGridTreeIteratorType;
01134 typedef AlbertaGridTreeIteratorType ThisType;
01135 friend class AlbertaTreeIteratorHelp::GoNextEntity<ThisType,dim,cd>;
01136 public:
01137
01138 typedef typename GridImp::template Codim<cd>::Entity Entity;
01139 typedef typename SelectEntityImp<cd,dim,GridImp>::EntityImp EntityImp;
01140
01141
01143 AlbertaGridTreeIterator(const AlbertaGridTreeIterator<cd,pitype,GridImp> & org );
01144
01146 AlbertaGridTreeIterator<cd,pitype,GridImp> & operator = (const AlbertaGridTreeIterator<cd,pitype,GridImp> & org );
01147
01149 AlbertaGridTreeIterator(const GridImp & grid, int
01150 travLevel, int proc, bool leafIt=false );
01151
01153 AlbertaGridTreeIterator(const GridImp & grid,
01154 const AlbertaMarkerVector * vec,
01155 int travLevel,
01156 int proc,
01157 bool leafIt=false);
01158
01160 void increment();
01162
01163 private:
01164
01165 void makeIterator();
01166
01167 ALBERTA EL_INFO * goFirstElement(ALBERTA TRAVERSE_STACK *stack,
01168 ALBERTA MESH *mesh,
01169 int level, ALBERTA FLAGS fill_flag);
01170 ALBERTA EL_INFO * traverseElLevel(ALBERTA TRAVERSE_STACK * stack);
01171 ALBERTA EL_INFO * traverseElLevelInteriorBorder(ALBERTA TRAVERSE_STACK * stack);
01172 ALBERTA EL_INFO * traverseElLevelGhosts(ALBERTA TRAVERSE_STACK * stack);
01173
01174
01175
01176 ALBERTA EL_INFO * goNextEntity(ALBERTA TRAVERSE_STACK *stack,ALBERTA EL_INFO *elinfo_old);
01177
01178
01179 ALBERTA EL_INFO * goNextElInfo(ALBERTA TRAVERSE_STACK *stack,ALBERTA EL_INFO *elinfo_old);
01180 ALBERTA EL_INFO * goNextFace(ALBERTA TRAVERSE_STACK *stack,
01181 ALBERTA EL_INFO *elInfo);
01182 ALBERTA EL_INFO * goNextEdge(ALBERTA TRAVERSE_STACK *stack,
01183 ALBERTA EL_INFO *elInfo);
01184 ALBERTA EL_INFO * goNextVertex(ALBERTA TRAVERSE_STACK *stack,
01185 ALBERTA EL_INFO *elInfo);
01186
01187
01188 ALBERTA MACRO_EL * nextGhostMacro(ALBERTA MACRO_EL *mel);
01189
01191 int level_;
01192
01194 int enLevel_;
01195
01197 EntityImp & virtualEntity_;
01198
01199
01200 ALBERTA ManageTravStack manageStack_;
01201
01203 int face_;
01204 int edge_;
01205 int vertex_;
01206
01207
01208 const AlbertaMarkerVector * vertexMarker_;
01209
01210
01211 bool okReturn_;
01212
01213
01214
01215
01216 const int proc_;
01217 };
01218
01221 template<int cd, PartitionIteratorType pitype, class GridImp>
01222 class AlbertaGridLevelIterator :
01223 public AlbertaGridTreeIterator<cd,pitype,GridImp> ,
01224 public LevelIteratorDefaultImplementation <cd,pitype,GridImp,AlbertaGridLevelIterator>
01225 {
01226 public:
01227 typedef typename GridImp::template Codim<cd>::Entity Entity;
01228
01230 AlbertaGridLevelIterator(const GridImp & grid, int level, int proc) :
01231 AlbertaGridTreeIterator<cd,pitype,GridImp> (grid,level,proc)
01232 {
01233 }
01234
01236 AlbertaGridLevelIterator(const GridImp & grid,
01237 const AlbertaMarkerVector * vec, int level, int proc) :
01238 AlbertaGridTreeIterator<cd,pitype,GridImp> (grid,vec,level,proc)
01239 {
01240 }
01241
01243 void increment ()
01244 {
01245 AlbertaGridTreeIterator<cd,pitype,GridImp>::increment();
01246 }
01247 };
01248
01249
01250
01251
01252
01253
01254
01256 template<int codim, PartitionIteratorType pitype, class GridImp>
01257 class AlbertaGridLeafIterator :
01258 public AlbertaGridTreeIterator<codim, pitype, GridImp>,
01259 public LeafIteratorDefaultImplementation<codim, pitype, GridImp, AlbertaGridLeafIterator>
01260 {
01261 public:
01262 typedef typename GridImp::template Codim<codim>::Entity Entity;
01263
01265 AlbertaGridLeafIterator(const GridImp & grid, int level, int proc) :
01266 AlbertaGridTreeIterator<codim,pitype,GridImp> (grid,level,proc,true)
01267 {
01268 }
01269
01271 AlbertaGridLeafIterator(const GridImp & grid,
01272 const AlbertaMarkerVector * vec, int level, int proc) :
01273 AlbertaGridTreeIterator<codim, pitype, GridImp> (grid,vec,level,proc,true)
01274 {
01275 }
01276
01278 void increment ()
01279 {
01280 AlbertaGridTreeIterator<codim, pitype, GridImp>::increment();
01281 }
01282 };
01283
01284
01285
01286
01287
01288
01289
01290
01291 template <int dim, int dimworld>
01292 struct AlbertaGridFamily
01293 {
01294 typedef AlbertaGrid<dim,dimworld> GridImp;
01295
01296 typedef DefaultLevelIndexSet< AlbertaGrid<dim,dimworld> > LevelIndexSetImp;
01297 typedef DefaultLeafIndexSet< AlbertaGrid<dim,dimworld> > LeafIndexSetImp;
01298
01299 typedef AlbertaGridIdSet<dim,dimworld> IdSetImp;
01300 typedef int IdType;
01301
01302 struct Traits
01303 {
01304 typedef GridImp Grid;
01305
01306 typedef Dune::IntersectionIterator<const GridImp, LeafIntersectionIteratorWrapper > LeafIntersectionIterator;
01307
01308 typedef Dune::IntersectionIterator<const GridImp, LeafIntersectionIteratorWrapper > LeafIntersection;
01309 typedef Dune::IntersectionIterator<const GridImp, LeafIntersectionIteratorWrapper > LevelIntersectionIterator;
01310
01311 typedef Dune::IntersectionIterator<const GridImp, LeafIntersectionIteratorWrapper > LevelIntersection;
01312
01313 typedef Dune::HierarchicIterator<const GridImp, AlbertaGridHierarchicIterator> HierarchicIterator;
01314
01315 typedef IdType GlobalIdType;
01316 typedef IdType LocalIdType;
01317
01318 template <int cd>
01319 struct Codim
01320 {
01321
01322 typedef Dune::Geometry<dim-cd, dimworld, const GridImp, AlbertaGridGeometry> Geometry;
01323 typedef Dune::Geometry<dim-cd, dim, const GridImp, AlbertaGridGeometry> LocalGeometry;
01324
01325
01326 typedef typename SelectEntityImp<cd,dim,GridImp>::Entity Entity;
01327
01328 typedef Dune::LevelIterator<cd,All_Partition,const GridImp,AlbertaGridLevelIterator> LevelIterator;
01329
01330 typedef Dune::LeafIterator<cd,All_Partition,const GridImp,AlbertaGridLeafIterator> LeafIterator;
01331
01332 typedef Dune::EntityPointer<const GridImp,AlbertaGridEntityPointer<cd,const GridImp> > EntityPointer;
01333
01334 template <PartitionIteratorType pitype>
01335 struct Partition
01336 {
01337 typedef Dune::LevelIterator<cd,pitype,const GridImp,AlbertaGridLevelIterator> LevelIterator;
01338 typedef Dune::LeafIterator<cd,pitype,const GridImp,AlbertaGridLeafIterator> LeafIterator;
01339 };
01340
01341 };
01342
01343 typedef IndexSet<GridImp,LevelIndexSetImp,DefaultLevelIteratorTypes<GridImp> > LevelIndexSet;
01344 typedef IndexSet<GridImp,LeafIndexSetImp,DefaultLeafIteratorTypes<GridImp> > LeafIndexSet;
01345 typedef IdSet<GridImp,IdSetImp,IdType> GlobalIdSet;
01346 typedef IdSet<GridImp,IdSetImp,IdType> LocalIdSet;
01347
01348
01349
01350
01351
01352
01353 typedef Dune :: CollectiveCommunication<GridImp> CollectiveCommunication;
01354
01355 };
01356 };
01357
01403 template <int dim, int dimworld>
01404 class AlbertaGrid :
01405 public GridDefaultImplementation <dim,dimworld,albertCtype, AlbertaGridFamily<dim,dimworld> >,
01406 public HasObjectStream ,
01407 public HasHierarchicIndexSet
01408 {
01409 friend class AlbertaGridEntity <0,dim,const AlbertaGrid<dim,dimworld> >;
01410 friend class AlbertaGridEntity <1,dim,const AlbertaGrid<dim,dimworld> >;
01411 friend class AlbertaGridEntity <2,dim,const AlbertaGrid<dim,dimworld> >;
01412 friend class AlbertaGridEntity <dim,dim,const AlbertaGrid<dim,dimworld> >;
01413
01414 friend class AlbertaGridEntityPointer <0,const AlbertaGrid<dim,dimworld> >;
01415 friend class AlbertaGridEntityPointer <1,const AlbertaGrid<dim,dimworld> >;
01416 friend class AlbertaGridEntityPointer <2,const AlbertaGrid<dim,dimworld> >;
01417 friend class AlbertaGridEntityPointer <3,const AlbertaGrid<dim,dimworld> >;
01418
01419
01420 friend class AlbertaGridTreeIterator<0,All_Partition,AlbertaGrid<dim,dimworld> >;
01421 friend class AlbertaGridTreeIterator<1,All_Partition,AlbertaGrid<dim,dimworld> >;
01422 friend class AlbertaGridTreeIterator<2,All_Partition,AlbertaGrid<dim,dimworld> >;
01423 friend class AlbertaGridTreeIterator<3,All_Partition,AlbertaGrid<dim,dimworld> >;
01424
01425 friend class AlbertaGridHierarchicIterator<AlbertaGrid<dim,dimworld> >;
01426
01427 friend class AlbertaGridIntersectionIterator<AlbertaGrid<dim,dimworld> >;
01428 friend class AlbertaGridIntersectionIterator<const AlbertaGrid<dim,dimworld> >;
01429
01432
01433
01434 typedef AlbertaGrid<dim,dimworld> MyType;
01435
01436 friend class AlbertaMarkerVector;
01437 friend class AlbertaGridHierarchicIndexSet<dim,dimworld>;
01438
01439
01440 enum { defaultElementChunk_ = 100 };
01441
01442
01443
01444
01445 public:
01447 typedef AlbertaGridFamily<dim,dimworld> GridFamily;
01448 typedef GridDefaultImplementation <dim,dimworld,albertCtype,
01449 AlbertaGridFamily<dim,dimworld> > BaseType;
01450
01452 typedef typename AlbertaGridFamily<dim,dimworld> :: Traits Traits;
01453
01455 typedef AlbertaGridHierarchicIndexSet<dim,dimworld> HierarchicIndexSet;
01456
01457 private:
01459 typedef typename Traits:: CollectiveCommunication CollectiveCommunicationType;
01460
01462 typedef typename Traits::template Codim<0>::LeafIterator LeafIterator;
01463
01465 typedef typename GridFamily:: LevelIndexSetImp LevelIndexSetImp;
01466 typedef typename GridFamily:: LeafIndexSetImp LeafIndexSetImp;
01467
01469 typedef typename Traits :: LeafIndexSet LeafIndexSet;
01470
01472 typedef AlbertaGridIdSet<dim,dimworld> IdSetImp;
01473 typedef typename Traits :: GlobalIdSet GlobalIdSet;
01474 typedef typename Traits :: LocalIdSet LocalIdSet;
01475
01476 public:
01478 typedef typename ALBERTA AlbertHelp::AlbertLeafData<dimworld,dim+1> LeafDataType;
01479
01480 typedef ObjectStream ObjectStreamType;
01481
01482 enum {
01484 numCodim = dim+1 };
01485
01486 enum {
01488 MAXL = 64 };
01489
01490
01491
01492
01493
01494
01496 AlbertaGrid(const std::string macroTriangFilename);
01497
01498
01499
01500
01501
01502
01503
01504
01505
01506
01508 AlbertaGrid();
01509
01511 ~AlbertaGrid();
01512
01515 int maxLevel() const;
01516
01518 template<int cd, PartitionIteratorType pitype>
01519 typename Traits::template Codim<cd>::template Partition<pitype>::LevelIterator
01520 lbegin (int level) const;
01521
01523 template<int cd, PartitionIteratorType pitype>
01524 typename Traits::template Codim<cd>::template Partition<pitype>::LevelIterator
01525 lend (int level) const;
01526
01528 template<int cd> typename Traits::template Codim<cd>::
01529 template Partition<All_Partition>::LevelIterator
01530 lbegin (int level) const;
01531
01533 template<int cd> typename Traits::template Codim<cd>::
01534 template Partition<All_Partition>::LevelIterator
01535 lend (int level) const;
01536
01538 template <int codim, PartitionIteratorType pitype>
01539 typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
01540 leafbegin () const;
01541
01543 template <int codim>
01544 typename Traits::template Codim<codim>::LeafIterator
01545 leafbegin () const;
01546
01548 template <int codim, PartitionIteratorType pitype>
01549 typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
01550 leafend () const;
01551
01553 template <int codim>
01554 typename Traits::template Codim<codim>::LeafIterator
01555 leafend () const;
01556
01557 private:
01559 template <int codim, PartitionIteratorType pitype>
01560 typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
01561 leafbegin ( int maxlevel, int proc = -1 ) const;
01562
01564 template <int codim>
01565 typename Traits::template Codim<codim>::LeafIterator
01566 leafbegin ( int maxlevel, int proc = -1 ) const;
01567
01569 template <int codim, PartitionIteratorType pitype>
01570 typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
01571 leafend ( int maxlevel, int proc = -1 ) const;
01572
01574 template <int codim>
01575 typename Traits::template Codim<codim>::LeafIterator
01576 leafend ( int maxlevel, int proc = -1 ) const;
01577
01579 LeafIterator leafbegin ( int maxlevel, int proc = -1 ) const;
01580
01582 LeafIterator leafend ( int maxlevel, int proc = -1 ) const;
01583
01585 LeafIterator leafbegin () const;
01586
01588 LeafIterator leafend () const;
01589
01590 public:
01595 int size (int level, int codim) const;
01596
01598 int size (int level, GeometryType type) const;
01599
01601 int size (int codim) const;
01602
01604 int size (GeometryType type) const;
01605
01606 public:
01607
01608
01609
01616 bool mark( int refCount , const typename Traits::template Codim<0>::EntityPointer & en ) const;
01617
01619 int getMark( const typename Traits::template Codim<0>::EntityPointer & ) const;
01620 private:
01621 bool mark( int refCount , const typename Traits::template Codim<0>::Entity & en ) const;
01622
01623 public:
01625 bool globalRefine(int refCount);
01626
01630 bool adapt ( );
01631
01633 template <class DofManagerType, class RestrictProlongOperatorType>
01634 bool adapt (DofManagerType &, RestrictProlongOperatorType &, bool verbose=false );
01635
01637 bool preAdapt ();
01638
01640 bool postAdapt();
01641
01644 const CollectiveCommunicationType & comm () const
01645 {
01646 return comm_;
01647 }
01648
01650 std::string name () const { return "AlbertaGrid"; };
01651
01652
01653
01654
01656 template <GrapeIOFileFormatType ftype>
01657 bool writeGrid( const std::basic_string<char> filename, albertCtype time ) const;
01658
01660 template <GrapeIOFileFormatType ftype>
01661 bool readGrid( const std::basic_string<char> filename, albertCtype & time );
01662
01663
01664
01665
01666
01667
01668 int global_size (int codim) const;
01669
01670
01671 int myRank () const { return myRank_; };
01672
01674 void setNewCoords(const FieldVector<albertCtype, dimworld> & trans, const albertCtype scalar);
01675
01676
01677 const HierarchicIndexSet & hierarchicIndexSet () const { return hIndexSet_; }
01678
01680 const typename Traits :: LevelIndexSet & levelIndexSet (int level) const;
01681
01683 const typename Traits :: LeafIndexSet & leafIndexSet () const;
01684
01686 const GlobalIdSet & globalIdSet () const { return globalIdSet_; }
01687
01689 const LocalIdSet & localIdSet () const { return globalIdSet_; }
01690
01691
01692 ALBERTA MESH* getMesh () const { return mesh_; };
01693
01694
01695 template <int cd>
01696 AlbertaGridEntity<cd,dim,const AlbertaGrid<dim,dimworld> >&
01697 getRealEntity(typename Traits::template Codim<cd>::Entity& entity)
01698 {
01699 return this->getRealImplementation(entity);
01700 }
01701
01702 private:
01704 template <int cd>
01705 const AlbertaGridEntity<cd,dim,const AlbertaGrid<dim,dimworld> >&
01706 getRealEntity(const typename Traits::template Codim<cd>::Entity& entity) const
01707 {
01708 return this->getRealImplementation(entity);
01709 }
01710
01711 public:
01712
01713 void createGhosts ();
01714
01715
01716 template <class EntityType>
01717 int owner (const EntityType & ) const;
01718
01719
01720
01721 template <class EntityType>
01722 bool partition( int proc , EntityType & );
01723
01724
01725 void unpackAll ( ObjectStreamType & os );
01726
01727
01728 template <class EntityType>
01729 void packAll ( ObjectStreamType & os, EntityType & en );
01730
01731
01732 template <class EntityType>
01733 void packBorder ( ObjectStreamType & os, EntityType & en );
01734
01735
01736 bool isGhost( const ALBERTA MACRO_EL * mel) const;
01737
01738
01739 bool isNoElement( const ALBERTA MACRO_EL * mel) const;
01740
01742 const std::vector < GeometryType > & geomTypes (int codim) const
01743 {
01744 assert( codim >= 0 );
01745 assert( codim < dim+1 );
01746 return geomTypes_[codim];
01747 }
01748
01749 private:
01750 friend class Conversion<AlbertaGrid<dim, dimworld>, HasObjectStream>;
01751 friend class Conversion<const AlbertaGrid<dim, dimworld>, HasObjectStream>;
01752
01753 friend class Conversion<AlbertaGrid<dim, dimworld>, HasHierarchicIndexSet >;
01754 friend class Conversion<const AlbertaGrid<dim, dimworld>, HasHierarchicIndexSet>;
01755
01756
01757 AlbertaGrid(const MyType& other);
01758
01759 MyType& operator=(const MyType& other);
01760
01761 private:
01762 typedef std::vector<int> ArrayType;
01763
01764 ArrayType ghostFlag_;
01765
01766
01767 void initGrid(int proc);
01768
01769
01770
01771 void calcExtras();
01772
01773
01774 bool writeGridXdr ( const std::basic_string<char> filename, albertCtype time ) const;
01775
01777 bool readGridXdr ( const std::basic_string<char> filename, albertCtype & time );
01778
01780 bool readGridAscii ( const std::basic_string<char> filename, albertCtype & time );
01781
01782
01783 void removeMesh();
01784
01785
01786 ALBERTA MESH *mesh_;
01787
01788
01789 CollectiveCommunicationType comm_;
01790
01791
01792 int maxlevel_;
01793
01794
01795 bool wasChanged_;
01796
01797
01798 mutable ArrayType macroVertices_;
01799
01800 public:
01801
01802
01803
01804
01805 void fillElInfo(int ichild, int actLevel ,const ALBERTA EL_INFO *elinfo_old,
01806 ALBERTA EL_INFO *elinfo, bool hierachical, bool leaf=false ) const;
01807
01808
01809 void firstNeigh(const int ichild,const ALBERTA EL_INFO *elinfo_old,
01810 ALBERTA EL_INFO *elinfo, const bool leafLevel) const;
01811
01812
01813 void secondNeigh(const int ichild, const ALBERTA EL_INFO *elinfo_old,
01814 ALBERTA EL_INFO *elinfo, const bool leafLevel) const;
01815
01816
01817 void thirdNeigh(const int ichild, const ALBERTA EL_INFO *elinfo_old,
01818 ALBERTA EL_INFO *elinfo, const bool leafLevel) const;
01819
01820 private:
01821
01822 mutable AlbertaMarkerVector vertexMarkerLeaf_;
01823
01824
01825 mutable AlbertaMarkerVector vertexMarkerLevel_[MAXL];
01826
01827
01828
01829
01830 typedef typename SelectEntityImp<0,dim,const MyType>::EntityObject EntityObject;
01831
01832 public:
01833 typedef AGMemoryProvider< EntityObject > EntityProvider;
01834
01835 typedef AlbertaGridIntersectionIterator< const MyType > IntersectionIteratorImp;
01836 typedef IntersectionIteratorImp LeafIntersectionIteratorImp;
01837 typedef AGMemoryProvider< LeafIntersectionIteratorImp > LeafIntersectionIteratorProviderType;
01838 friend class LeafIntersectionIteratorWrapper< const MyType > ;
01839
01840 typedef LeafIntersectionIteratorWrapper<const MyType >
01841 AlbertaGridIntersectionIteratorType;
01842
01843 LeafIntersectionIteratorProviderType & leafIntersetionIteratorProvider() const { return leafInterItProvider_; }
01844
01845 private:
01846 mutable EntityProvider entityProvider_;
01847 mutable LeafIntersectionIteratorProviderType leafInterItProvider_;
01848
01849 public:
01850 template <class IntersectionInterfaceType>
01851 const typename BaseType::
01852 template ReturnImplementationType<IntersectionInterfaceType> :: ImplementationType &
01853 getRealIntersectionIterator(const IntersectionInterfaceType & it) const
01854 {
01855 return this->getRealImplementation(it);
01856 }
01857
01858
01859 template <int codim>
01860 typename SelectEntityImp<codim,dim,const MyType>::EntityObject *
01861 getNewEntity (int level, bool leafIt ) const;
01862
01863
01864 template <int codim>
01865 void freeEntity (typename SelectEntityImp<codim,dim,const MyType>::EntityObject * en) const;
01866
01867 private:
01868
01869
01870
01871
01872 IndexManagerType indexStack_[AlbertHelp::numOfElNumVec];
01873
01874
01875
01876 mutable ALBERTA AlbertHelp::DOFVEC_STACK dofvecs_;
01877
01878 const ALBERTA DOF_ADMIN * elAdmin_;
01879
01880 const ALBERTA REAL_D * coordsVec_;
01881
01882
01883 const int * elNewVec_;
01884
01885
01886 const int nv_;
01887 const int dof_;
01888
01889 public:
01890
01891 void arrangeDofVec();
01892
01893
01894 bool checkElNew ( const ALBERTA EL * el ) const;
01895
01896
01897 const ALBERTA REAL_D & getCoord ( const ALBERTA EL_INFO * elInfo, int vx ) const
01898 {
01899 assert( vx>= 0);
01900 assert( vx < dim+1 );
01901 #ifndef CALC_COORD
01902 assert(coordsVec_);
01903 return coordsVec_[elInfo->el->dof[vx][0]];
01904 #else
01905 return elInfo->coord[vx];
01906 #endif
01907 }
01908
01909
01910 int getLevelOfElement ( const ALBERTA EL * el ) const;
01911
01912
01913 int getElementNumber ( const ALBERTA EL * el ) const;
01914
01915
01916 int getEdgeNumber ( const ALBERTA EL * el, int edge ) const;
01917
01918
01919 int getFaceNumber ( const ALBERTA EL * el, int face ) const;
01920
01921
01922 int getVertexNumber ( const ALBERTA EL * el, int vx ) const;
01923
01924
01925
01926
01927
01928
01929 bool setOwner ( const ALBERTA EL * el , int proc );
01930
01931
01932 int getOwner ( const ALBERTA EL * el ) const;
01933
01934
01935 PartitionType partitionType ( ALBERTA EL_INFO * elinfo) const;
01936
01937 private:
01938
01939
01940
01941 int * ownerVec_;
01942
01943
01944 const int myRank_;
01945
01946
01947 AlbertaGridHierarchicIndexSet<dim,dimworld> hIndexSet_;
01948
01949
01950 IdSetImp globalIdSet_;
01951
01952
01953
01954 mutable std::vector < LevelIndexSetImp * > levelIndexVec_;
01955
01956
01957
01958 mutable LeafIndexSetImp* leafIndexSet_;
01959
01961 std::vector < std::vector< GeometryType > > geomTypes_;
01962
01963
01964 void makeGeomTypes();
01965
01966
01967 std::stack < BOUNDARY * > bndStack_;
01968
01969 typedef SingleTypeSizeCache<MyType> SizeCacheType;
01970 SizeCacheType * sizeCache_;
01971
01972
01973 mutable int coarsenMarked_;
01974 mutable int refineMarked_;
01975
01976 mutable bool lockPostAdapt_;
01977 };
01978
01979
01980 namespace Capabilities
01981 {
01982
01994 template<int dim, int dimw, int cdim>
01995 struct hasEntity<AlbertaGrid<dim,dimw>, cdim >
01996 {
01997 static const bool v = true;
01998 };
01999
02003 template<int dim, int dimw>
02004 struct isLevelwiseConforming< AlbertaGrid<dim,dimw> >
02005 {
02006 static const bool v = false;
02007 };
02008
02012 template<int dim, int dimw>
02013 struct isLeafwiseConforming< AlbertaGrid<dim,dimw> >
02014 {
02015 static const bool v = true;
02016 };
02017
02021 template<int dim, int dimw>
02022 struct hasHangingNodes< AlbertaGrid<dim,dimw> >
02023 {
02024 static const bool v = false;
02025 };
02026
02030 template<int dim, int dimw>
02031 struct hasBackupRestoreFacilities< AlbertaGrid<dim,dimw> >
02032 {
02033 static const bool v = true;
02034 };
02035
02036 }
02037
02038 }
02039
02040 #include "agmemory.hh"
02041 #include "albertagrid.cc"
02042
02043
02044 #undef DIM
02045 #undef DIM_OF_WORLD
02046 #undef CALC_COORD
02047 #include "alberta_undefs.hh"
02048 #endif