dune-alugrid 3.0.0
3d/grid.hh
Go to the documentation of this file.
1#ifndef DUNE_ALU3DGRIDGRID_HH
2#define DUNE_ALU3DGRIDGRID_HH
3
4//- System includes
5#include <memory>
6#include <vector>
7
8//- Dune includes
9#include <dune/grid/common/capabilities.hh>
11#include <dune/common/bigunsignedint.hh>
12#include <dune/common/version.hh>
13
14#include <dune/geometry/referenceelements.hh>
15
16#include <dune/grid/common/grid.hh>
18#include <dune/grid/common/sizecache.hh>
20#include <dune/grid/common/datahandleif.hh>
21
23
24// bnd projection stuff
25#include <dune/grid/common/boundaryprojection.hh>
30
31//- Local includes
32#include "alu3dinclude.hh"
33#include "topology.hh"
34#include "indexsets.hh"
35#include "datahandle.hh"
36
39
40#include <dune/common/parallel/mpihelper.hh>
41
42#if ALU3DGRID_PARALLEL
43#include <dune/common/parallel/mpicollectivecommunication.hh>
44#else
45#include <dune/common/parallel/collectivecommunication.hh>
46#endif
47
48namespace Dune
49{
50 // Forward declarations
51 template<int cd, int dim, class GridImp>
52 class ALU3dGridEntity;
53 template<int cd, PartitionIteratorType pitype, class GridImp >
54 class ALU3dGridLevelIterator;
55 template<int cd, class GridImp >
56 class ALU3dGridEntityPointerBase;
57 template<int cd, class GridImp >
58 class ALU3dGridEntitySeed;
59 template<int cd, class GridImp >
60 class ALU3dGridEntityPointer;
61 template<int mydim, int coorddim, class GridImp>
62 class ALU3dGridGeometry;
63 template<class GridImp>
64 class ALU3dGridHierarchicIterator;
65 template<class GridImp>
66 class ALU3dGridIntersectionIterator;
67 template<class GridImp>
68 class ALU3dGridLevelIntersectionIterator;
69 template<int codim, PartitionIteratorType pitype, class GridImp>
70 class ALU3dGridLeafIterator;
71 template <int mydim, int coorddim, class GridImp>
73 template <class GridImp>
75 template< int, int, ALU3dGridElementType, class >
77 template< int, int, ALU3dGridElementType, class >
79 template< int, int, ALU3dGridElementType, class >
81 template <class EntityImp>
83 template< class >
84 class ALU3dGridFactory;
85 template <class GridImp, class GeometryImp, int nChild>
87
88
89
90 // Internal Forward Declarations
91 // -----------------------------
92
93#if ALU3DGRID_PARALLEL
94 template<int dim, int dimworld, ALU3dGridElementType elType, class Comm = ALUGridMPIComm >
95 class ALU3dGrid;
96#else // #if ALU3DGRID_PARALLEL
97 template< int dim, int dimworld, ALU3dGridElementType elType, class Comm = ALUGridNoComm >
98 class ALU3dGrid;
99#endif // #else // #if ALU3DGRID_PARALLEL
100
101
102 // Internal Forward Declarations
103 // -----------------------------
104
105 template < int dim, int dimw, class Comm >
106 struct ALUGridBaseGrid< dim, dimw, cube, Comm >
107 {
109 };
110
111 template < int dim, int dimw, class Comm >
112 struct ALUGridBaseGrid< dim, dimw, simplex, Comm >
113 {
115 };
116
117
118
119 // ALU3dGridCommunications
120 // -----------------------
122 {
123 template < class GitterImpl >
124 void checkForConformingRefinement( GitterImpl* grid,
125 const bool conformingRefinement )
126 {
127 if( grid && conformingRefinement )
128 {
129 grid->enableConformingClosure();
130 grid->disableGhostCells();
131 }
132 }
133 };
134
135
136 template< int dim, int dimworld, ALU3dGridElementType elType, class Comm >
138
139 template< int dim, int dimworld, ALU3dGridElementType elType >
140 struct ALU3dGridCommunications< dim, dimworld, elType, ALUGridNoComm > : public ALU3dGridCommunicationsBase
141 {
142 using ALU3dGridCommunicationsBase :: checkForConformingRefinement ;
143
145 typedef int GlobalId;
146
147 typedef ALU3DSPACE GitterDuneImpl GitterImplType;
148
149 typedef Dune::CollectiveCommunication< No_Comm > CollectiveCommunication;
150
152
153 int nlinks () const { return 0; }
154
155 GitterImplType *createALUGrid ( const std::string &macroName, ALU3DSPACE ProjectVertex *projection,
156 const bool conformingRefinement )
157 {
158 GitterImplType* grid = ( macroName.empty() ) ?
159 new GitterImplType( dim ) : new GitterImplType ( dim, macroName.c_str(), projection );
160 // check whether conforming refinement should be enabled
161 checkForConformingRefinement( grid, conformingRefinement );
162 return grid ;
163 }
164
165 GitterImplType *createALUGrid ( std::istream& stream, ALU3DSPACE ProjectVertex *projection,
166 const bool conformingRefinement )
167 {
168 GitterImplType* grid = new GitterImplType ( dim, stream, projection );
169 // check whether conforming refinement should be enabled
170 checkForConformingRefinement( grid, conformingRefinement );
171 return grid ;
172 }
173
175
176 static int getRank ( ALUGridNoComm comm ) { return 0; }
177
178 static typename ALU3DSPACE Gitter::Geometric::BuilderIF &getBuilder ( GitterImplType &grid )
179 {
180 ALU3DSPACE Gitter::Geometric::BuilderIF* builder =
181 dynamic_cast< ALU3DSPACE Gitter::Geometric::BuilderIF* >( &grid.container() );
182 if( ! builder )
183 DUNE_THROW(InvalidStateException,"dynamic_cast of ALUGrid builder failed");
184 return *builder;
185 }
186
187 static void completeGrid ( GitterImplType &grid ) {}
188
189 void print( std::ostream& out ) const
190 {}
191
193 };
194
195#if ALU3DGRID_PARALLEL
196 template< int dim, int dimworld, ALU3dGridElementType elType >
197 struct ALU3dGridCommunications< dim, dimworld, elType, ALUGridMPIComm > : public ALU3dGridCommunicationsBase
198 {
199 using ALU3dGridCommunicationsBase :: checkForConformingRefinement ;
200
202 typedef ALUGridId< ALUMacroKey > GlobalId;
203
204 typedef ALU3DSPACE GitterDunePll GitterImplType;
205
206 typedef Dune::CollectiveCommunication< MPI_Comm > CollectiveCommunication;
207
208 explicit ALU3dGridCommunications ( MPI_Comm comm )
209 : ccobj_( comm ), mpAccess_( comm )
210 {}
211
212 int nlinks () const { return mpAccess_.sendLinks(); }
213
214 GitterImplType *createALUGrid ( const std::string &macroName, ALU3DSPACE ProjectVertex *projection,
215 const bool conformingRefinement )
216 {
217 GitterImplType* grid = new GitterImplType( dim, macroName.c_str(), mpAccess_, projection );
218 // check whether conforming refinement should be enabled
219 checkForConformingRefinement( grid, conformingRefinement );
220 return grid;
221 }
222
223 GitterImplType *createALUGrid ( std::istream& stream, ALU3DSPACE ProjectVertex *projection,
224 const bool conformingRefinement )
225 {
226 GitterImplType* grid = new GitterImplType ( dim, stream, mpAccess_, projection );
227 // check whether conforming refinement should be enabled
228 checkForConformingRefinement( grid, conformingRefinement );
229 return grid ;
230 }
231
232 static MPI_Comm defaultComm () { return MPI_COMM_WORLD; }
233
234 static int getRank ( MPI_Comm comm )
235 {
236 int rank = 0;
237 MPI_Comm_rank( comm, &rank );
238 return rank;
239 }
240
241 void print( std::ostream& out ) const
242 {
243 mpAccess_.printLinkage( out );
244 }
245
246 static typename ALU3DSPACE Gitter::Geometric::BuilderIF &getBuilder ( GitterImplType &grid )
247 {
248 ALU3DSPACE Gitter::Geometric::BuilderIF* builder =
249 dynamic_cast< ALU3DSPACE Gitter::Geometric::BuilderIF* >( &grid.containerPll() );
250 if( ! builder )
251 DUNE_THROW(InvalidStateException,"dynamic_cast of ALUGrid builder failed");
252 return *builder;
253 }
254
255 static void completeGrid ( GitterImplType &grid )
256 {
257 // setup communication patterns
258 grid.notifyMacroGridChanges();
259 // rebuild ghost cells
260 grid.rebuildGhostCells();
261 }
262
263 CollectiveCommunication ccobj_;
264 ALU3DSPACE MpAccessMPI mpAccess_;
265 };
266#endif // #if ALU3DGRID_PARALLEL
267
268
269
270 // ALU3dGridTwist
271 // --------------
272
273 template< int dim, ALU3dGridElementType elType, int codim >
275
276 template<int dim>
281
282 template<int dim>
287
288 template< int dim, ALU3dGridElementType elType >
293
294 template< ALU3dGridElementType elType >
295 struct ALU3dGridTwists< 3, elType, 2 >
296 {
298 };
299
300 template< ALU3dGridElementType elType >
301 struct ALU3dGridTwists< 2, elType, 2 >
302 {
304 };
305
306 template< int dim, ALU3dGridElementType elType >
307 struct ALU3dGridTwists< dim, elType, 3 >
308 {
310 };
311
312
313
314 // ALU3dGridFamily
315 // ---------------
316
317 template< int dimG, int dimW, ALU3dGridElementType elType, class Comm >
319 {
320 static const int dim = dimG;
321 static const int dimworld = dimW;
322
325
328
331
334
336 typedef int LocalIdType;
337
338 struct Traits
339 {
341 typedef typename GridFamily::LocalIdType LocalIdType;
342
344 typedef typename GridFamily::GlobalIdType GlobalIdType;
345
346 typedef typename GridFamily::GridImp Grid;
347
348 typedef Dune::Intersection< const Grid, LeafIntersectionWrapper< const Grid > > LeafIntersection;
349 typedef Dune::Intersection< const Grid, LevelIntersectionWrapper< const Grid > > LevelIntersection;
350
351 typedef Dune::IntersectionIterator< const Grid, LeafIntersectionIteratorWrapper< const Grid >, LeafIntersectionWrapper< const Grid > > IntersectionIterator;
352
353 typedef Dune::IntersectionIterator< const Grid, LeafIntersectionIteratorWrapper< const Grid >, LeafIntersectionWrapper< const Grid > > LeafIntersectionIterator;
354 typedef Dune::IntersectionIterator< const Grid, LevelIntersectionIteratorWrapper< const Grid >, LevelIntersectionWrapper< const Grid > > LevelIntersectionIterator;
355
356 typedef Dune::EntityIterator< 0, const Grid, ALU3dGridHierarchicIterator< const Grid > > HierarchicIterator;
357
358 typedef DuneBoundaryProjection< dimworld > DuneBoundaryProjectionType;
359 typedef std::vector< const DuneBoundaryProjectionType * > DuneBoundaryProjectionVector;
360
361 template< int cd >
362 struct Codim
363 {
365 typedef typename Twists::Twist Twist;
366
367 // IMPORTANT: Codim<codim>::Geometry == Geometry<dim-codim,dimw>
370 typedef Dune::Geometry< dim-cd, dimworld, const Grid, ALU3dGridGeometry > Geometry;
371 typedef Dune::Geometry< dim-cd, dim, const Grid, ALU3dGridGeometry > LocalGeometry;
372
374 typedef Dune::Entity< cd, dim, const Grid, ALU3dGridEntity > Entity;
375
376 // minimal information to generate entities
378
379#if DUNE_VERSION_NEWER(DUNE_GRID,2,4)
381 typedef Entity EntityPointer;
382#else
384 typedef Dune::EntityPointer< const Grid, EntityPointerImpl > EntityPointer;
385#endif
386
387 template< PartitionIteratorType pitype >
389 {
390 typedef Dune::EntityIterator< cd, const Grid, ALU3dGridLevelIterator< cd, pitype, const Grid > > LevelIterator;
391 typedef Dune::EntityIterator< cd, const Grid, ALU3dGridLeafIterator< cd, pitype, const Grid > > LeafIterator;
392 }; // struct Partition
393
396 }; // struct Codim
397
398 template< PartitionIteratorType pitype >
400 {
401 typedef Dune::GridView< ALU3dLevelGridViewTraits< const Grid, pitype > > LevelGridView;
402 typedef Dune::GridView< ALU3dLeafGridViewTraits< const Grid, pitype > > LeafGridView;
404 }; // struct Partition
405
409
412
415
416 typedef IndexSet< Grid, LevelIndexSetImp > LevelIndexSet;
417 typedef IndexSet< Grid, LeafIndexSetImp > LeafIndexSet;
418 typedef IdSet< Grid, LocalIdSetImp, LocalIdType > LocalIdSet;
419 typedef IdSet< Grid, GlobalIdSetImp, GlobalIdType > GlobalIdSet;
420
423 }; // struct Traits
424
426 typedef typename Traits :: LevelIndexSetImp LevelIndexSetImp;
427
429 typedef typename Traits :: LeafIndexSetImp LeafIndexSetImp;
430
431 }; // struct ALU3dGridFamily
432
433
434
435 //**********************************************************************
436 //
437 // --ALU3dGrid
438 // --Grid
439 //
440 //**********************************************************************
441
462 template< int dim, int dimworld, ALU3dGridElementType elType, class Comm >
464 : public GridDefaultImplementation< dim, dimworld, alu3d_ctype,
465 ALU3dGridFamily< dim, dimworld, elType, Comm > >,
466 public HasObjectStream,
468 {
470 typedef GridDefaultImplementation< dim, dimworld, alu3d_ctype, ALU3dGridFamily< dim, dimworld, elType, Comm > > BaseType;
471
472 // for compatibility: MyType := ThisType
474
475 // friend declarations
476 friend class ALU3dGridEntity< 0, dim, const ThisType>;
477 friend class ALU3dGridEntity< 1, dim, const ThisType>;
478 friend class ALU3dGridEntity< 2, dim, const ThisType>;
479 friend class ALU3dGridEntity< dim, dim, const ThisType>;
480
482
483 friend class ALU3dGridEntityPointerBase< 0, const ThisType >;
484 friend class ALU3dGridEntityPointerBase< 1, const ThisType >;
485 friend class ALU3dGridEntityPointerBase< 2, const ThisType >;
486 friend class ALU3dGridEntityPointerBase< dim, const ThisType >;
487
488 friend class ALU3dGridEntityPointer< 0, const ThisType >;
489 friend class ALU3dGridEntityPointer< 1, const ThisType >;
490 friend class ALU3dGridEntityPointer< 2, const ThisType >;
491 friend class ALU3dGridEntityPointer< dim, const ThisType >;
492
493 friend class ALU3dGridIntersectionIterator< const ThisType >;
494 friend class ALU3dGridHierarchicIterator< const ThisType >;
495
496 friend class ALU3dGridHierarchicIndexSet< dim, dimworld, elType, Comm >;
497 friend class ALU3dGridGlobalIdSet< dim, dimworld, elType, Comm >;
498 friend class ALU3dGridLocalIdSet< dim, dimworld, elType, Comm >;
499
500 // new intersection iterator is a wrapper which get itersectioniteratoimp as pointers
501 public:
508
511 friend class LeafIntersectionIteratorWrapper < const ThisType > ;
512 friend class LevelIntersectionIteratorWrapper< const ThisType > ;
513
514 //**********************************************************
515 // The Interface Methods
516 //**********************************************************
517 public:
518 enum { refineStepsForHalf = 1 };
519
520 static const ALU3dGridElementType elementType = elType;
521
522 typedef typename ALU3DSPACE GatherScatterType::ObjectStreamType ObjectStreamType;
525
527 typedef typename GridFamily::Traits Traits;
528
529 static const int dimension = BaseType::dimension;
530 static const int dimensionworld = BaseType::dimensionworld;
531
532 template< int codim >
533 struct Codim
534 : public BaseType::template Codim< codim >
535 {
536 typedef typename Traits::template Codim< codim >::EntityImp EntityImp;
537 typedef typename Traits::template Codim< codim >::EntityPointerImpl EntityPointerImpl;
538 typedef typename Traits::template Codim< codim >::Twists Twists;
539 typedef typename Twists::Twist Twist;
540 };
541
542 protected:
543 typedef MakeableInterfaceObject< typename Traits::template Codim< 0 >::Geometry > GeometryObject;
544 friend class ALULocalGeometryStorage< const ThisType, GeometryObject, 8 >;
545
546 public:
548 template <PartitionIteratorType pitype>
550 {
551 typedef typename GridFamily::Traits::template Partition<pitype>::LevelGridView
553 typedef typename GridFamily::Traits::template Partition<pitype>::LeafGridView
555 typedef typename GridFamily::Traits::template Partition<pitype>::MacroGridView
557 };
562
565
567 typedef typename GridFamily::LevelIndexSetImp LevelIndexSetImp;
569 typedef typename GridFamily::LeafIndexSetImp LeafIndexSetImp;
570
572 typedef ReferenceElement< alu3d_ctype, dimension > ReferenceElementType;
573
578
581
584
587
588 protected:
590 // type of ALUGrid boundary projection wrapper
592
594 typedef typename GridFamily::LocalIdSetImp LocalIdSetImp;
595
597
598 public:
601
604
605 protected:
607 typedef typename Traits::template Codim< 0 >::LeafIterator LeafIteratorType;
608 typedef typename Traits::template Codim< 0 >::LeafIterator LeafIterator;
609
611
613
615 enum {
618
620 enum {
625
626 public:
628
630
631 protected:
634
635 public:
638 ALU3dGrid ( const std::string &macroTriangFilename,
639 const MPICommunicatorType mpiComm,
640 const DuneBoundaryProjectionType *bndPrj,
641 const DuneBoundaryProjectionVector *bndVec,
642 const ALUGridRefinementType refinementType );
643
645 virtual ~ALU3dGrid();
646
648 static inline std::string name ();
649
653 int maxLevel() const;
654
656 template<int cd, PartitionIteratorType pitype>
658 lbegin (int level) const;
659
661 template<int cd, PartitionIteratorType pitype>
663 lend (int level) const;
664
666 template<int cd>
667 typename Traits::template Codim<cd>::
669 lbegin (int level) const;
670
672 template<int cd>
673 typename Traits::template Codim<cd>::
675 lend (int level) const;
676
679
681 ileafbegin( const typename Traits::template Codim< 0 >::Entity& entity ) const
682 {
683 return LefInterItWrapperType( *this,
684 getRealImplementation( entity ),
685 entity.level(), false );
686 }
687
689 ileafend( const typename Traits::template Codim< 0 >::Entity& entity ) const
690 {
691 return LefInterItWrapperType( *this,
692 getRealImplementation( entity ),
693 entity.level(), true );
694 }
695
697 ilevelbegin( const typename Traits::template Codim< 0 >::Entity& entity ) const
698 {
699 return LvlInterItWrapperType( *this,
700 getRealImplementation( entity ),
701 entity.level(), false );
702 }
703
705 ilevelend( const typename Traits::template Codim< 0 >::Entity& entity ) const
706 {
707 return LvlInterItWrapperType( *this,
708 getRealImplementation( entity ),
709 entity.level(), true );
710 }
711
712 private:
714 template <int codim, PartitionIteratorType pitype>
715 typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
716 leafbegin(int level) const;
717
719 template <int codim, PartitionIteratorType pitype>
720 typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
721 leafend(int level) const;
722
724 template <int codim>
725 typename Traits::template Codim<codim>::LeafIterator
726 leafbegin(int level) const;
727
729 template <int codim>
730 typename Traits::template Codim<codim>::LeafIterator
731 leafend(int level) const;
732
734 LeafIteratorType leafbegin (int level) const;
735
737 LeafIteratorType leafend (int level) const;
738
740 LeafIteratorType leafbegin () const;
741
743 LeafIteratorType leafend () const;
744
745 public:
747 template <int codim, PartitionIteratorType pitype>
748 typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
749 leafbegin() const;
750
752 template <int codim, PartitionIteratorType pitype>
753 typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
754 leafend() const;
755
757 template <int codim>
758 typename Traits::template Codim<codim>::LeafIterator
759 leafbegin() const;
760
762 template <int codim>
763 typename Traits::template Codim<codim>::LeafIterator
764 leafend() const;
765
766 private:
768 template <int codim, PartitionIteratorType pitype>
769 typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
770 createLeafIteratorBegin (int level) const;
771
773 template <int codim, PartitionIteratorType pitype>
774 typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
775 createLeafIteratorEnd(int level) const;
776
777 public:
779 int size (int level, int cd) const;
780
782 int size (int codim) const;
783
785 int size (int level, GeometryType type) const;
786
788 size_t numBoundarySegments() const;
789
791 int size (GeometryType type) const;
792
794 int global_size (int cd) const ;
795
796 // (no interface method) number of grid entities in the entire grid for given codim
797 int hierSetSize (int cd) const;
798
800 const GlobalIdSet &globalIdSet () const
801 {
802 if( !globalIdSet_ )
803 {
804 globalIdSet_.reset( new GlobalIdSetImp( *this ) );
805 }
806 return *globalIdSet_;
807 }
808
810 template<PartitionIteratorType pitype>
812 {
813 typedef typename Traits::template Partition<pitype>::MacroGridView View;
814 return View(*this);
815 }
816
819 {
820 typedef MacroGridView View;
821 return View(*this);
822 }
823
825 template<PartitionIteratorType pitype>
826 DUNE_DEPRECATED_MSG("macroView is deprecated, use macroGridView")
827 typename Partition<pitype>::MacroGridView macroView() const
828 {
829 typedef typename Traits::template Partition<pitype>::MacroGridView View;
830 return View(*this);
831 }
832
834 DUNE_DEPRECATED_MSG("macroView is deprecated, use macroGridView")
836 {
837 typedef MacroGridView View;
838 return View(*this);
839 }
840
842 const LocalIdSet & localIdSet () const { return localIdSet_; }
843
845 const typename Traits :: LeafIndexSet & leafIndexSet () const;
846
848 const typename Traits :: LevelIndexSet & levelIndexSet (int level) const
849 {
850 assert( (level >= 0) && (level < int( levelIndexVec_.size() )) );
851 if( ! levelIndexVec_[ level ] )
852 {
853 levelIndexVec_[ level ] = createLevelIndexSet( level );
854 }
855 return (*levelIndexVec_[ level ]);
856 }
857
862 std::shared_ptr< LevelIndexSetImp > accessLevelIndexSet ( int level ) const
863 {
864 assert( (level >= 0) && (level < int( levelIndexVec_.size() )) );
865 if( levelIndexVec_[ level ] )
866 {
867 return levelIndexVec_[ level ];
868 }
869 else
870 {
871 return createLevelIndexSet( level );
872 }
873 }
874
875 protected:
876 std::shared_ptr< LevelIndexSetImp > createLevelIndexSet ( int level ) const
877 {
878 return std::shared_ptr< LevelIndexSetImp > (new LevelIndexSetImp( *this, lbegin< 0 >( level ), lend< 0 >( level ), level ) );
879 }
880
881 public:
882 template< int cd >
883 typename Codim< cd >::Twists twists ( GeometryType type ) const
884 {
885 assert( type.dim() == dimension - cd );
886 assert( elType == tetra ? type.isSimplex() : type.isCube() );
887 return typename Traits::template Codim< cd >::Twists();
888 }
889
890 protected:
891 typedef ALU3DSPACE GatherScatter GatherScatterType;
892
921 bool loadBalance ( GatherScatterType* lbData );
922
923 public:
929 {
930 return loadBalance( (GatherScatterType* ) 0 );
931 }
932
939 template< class DataHandleImpl, class Data >
940 bool loadBalance ( CommDataHandleIF< DataHandleImpl, Data > &dataHandleIF )
941 {
942 typedef ALU3DSPACE GatherScatterLoadBalanceDataHandle
943 < ThisType, GatherScatterType, DataHandleImpl, Data, false > DataHandleType;
944 DataHandleType dataHandle( *this, dataHandleIF );
945
946 // call the above loadBalance method with general GatherScatterType
947 return loadBalance( &dataHandle );
948 }
949
959 template< class LBWeights, class DataHandleImpl, class Data >
960 bool loadBalance ( LBWeights &weights,
961 CommDataHandleIF< DataHandleImpl, Data > &dataHandleIF )
962 {
963 typedef ALU3DSPACE GatherScatterLoadBalanceDataHandle
964 < ThisType, LBWeights, DataHandleImpl, Data, false > DataHandleType;
965 DataHandleType dataHandle( *this, dataHandleIF, weights );
966
967 // call the above loadBalance method with general GatherScatterType
968 return loadBalance( &dataHandle );
969 }
970
978 template< class LBWeights >
979 typename std::enable_if< !IsDataHandle< LBWeights >::value, bool >::type loadBalance ( LBWeights &weights )
980 {
981 typedef ALU3DSPACE GatherScatterLoadBalance < ThisType, LBWeights, false > LoadBalanceHandleType;
982 LoadBalanceHandleType loadBalanceHandle( *this, weights );
983 return loadBalance( &loadBalanceHandle );
984 }
985
994 template< class LBDestinations >
995 bool repartition ( LBDestinations &destinations )
996 {
997 typedef ALU3DSPACE GatherScatterLoadBalance< ThisType, LBDestinations, true > LoadBalanceHandleType ;
998 LoadBalanceHandleType loadBalanceHandle( *this, destinations );
999 return loadBalance( &loadBalanceHandle );
1000 }
1001
1012 template< class LBDestinations, class DataHandleImpl, class Data >
1013 bool repartition ( LBDestinations &destinations,
1014 CommDataHandleIF< DataHandleImpl, Data > &dataHandleIF )
1015 {
1016 typedef ALU3DSPACE GatherScatterLoadBalanceDataHandle< ThisType, LBDestinations, DataHandleImpl, Data, true > DataHandleType;
1017 DataHandleType dataHandle( *this, dataHandleIF, destinations );
1018
1019 // call the above loadBalance method with general GatherScatterType
1020 return loadBalance( &dataHandle );
1021 }
1022
1023
1025 int ghostSize (int level, int codim) const;
1026
1028 int overlapSize (int level, int codim) const { return 0; }
1029
1031 int ghostSize (int codim) const;
1032
1034 int overlapSize (int codim) const { return 0; }
1035
1037 template< class DataHandle, class Data >
1038 LevelCommunication communicate ( CommDataHandleIF< DataHandle, Data > &data,
1039 InterfaceType iftype,
1040 CommunicationDirection dir,
1041 int level ) const
1042 {
1043 return LevelCommunication( *this, data, iftype, dir, level );
1044 }
1045
1049 template< class DataHandle, class Data >
1050 LeafCommunication communicate ( CommDataHandleIF< DataHandle, Data > &data,
1051 InterfaceType iftype,
1052 CommunicationDirection dir ) const
1053 {
1054 return LeafCommunication( *this, data, iftype, dir );
1055 }
1056
1057 protected:
1058 // load balance and compress memory if possible
1059 void finalizeGridCreation();
1060
1062 void clearIsNewMarkers( );
1063
1064 public:
1066 const CollectiveCommunication &comm () const { return communications().ccobj_; }
1067
1069 bool preAdapt ( );
1070
1072 void postAdapt ( );
1073
1075 bool adapt ();
1076
1081 template< class GridImp, class DataHandle >
1082 bool adapt ( AdaptDataHandleInterface< GridImp, DataHandle > &handle );
1083
1085 void globalRefine ( int refCount );
1086
1087 template< class GridImp, class DataHandle >
1088 void globalRefine ( int refCount, AdaptDataHandleInterface< GridImp, DataHandle > &handle );
1089
1090 //**********************************************************
1091 // End of Interface Methods
1092 //**********************************************************
1093
1095 bool writeMacroGrid( const std::string path, const std::string filename,
1096 const ALU3DSPACE MacroFileHeader::Format format = ALU3DSPACE MacroFileHeader::defaultFormat ) const ;
1097
1099 void backup( std::ostream&, const ALU3DSPACE MacroFileHeader::Format format ) const ;
1100
1102 void restore( std::istream& ) ;
1103
1104 // (no interface method) get hierarchic index set of the grid
1106
1107 // no interface method, but has to be public
1108 void updateStatus ();
1109
1111 bool mark( int refCount , const typename Traits::template Codim<0>::Entity & e);
1112
1114 int getMark( const typename Traits::template Codim<0>::Entity & e) const;
1115
1116 public:
1118 {
1119 return Communications::defaultComm();
1120 }
1121
1122 using BaseType :: getRealImplementation ;
1123
1124 template< class IntersectionType >
1125 static const typename BaseType
1126 :: template ReturnImplementationType< IntersectionType >
1127 :: ImplementationType &
1128 getRealIntersection ( const IntersectionType &intersection )
1129 {
1130 return getRealImplementation( intersection );
1131 }
1132
1134 const std::vector<GeometryType>& geomTypes (int codim) const { return geomTypes_[codim]; }
1135
1136 // return reference to org ALU3dGrid
1137 // private method, but otherwise we have to friend class all possible
1138 // types of LevelIterator ==> later
1139 GitterImplType &myGrid () const;
1140
1141 virtual GitterImplType *createALUGrid ( const std::string &macroName )
1142 {
1144 return communications_->createALUGrid( macroName, vertexProjection(), conformingRefinement() );
1145 }
1146
1147 virtual GitterImplType *createALUGrid ( std::istream& stream )
1148 {
1150 return communications_->createALUGrid( stream, vertexProjection(), conformingRefinement() );
1151 }
1152
1154
1155 // return appropriate ALUGrid builder
1156 virtual typename ALU3DSPACE Gitter::Geometric::BuilderIF &getBuilder () const
1157 {
1158 return Communications::getBuilder( myGrid() );
1159 }
1160
1161 // helper function for factory
1162 virtual void completeGrid ()
1163 {
1164 Communications::completeGrid( myGrid() );
1166 }
1167
1170 {
1171 return ( elType == tetra ) ?
1172 ReferenceElements< alu3d_ctype, dimension > :: simplex()
1173 : ReferenceElements< alu3d_ctype, dimension > :: cube();
1174 }
1175
1176 template < class EntitySeed >
1177 typename Traits :: template Codim< EntitySeed :: codimension > :: EntityPointer
1178 entityPointer( const EntitySeed& seed ) const
1179 {
1180 enum { codim = EntitySeed :: codimension };
1181 return typename Traits :: template Codim< codim > :: EntityPointerImpl( seed );
1182 }
1183
1184 template < class EntitySeed >
1185 typename Traits :: template Codim< EntitySeed :: codimension > :: Entity
1186 entity( const EntitySeed& seed ) const
1187 {
1188 typedef typename Traits :: template Codim< EntitySeed :: codimension > :: Entity Entity;
1189 return Entity( typename Traits :: template Codim< EntitySeed :: codimension > :: EntityImp( seed ) );
1190 }
1191
1192 // number of links to other processors, for internal use only
1193 int nlinks () const { return communications().nlinks(); }
1194
1196 {
1197 if( !leafVertexList_.up2Date() ) leafVertexList_.setupVxList(*this);
1198 return leafVertexList_;
1199 }
1200
1202 {
1203 alugrid_assert ( leafVertexList_.up2Date() );
1204 return leafVertexList_.getLevel(vertex);
1205 }
1206
1208 {
1209 alugrid_assert ( level >= 0 );
1210 alugrid_assert ( level <= maxLevel() );
1211 VertexListType & vxList = vertexList_[level];
1212 if(!vxList.up2Date()) vxList.setupVxList(*this,level);
1213 return vxList;
1214 }
1215
1217 {
1218 alugrid_assert ( codim >= 1 );
1219 alugrid_assert ( codim <= 3 );
1220 return ghostLeafList_[codim-1];
1221 }
1222
1223 ALU3dGridItemListType & getGhostLevelList(int codim, int level) const
1224 {
1225 alugrid_assert ( codim >= 1 );
1226 alugrid_assert ( codim <= 3 );
1227
1228 alugrid_assert ( level >= 0 );
1229 alugrid_assert ( level <= maxLevel() );
1230 alugrid_assert ( level < int(ghostLevelList_[codim-1].size()) );
1231 return ghostLevelList_[codim-1][level];
1232 }
1233
1235 {
1236 alugrid_assert ( level >= 0 );
1237 alugrid_assert ( level <= maxLevel() );
1238 return levelEdgeList_[level];
1239 }
1240
1241 protected:
1244
1246 const ThisType &operator= ( const ThisType & );
1247
1249 void calcExtras();
1250
1252 void calcMaxLevel();
1253
1256
1258 void checkMacroGridFile (const std::string filename);
1259
1261 void checkMacroGrid ();
1262
1264 const DuneBoundaryProjectionType* boundaryProjection(const int segmentIndex) const
1265 {
1266 if( bndPrj_ )
1267 {
1268 return bndPrj_;
1269 }
1270 else
1271 {
1272 // pointer can be zero (which is emulates the identity mapping then)
1274 alugrid_assert ( segmentIndex < (int) bndVec_->size() );
1275 return (*bndVec_)[ segmentIndex ];
1276 }
1277 }
1278
1280 {
1282 return *communications_;
1283 }
1284
1285 // initialize geometry types and return correct geometryInFather storage
1286 void makeGeometries();
1287
1288 public:
1289 // return true if conforming refinement is enabled
1291 {
1292 return (refinementType_ == conforming) ;
1293 }
1294
1295 // return true if ghost cells are available
1296 bool ghostCellsEnabled () const
1297 {
1298 return comm().size() > 1 && myGrid().ghostCellsEnabled();
1299 }
1300
1303
1306 protected:
1308 //
1309 // Internal variables
1310 //
1312
1313 // the real ALU grid
1314 mutable std::unique_ptr< GitterImplType > mygrid_;
1315
1316 // max level of grid
1318
1319 // count how much elements where marked
1320 mutable int coarsenMarked_;
1321 mutable int refineMarked_;
1322
1323 // at the moment the number of different geom types is 1
1324 enum { numberOfGeomTypes = 1 };
1325 std::vector< std::vector<GeometryType> > geomTypes_;
1326
1327 // our hierarchic index set
1329
1330 // out global id set
1331 mutable std::unique_ptr< GlobalIdSetImp > globalIdSet_;
1332
1333 // out global id set
1335
1336 // the level index set ( default type )
1337 mutable std::vector < std::shared_ptr< LevelIndexSetImp > > levelIndexVec_;
1338
1339 // the leaf index set
1340 mutable std::unique_ptr< LeafIndexSetImp > leafIndexSet_;
1341
1342 mutable std::vector< VertexListType > vertexList_;
1343
1344 //the ghostleaf list is used in alu3diterators, where we use the internal aluIterators
1345 // the vertex codim there is 3, so the list has to fulfill that
1347 mutable std::vector< ALU3dGridItemListType > ghostLevelList_[ 3 ];
1348
1349 mutable std::vector< ALU3dGridItemListType > levelEdgeList_;
1350
1352
1353 // the type of our size cache
1354 typedef SizeCache<MyType> SizeCacheType;
1355 std::unique_ptr< SizeCacheType > sizeCache_;
1356
1357 // variable to ensure that postAdapt ist called after adapt
1359
1360 // pointer to Dune boundary projection
1362
1363 // pointer to Dune boundary projection
1364 std::unique_ptr< const DuneBoundaryProjectionVector > bndVec_;
1365
1366 // boundary projection for vertices
1367 std::unique_ptr< ALUGridBoundaryProjectionType > vertexProjection_ ;
1368
1369 // pointer to communications object
1370 std::unique_ptr< Communications > communications_;
1371
1372 // refinement type (nonconforming or conforming)
1374 }; // end class ALU3dGrid
1375
1376
1378 const std::string filename );
1379 const char* elType2Name( ALU3dGridElementType elType );
1380
1381 namespace Capabilities
1382 {
1383
1384 template< int dim, int dimworld, ALU3dGridElementType elType, class Comm, int cdim >
1385 struct hasEntity< Dune::ALU3dGrid< dim, dimworld, elType, Comm >, cdim >
1386 {
1387 static const bool v = true;
1388 };
1389
1390#if !DUNE_VERSION_NEWER(DUNE_GRID,3,0)
1391 template< int dim, int dimworld, ALU3dGridElementType elType, class Comm >
1392 struct isParallel< ALU3dGrid< dim, dimworld, elType, Comm > >
1393 {
1394 static const bool v = true;
1395 };
1396#endif //#if !DUNE_VERSION_NEWER(DUNE_GRID,3,0)
1397
1398 template< int dim, int dimworld, ALU3dGridElementType elType, class Comm >
1399 struct isLevelwiseConforming< ALU3dGrid< dim, dimworld, elType, Comm > >
1400 {
1401 static const bool v = true;
1402 };
1403
1404 template< int dim, int dimworld, ALU3dGridElementType elType, class Comm >
1405 struct hasBackupRestoreFacilities< ALU3dGrid< dim, dimworld, elType, Comm > >
1406 {
1407 static const bool v = true;
1408 };
1409
1410 } // end namespace Capabilities
1411
1412} // end namespace Dune
1413
1414#include "grid_inline.hh"
1415#if COMPILE_ALUGRID_INLINE
1416 #include "grid_imp.cc"
1417#endif
1418#endif
Provides default index set implementations for Level- and LeafIndexsets used by ALUGrid.
Provides proxy classes for IntersectionsIterators.
#define alugrid_assert(EX)
Definition alugrid_assert.hh:20
Provides a Interfaces for detection of specific behavior.
#define ALU3DSPACE
Definition alu3dinclude.hh:24
Definition alu3dinclude.hh:80
ALU3dGridElementType
Definition topology.hh:12
@ hexa
Definition topology.hh:12
@ tetra
Definition topology.hh:12
@ simplex
use only simplex elements (i.e., triangles or tetrahedra)
Definition declaration.hh:18
@ cube
use only cube elements (i.e., quadrilaterals or hexahedra)
Definition declaration.hh:19
bool checkMacroGrid(ALU3dGridElementType elType, const std::string filename)
double alu3d_ctype
Definition alu3dinclude.hh:85
const char * elType2Name(ALU3dGridElementType elType)
Definition grid_imp.cc:664
ALUGridRefinementType
available refinement types for ALUGrid
Definition declaration.hh:24
@ conforming
use conforming bisection refinement
Definition declaration.hh:25
Definition alu3dinclude.hh:259
Definition alu3dinclude.hh:345
Definition alu3dinclude.hh:381
Definition alu3dinclude.hh:426
Definition communication.hh:26
Definition communication.hh:29
[ provides Dune::Grid ]
Definition 3d/grid.hh:468
int ghostSize(int level, int codim) const
ghostSize is one for codim 0 and zero otherwise for this grid
Definition grid_imp.cc:294
bool writeMacroGrid(const std::string path, const std::string filename, const ALU3DSPACE MacroFileHeader::Format format=ALU3DSPACE MacroFileHeader::defaultFormat) const
write macro grid in ALUGrid macro format to path/filename.rank
Definition grid_imp.cc:547
bool repartition(LBDestinations &destinations, CommDataHandleIF< DataHandleImpl, Data > &dataHandleIF)
Distribute the grid based on a user defined partitioning.
Definition 3d/grid.hh:1013
static int thread()
return current thread number
Definition 3d/grid.hh:1302
int getLevelOfLeafVertex(const typename ALU3dImplTraits< elType, Comm >::VertexType &vertex) const
Definition 3d/grid.hh:1201
static const ReferenceElementType & referenceElement()
return reference to Dune reference element according to elType
Definition 3d/grid.hh:1169
const DuneBoundaryProjectionType * boundaryProjection(const int segmentIndex) const
return boudanry projection for given segment Id
Definition 3d/grid.hh:1264
ALUGridBoundaryProjection< ThisType, alu3d_ctype > ALUGridBoundaryProjectionType
Definition 3d/grid.hh:591
MakeableInterfaceObject< typename Traits::template Codim< 0 >::Geometry > GeometryObject
Definition 3d/grid.hh:543
Traits::CollectiveCommunication CollectiveCommunication
type of collective communication object
Definition 3d/grid.hh:583
ALU3dGridIntersectionIterator< const ThisType > IntersectionIteratorImp
Definition 3d/grid.hh:503
void globalRefine(int refCount)
uses the interface, mark on entity and refineLocal
Definition grid_imp.cc:418
void calcExtras()
reset size and global size, update Level- and LeafIndexSet, if they exist
Definition grid_imp.cc:344
static const int dimensionworld
Definition 3d/grid.hh:530
bool mark(int refCount, const typename Traits::template Codim< 0 >::Entity &e)
Definition grid_inline.hh:307
virtual ALU3DSPACE Gitter::Geometric::BuilderIF & getBuilder() const
Definition 3d/grid.hh:1156
LevelCommunication communicate(CommDataHandleIF< DataHandle, Data > &data, InterfaceType iftype, CommunicationDirection dir, int level) const
Definition 3d/grid.hh:1038
int overlapSize(int level, int codim) const
overlapSize is zero for this grid
Definition 3d/grid.hh:1028
bool preAdapt()
returns if a least one entity was marked for coarsening
Definition grid_imp.cc:434
bool loadBalance()
Calculates load of each process and repartition by using ALUGrid's default partitioning method....
Definition 3d/grid.hh:928
int coarsenMarked_
Definition 3d/grid.hh:1320
std::unique_ptr< Communications > communications_
Definition 3d/grid.hh:1370
Traits::template Codim< EntitySeed::codimension >::Entity entity(const EntitySeed &seed) const
Definition 3d/grid.hh:1186
ALU3dGridLevelIntersectionIterator< const ThisType > LevelIntersectionIteratorImp
Definition 3d/grid.hh:507
ALU3dGrid(const ThisType &)
Copy constructor should not be used.
const CollectiveCommunication & comm() const
Definition 3d/grid.hh:1066
Traits::template Codim< 0 >::LeafIterator LeafIterator
Definition 3d/grid.hh:608
HierarchicIndexSet hIndexSet_
Definition 3d/grid.hh:1328
friend class LeafIntersectionIteratorWrapper< const ThisType >
Definition 3d/grid.hh:511
Traits::LeafIntersectionIterator ileafend(const typename Traits::template Codim< 0 >::Entity &entity) const
Definition 3d/grid.hh:689
std::unique_ptr< const DuneBoundaryProjectionVector > bndVec_
Definition 3d/grid.hh:1364
std::vector< std::shared_ptr< LevelIndexSetImp > > levelIndexVec_
Definition 3d/grid.hh:1337
int maxLevel() const
Return maximum level defined in this grid. Levels are numbered maxLevel with 0 the coarsest level.
Definition grid_inline.hh:108
ALULeafCommunication< dim, dimworld, elType, Comm > LeafCommunication
Definition 3d/grid.hh:585
GridFamily::Traits Traits
Definition 3d/grid.hh:527
const Traits::LevelIndexSet & levelIndexSet(int level) const
get level index set of the grid
Definition 3d/grid.hh:848
Traits::DuneBoundaryProjectionType DuneBoundaryProjectionType
boundary projection type
Definition 3d/grid.hh:575
ALU3dGridCommunications< dim, dimworld, elType, Comm > Communications
Definition 3d/grid.hh:629
int hierSetSize(int cd) const
Definition grid_inline.hh:100
GitterImplType & myGrid() const
Definition grid_inline.hh:116
Traits::LocalIdSet LocalIdSet
Type of the local id set.
Definition 3d/grid.hh:603
void finalizeGridCreation()
Definition grid_inline.hh:425
std::shared_ptr< LevelIndexSetImp > createLevelIndexSet(int level) const
Definition 3d/grid.hh:876
static MPICommunicatorType defaultCommunicator()
Definition 3d/grid.hh:1117
ALULevelCommunication< dim, dimworld, elType, Comm > LevelCommunication
Definition 3d/grid.hh:586
ALU3DSPACE GatherScatterType::ObjectStreamType ObjectStreamType
Definition 3d/grid.hh:522
bool adapt()
Definition grid_imp.cc:443
void checkMacroGridFile(const std::string filename)
check whether macro grid format is of our type
Definition grid_imp.cc:605
VertexListType & getVertexList(int level) const
Definition 3d/grid.hh:1207
friend class LevelIntersectionIteratorWrapper< const ThisType >
Definition 3d/grid.hh:512
bool loadBalance(LBWeights &weights, CommDataHandleIF< DataHandleImpl, Data > &dataHandleIF)
Calculates load of each process and repartition by using ALUGrid's default partitioning method,...
Definition 3d/grid.hh:960
const LocalIdSet & localIdSet() const
get global id set of grid
Definition 3d/grid.hh:842
std::unique_ptr< ALUGridBoundaryProjectionType > vertexProjection_
Definition 3d/grid.hh:1367
int maxlevel_
Definition 3d/grid.hh:1317
const std::vector< GeometryType > & geomTypes(int codim) const
deliver all geometry types used in this grid
Definition 3d/grid.hh:1134
const Communications & communications() const
Definition 3d/grid.hh:1279
ALU3dGridIntersectionIterator< const ThisType > LeafIntersectionIteratorImp
Definition 3d/grid.hh:505
ALU3DSPACE ProjectVertex ALUGridVertexProjectionType
type of ALUGrid Vertex Projection Interface
Definition 3d/grid.hh:580
virtual GitterImplType * createALUGrid(const std::string &macroName)
Definition 3d/grid.hh:1141
bool repartition(LBDestinations &destinations)
Distribute the grid based on a user defined partitioning.
Definition 3d/grid.hh:995
bool ghostCellsEnabled() const
Definition 3d/grid.hh:1296
ALU3dGridLeafIterator< 0, All_Partition, const ThisType > LeafIteratorImp
Definition 3d/grid.hh:606
static std::string name()
for grid identification
Definition grid_inline.hh:443
bool lockPostAdapt_
Definition 3d/grid.hh:1358
const ThisType & operator=(const ThisType &)
assignment operator should not be used
Definition grid_imp.cc:194
static int maxThreads()
return max number of threads
Definition 3d/grid.hh:1305
static const int dimension
Definition 3d/grid.hh:529
Partition< pitype >::MacroGridView macroView() const
View for te macro grid with some alu specific methods.
Definition 3d/grid.hh:827
LeafIntersectionIteratorWrapper< const ThisType > LefInterItWrapperType
Definition 3d/grid.hh:677
std::shared_ptr< LevelIndexSetImp > accessLevelIndexSet(int level) const
return instance of level index set
Definition 3d/grid.hh:862
std::unique_ptr< GlobalIdSetImp > globalIdSet_
Definition 3d/grid.hh:1331
ALU3dGridHierarchicIterator< const ThisType > HierarchicIteratorImp
Definition 3d/grid.hh:610
int nlinks() const
Definition 3d/grid.hh:1193
Traits::LeafIntersectionIterator ileafbegin(const typename Traits::template Codim< 0 >::Entity &entity) const
Definition 3d/grid.hh:681
int refineMarked_
Definition 3d/grid.hh:1321
GridFamily::LevelIndexSetImp LevelIndexSetImp
Type of the level index set, needed by data handle.
Definition 3d/grid.hh:567
GridFamily::LocalIdSetImp LocalIdSetImp
Type of the local id set.
Definition 3d/grid.hh:594
std::unique_ptr< SizeCacheType > sizeCache_
Definition 3d/grid.hh:1355
void recalcGlobalSize()
make grid walkthrough and calc global size
Traits::template Codim< 0 >::LeafIterator LeafIteratorType
Definition 3d/grid.hh:607
static const ALU3dGridElementType elementType
Definition 3d/grid.hh:520
Partition< All_Partition >::LevelGridView LevelGridView
View types for All_Partition.
Definition 3d/grid.hh:559
LeafCommunication communicate(CommDataHandleIF< DataHandle, Data > &data, InterfaceType iftype, CommunicationDirection dir) const
Communicate information on distributed entities on the leaf grid. Template parameter is a model of Du...
Definition 3d/grid.hh:1050
Codim< cd >::Twists twists(GeometryType type) const
Definition 3d/grid.hh:883
void backup(std::ostream &, const ALU3DSPACE MacroFileHeader::Format format) const
backup to ostream
Definition grid_imp.cc:569
void clearIsNewMarkers()
clear all entity new markers
Definition grid_imp.cc:491
ObjectStreamType InStreamType
Definition 3d/grid.hh:523
void makeGeometries()
Definition grid_inline.hh:65
void updateStatus()
Definition grid_imp.cc:302
const ALUGridRefinementType refinementType_
Definition 3d/grid.hh:1373
Partition< All_Partition >::MacroGridView MacroGridView
Definition 3d/grid.hh:561
@ refineEstimate_
if one element is refined then it causes apporximately not more than this number of new elements
Definition 3d/grid.hh:624
void postAdapt()
clear all entity new markers if lockPostAdapt_ is set
Definition grid_imp.cc:533
void restore(std::istream &)
restore from istream
Definition grid_imp.cc:577
@ numberOfGeomTypes
Definition 3d/grid.hh:1324
Traits::template Codim< cd >::template Partition< pitype >::LevelIterator lbegin(int level) const
Iterator to first entity of given codim on level.
Definition grid_inline.hh:127
std::vector< std::vector< GeometryType > > geomTypes_
Definition 3d/grid.hh:1325
void calcMaxLevel()
calculate maxlevel
Definition grid_imp.cc:311
bool conformingRefinement() const
Definition 3d/grid.hh:1290
std::vector< ALU3dGridItemListType > levelEdgeList_
Definition 3d/grid.hh:1349
const GlobalIdSet & globalIdSet() const
get global id set of grid
Definition 3d/grid.hh:800
ObjectStreamType OutStreamType
Definition 3d/grid.hh:524
const HierarchicIndexSet & hierarchicIndexSet() const
Definition 3d/grid.hh:1105
ALU3dGridFamily< dim, dimworld, elType, Comm > GridFamily
Definition 3d/grid.hh:526
std::unique_ptr< GitterImplType > mygrid_
Definition 3d/grid.hh:1314
ALU3dGridLeafVertexList< Comm > LeafVertexListType
Definition 3d/grid.hh:633
SizeCache< MyType > SizeCacheType
Definition 3d/grid.hh:1354
virtual ~ALU3dGrid()
Desctructor.
Definition grid_imp.cc:203
int size(int level, int cd) const
number of grid entities per level and codim
Definition grid_imp.cc:218
ALU3dGridVertexList< Comm > VertexListType
Definition 3d/grid.hh:632
ALU3dGridItemListType ghostLeafList_[3]
Definition 3d/grid.hh:1346
ReferenceElement< alu3d_ctype, dimension > ReferenceElementType
reference element type
Definition 3d/grid.hh:572
const DuneBoundaryProjectionType * bndPrj_
Definition 3d/grid.hh:1361
GridFamily::LeafIndexSetImp LeafIndexSetImp
Type of the leaf index set, needed by data handle.
Definition 3d/grid.hh:569
virtual void completeGrid()
Definition 3d/grid.hh:1162
Comm MPICommunicatorType
Definition 3d/grid.hh:627
ALU3DSPACE GatherScatter GatherScatterType
Definition 3d/grid.hh:891
int getMark(const typename Traits::template Codim< 0 >::Entity &e) const
Definition grid_inline.hh:322
std::enable_if<!IsDataHandle< LBWeights >::value, bool >::type loadBalance(LBWeights &weights)
Calculates load of each process and repartition by using ALUGrid's default partitioning method,...
Definition 3d/grid.hh:979
Traits::template Codim< EntitySeed::codimension >::EntityPointer entityPointer(const EntitySeed &seed) const
Definition 3d/grid.hh:1178
@ refineStepsForHalf
Definition 3d/grid.hh:518
virtual GitterImplType * createALUGrid(std::istream &stream)
Definition 3d/grid.hh:1147
std::vector< VertexListType > vertexList_
Definition 3d/grid.hh:1342
ALU3dGridItemListType & getGhostLeafList(int codim) const
Definition 3d/grid.hh:1216
MacroGridView macroGridView() const
View for te macro grid with some alu specific methods (All_Partition)
Definition 3d/grid.hh:818
Traits::LevelIntersectionIterator ilevelbegin(const typename Traits::template Codim< 0 >::Entity &entity) const
Definition 3d/grid.hh:697
LeafVertexListType leafVertexList_
Definition 3d/grid.hh:1351
Traits::template Codim< cd >::template Partition< pitype >::LevelIterator lend(int level) const
one past the end on this level
Definition grid_inline.hh:141
LeafVertexListType & getLeafVertexList() const
Definition 3d/grid.hh:1195
@ newElementsChunk_
normal default number of new elements for new adapt method
Definition 3d/grid.hh:617
ALU3dImplTraits< elType, Comm >::GitterImplType GitterImplType
Definition 3d/grid.hh:612
std::vector< ALU3dGridItemListType > ghostLevelList_[3]
Definition 3d/grid.hh:1347
ALU3dGridItemListType & getGhostLevelList(int codim, int level) const
Definition 3d/grid.hh:1223
GridFamily::GlobalIdSetImp GlobalIdSetImp
Definition 3d/grid.hh:596
bool loadBalance(CommDataHandleIF< DataHandleImpl, Data > &dataHandleIF)
Calculates load of each process and repartition by using ALUGrid's default partitioning method....
Definition 3d/grid.hh:940
Traits::DuneBoundaryProjectionVector DuneBoundaryProjectionVector
boundary projection type
Definition 3d/grid.hh:577
int global_size(int cd) const
number of grid entities on all levels for given codim
Definition grid_inline.hh:90
ALU3dGridItemListType & getEdgeList(int level) const
Definition 3d/grid.hh:1234
Traits::LevelIntersectionIterator ilevelend(const typename Traits::template Codim< 0 >::Entity &entity) const
Definition 3d/grid.hh:705
size_t numBoundarySegments() const
number of boundary segments
Definition grid_imp.cc:232
void checkMacroGrid()
check whether macro grid has the right element type
Definition grid_imp.cc:644
Traits::GlobalIdSet GlobalIdSet
Type of the global id set.
Definition 3d/grid.hh:600
Partition< pitype >::MacroGridView macroGridView() const
View for te macro grid with some alu specific methods.
Definition 3d/grid.hh:811
const Traits::LeafIndexSet & leafIndexSet() const
get leaf index set of the grid
Definition grid_imp.cc:403
ALUGridVertexProjectionType * vertexProjection()
Definition 3d/grid.hh:1153
std::unique_ptr< LeafIndexSetImp > leafIndexSet_
Definition 3d/grid.hh:1340
LevelIntersectionIteratorWrapper< const ThisType > LvlInterItWrapperType
Definition 3d/grid.hh:678
Partition< All_Partition >::LeafGridView LeafGridView
Definition 3d/grid.hh:560
ALU3dGridHierarchicIndexSet< dim, dimworld, elType, Comm > HierarchicIndexSet
Type of the hierarchic index set.
Definition 3d/grid.hh:564
LocalIdSetImp localIdSet_
Definition 3d/grid.hh:1334
int overlapSize(int codim) const
overlapSize is zero for this grid
Definition 3d/grid.hh:1034
static const BaseType::template ReturnImplementationType< IntersectionType >::ImplementationType & getRealIntersection(const IntersectionType &intersection)
Definition 3d/grid.hh:1128
Definition entity.hh:47
Definition entity.hh:629
Definition geometry.hh:632
Definition iterator.hh:709
Definition iterator.hh:56
Leaf iterator.
Definition iterator.hh:635
Definition entity.hh:458
Definition entityseed.hh:212
Definition 3d/grid.hh:72
Definition 3d/grid.hh:74
Definition indexsets.hh:326
hierarchic index set of ALU3dGrid
Definition indexsets.hh:944
hierarchic index set of ALU3dGrid
Definition indexsets.hh:38
Definition 3d/grid.hh:82
Factory class for ALUGrids.
Definition gridfactory.hh:28
Definition geostorage.hh:23
ALU3dGrid< dim, dimw, hexa, Comm > BaseGrid
Definition 3d/grid.hh:108
ALU3dGrid< dim, dimw, tetra, Comm > BaseGrid
Definition 3d/grid.hh:114
Definition 3d/grid.hh:122
void checkForConformingRefinement(GitterImpl *grid, const bool conformingRefinement)
Definition 3d/grid.hh:124
Definition 3d/grid.hh:137
static int getRank(ALUGridNoComm comm)
Definition 3d/grid.hh:176
GitterImplType * createALUGrid(const std::string &macroName, ALU3DSPACE ProjectVertex *projection, const bool conformingRefinement)
Definition 3d/grid.hh:155
static ALU3DSPACE Gitter::Geometric::BuilderIF & getBuilder(GitterImplType &grid)
Definition 3d/grid.hh:178
CollectiveCommunication ccobj_
Definition 3d/grid.hh:192
void print(std::ostream &out) const
Definition 3d/grid.hh:189
Dune::CollectiveCommunication< No_Comm > CollectiveCommunication
Definition 3d/grid.hh:149
GitterImplType * createALUGrid(std::istream &stream, ALU3DSPACE ProjectVertex *projection, const bool conformingRefinement)
Definition 3d/grid.hh:165
static void completeGrid(GitterImplType &grid)
Definition 3d/grid.hh:187
ALU3dGridCommunications(ALUGridNoComm comm)
Definition 3d/grid.hh:151
ALU3DSPACE GitterDuneImpl GitterImplType
Definition 3d/grid.hh:147
ALU3dGridLocalIdSet< dim, dimworld, elType, ALUGridNoComm > GlobalIdSet
Definition 3d/grid.hh:144
static ALUGridNoComm defaultComm()
Definition 3d/grid.hh:174
Definition 3d/grid.hh:274
TrivialTwists< GenericGeometry::SimplexTopology< dim >::type::id, dim > Type
Definition 3d/grid.hh:279
TrivialTwists< GenericGeometry::CubeTopology< dim >::type::id, dim > Type
Definition 3d/grid.hh:285
ALUTwists< dim==2 ? 2 :ElementTopologyMapping< elType >::numVerticesPerFace, dim-1 > Type
Definition 3d/grid.hh:291
ALUTwists< 2, 1 > Type
Definition 3d/grid.hh:297
TrivialTwists< 0u, 0 > Type
Definition 3d/grid.hh:303
TrivialTwists< 0u, 0 > Type
Definition 3d/grid.hh:309
Definition 3d/grid.hh:319
ALU3dGridLocalIdSet< dim, dimworld, elType, Comm > LocalIdSetImp
Type of the local id set.
Definition 3d/grid.hh:327
static const int dimworld
Definition 3d/grid.hh:321
ALU3dGridFamily< dim, dimworld, elType, Comm > GridFamily
Definition 3d/grid.hh:324
ALU3dGridCommunications< dim, dimworld, elType, Comm >::GlobalId GlobalIdType
type of ALU3dGrids global id
Definition 3d/grid.hh:333
ALU3dGrid< dim, dimworld, elType, Comm > GridImp
Definition 3d/grid.hh:323
Traits::LeafIndexSetImp LeafIndexSetImp
Type of the leaf index set implementation.
Definition 3d/grid.hh:429
ALU3dGridCommunications< dim, dimworld, elType, Comm >::GlobalIdSet GlobalIdSetImp
Type of the global id set.
Definition 3d/grid.hh:330
int LocalIdType
type of ALU3dGrids local id
Definition 3d/grid.hh:336
static const int dim
Definition 3d/grid.hh:320
Traits::LevelIndexSetImp LevelIndexSetImp
Type of the level index set implementation.
Definition 3d/grid.hh:426
Definition 3d/grid.hh:339
IndexSet< Grid, LeafIndexSetImp > LeafIndexSet
Definition 3d/grid.hh:417
GridFamily::LocalIdType LocalIdType
type of ALU3dGrids local id
Definition 3d/grid.hh:341
DefaultIndexSet< GridImp, typename Codim< 0 >::LeafIterator > LeafIndexSetImp
Type of the leaf index set.
Definition 3d/grid.hh:414
Partition< All_Partition >::LeafGridView LeafGridView
Definition 3d/grid.hh:407
DefaultIndexSet< GridImp, typename Codim< 0 >::LevelIterator > LevelIndexSetImp
Type of the level index set.
Definition 3d/grid.hh:411
Partition< All_Partition >::LevelGridView LevelGridView
Definition 3d/grid.hh:408
Dune::EntityIterator< 0, const Grid, ALU3dGridHierarchicIterator< const Grid > > HierarchicIterator
Definition 3d/grid.hh:356
ALU3dGridCommunications< dim, dimworld, elType, Comm >::CollectiveCommunication CollectiveCommunication
Type of the communication class.
Definition 3d/grid.hh:422
IdSet< Grid, GlobalIdSetImp, GlobalIdType > GlobalIdSet
Definition 3d/grid.hh:419
Dune::IntersectionIterator< const Grid, LevelIntersectionIteratorWrapper< const Grid >, LevelIntersectionWrapper< const Grid > > LevelIntersectionIterator
Definition 3d/grid.hh:354
Dune::IntersectionIterator< const Grid, LeafIntersectionIteratorWrapper< const Grid >, LeafIntersectionWrapper< const Grid > > LeafIntersectionIterator
Definition 3d/grid.hh:353
GridFamily::GridImp Grid
Definition 3d/grid.hh:346
IdSet< Grid, LocalIdSetImp, LocalIdType > LocalIdSet
Definition 3d/grid.hh:418
GridFamily::GlobalIdType GlobalIdType
type of ALU3dGrids global id
Definition 3d/grid.hh:344
IndexSet< Grid, LevelIndexSetImp > LevelIndexSet
Definition 3d/grid.hh:416
Partition< All_Partition >::MacroGridView MacroGridView
Definition 3d/grid.hh:406
Dune::IntersectionIterator< const Grid, LeafIntersectionIteratorWrapper< const Grid >, LeafIntersectionWrapper< const Grid > > IntersectionIterator
Definition 3d/grid.hh:351
Dune::Intersection< const Grid, LevelIntersectionWrapper< const Grid > > LevelIntersection
Definition 3d/grid.hh:349
DuneBoundaryProjection< dimworld > DuneBoundaryProjectionType
Definition 3d/grid.hh:358
Dune::Intersection< const Grid, LeafIntersectionWrapper< const Grid > > LeafIntersection
Definition 3d/grid.hh:348
std::vector< const DuneBoundaryProjectionType * > DuneBoundaryProjectionVector
Definition 3d/grid.hh:359
Definition 3d/grid.hh:363
Dune::EntityPointer< const Grid, EntityPointerImpl > EntityPointer
Definition 3d/grid.hh:384
Dune::Geometry< dim-cd, dimworld, const Grid, ALU3dGridGeometry > Geometry
Definition 3d/grid.hh:370
ALU3dGridGeometry< dim-cd, dim, const Grid > LocalGeometryImpl
Definition 3d/grid.hh:369
Partition< All_Partition >::LevelIterator LevelIterator
Definition 3d/grid.hh:394
ALU3dGridTwists< dim, elType, cd >::Type Twists
Definition 3d/grid.hh:364
Twists::Twist Twist
Definition 3d/grid.hh:365
ALU3dGridGeometry< dim-cd, dimworld, const Grid > GeometryImpl
Definition 3d/grid.hh:368
ALU3dGridEntitySeed< cd, const Grid > EntitySeed
Definition 3d/grid.hh:377
Partition< All_Partition >::LeafIterator LeafIterator
Definition 3d/grid.hh:395
ALU3dGridEntity< cd, dim, const Grid > EntityImp
Definition 3d/grid.hh:373
Dune::Geometry< dim-cd, dim, const Grid, ALU3dGridGeometry > LocalGeometry
Definition 3d/grid.hh:371
ALU3dGridEntityPointer< cd, const Grid > EntityPointerImpl
Definition 3d/grid.hh:383
Dune::Entity< cd, dim, const Grid, ALU3dGridEntity > Entity
Definition 3d/grid.hh:374
Dune::EntityIterator< cd, const Grid, ALU3dGridLeafIterator< cd, pitype, const Grid > > LeafIterator
Definition 3d/grid.hh:391
Dune::EntityIterator< cd, const Grid, ALU3dGridLevelIterator< cd, pitype, const Grid > > LevelIterator
Definition 3d/grid.hh:390
Dune::GridView< ALU3dLeafGridViewTraits< const Grid, pitype > > LeafGridView
Definition 3d/grid.hh:402
Dune::GridView< ALU3dLevelGridViewTraits< const Grid, pitype > > LevelGridView
Definition 3d/grid.hh:401
Dune::MacroGridView< const Grid, pitype > MacroGridView
Definition 3d/grid.hh:403
Definition 3d/grid.hh:535
Traits::template Codim< codim >::EntityImp EntityImp
Definition 3d/grid.hh:536
Traits::template Codim< codim >::Twists Twists
Definition 3d/grid.hh:538
Twists::Twist Twist
Definition 3d/grid.hh:539
Traits::template Codim< codim >::EntityPointerImpl EntityPointerImpl
Definition 3d/grid.hh:537
Types for GridView.
Definition 3d/grid.hh:550
GridFamily::Traits::template Partition< pitype >::LeafGridView LeafGridView
Definition 3d/grid.hh:554
GridFamily::Traits::template Partition< pitype >::MacroGridView MacroGridView
Definition 3d/grid.hh:556
GridFamily::Traits::template Partition< pitype >::LevelGridView LevelGridView
Definition 3d/grid.hh:552
Definition indexsets.hh:173
ALUGrid boundary projection implementation DuneBndProjection has to fulfil the DuneBoundaryProjection...
Definition bndprojection.hh:11
type of class for specialization of serial ALUGrid (No_Comm as communicator)
Definition declaration.hh:31
type of class for specialization of parallel ALUGrid (MPI_Comm as communicator)
Definition declaration.hh:39
Definition declaration.hh:78
DefaultIndexSet creates an index set by using the grids persistent container an a given pair of itera...
Definition defaultindexsets.hh:71
Tagging interface to indicate that Grid provides typedef ObjectStreamType.
Definition interfaces.hh:14
Tagging interface to indicate that Grid has HierarchicIndexSet.
Definition interfaces.hh:49
Class that wraps IntersectionIteratorImp of a grid and gets it's internal object from a object stack ...
Definition intersectioniteratorwrapper.hh:26
Definition intersectioniteratorwrapper.hh:226
Class that wraps IntersectionIteratorImp of a grid and gets it's internal object from a object stack ...
Definition intersectioniteratorwrapper.hh:251
Class that wraps IntersectionIteratorImp of a grid and gets it's internal object from a object stack ...
Definition intersectioniteratorwrapper.hh:331
Class that wraps IntersectionIteratorImp of a grid and gets it's internal object from a object stack ...
Definition intersectioniteratorwrapper.hh:355
Definition macrogridview.hh:72
Definition twists.hh:22
Definition twists.hh:433
Definition twists.hh:588