dune-alugrid  2.6-git
alugrid/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 
48 namespace 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 >
82  class ALU3dGridFactory;
83  template <class GridImp, class GeometryImp, int nChild>
85 
86 
87 
88  // Internal Forward Declarations
89  // -----------------------------
90 
91 #if ALU3DGRID_PARALLEL
92  template<int dim, int dimworld, ALU3dGridElementType elType, class Comm = ALUGridMPIComm >
93  class ALU3dGrid;
94 #else // #if ALU3DGRID_PARALLEL
95  template< int dim, int dimworld, ALU3dGridElementType elType, class Comm = ALUGridNoComm >
96  class ALU3dGrid;
97 #endif // #else // #if ALU3DGRID_PARALLEL
98 
99 
100  // Internal Forward Declarations
101  // -----------------------------
102 
103  template < int dim, int dimw, class Comm >
104  struct ALUGridBaseGrid< dim, dimw, cube, Comm >
105  {
107  };
108 
109  template < int dim, int dimw, class Comm >
110  struct ALUGridBaseGrid< dim, dimw, simplex, Comm >
111  {
113  };
114 
115 
116 
117  // ALU3dGridCommunications
118  // -----------------------
120  {
121  template < class GitterImpl >
122  void checkForConformingRefinement( GitterImpl* grid,
123  const bool conformingRefinement )
124  {
125  if( grid && conformingRefinement )
126  {
127  grid->enableConformingClosure();
128  grid->disableGhostCells();
129  }
130  }
131  };
132 
133 
134  template< int dim, int dimworld, ALU3dGridElementType elType, class Comm >
136 
137  template< int dim, int dimworld, ALU3dGridElementType elType >
138  struct ALU3dGridCommunications< dim, dimworld, elType, ALUGridNoComm > : public ALU3dGridCommunicationsBase
139  {
141 
143  typedef int GlobalId;
144 
145  typedef ALU3DSPACE GitterDuneImpl GitterImplType;
146 
147  typedef Dune::CollectiveCommunication< No_Comm > CollectiveCommunication;
148 
150 
151  int nlinks () const { return 0; }
152 
153  GitterImplType *createALUGrid ( const std::string &macroName, ALU3DSPACE ProjectVertex *projection,
154  const bool conformingRefinement )
155  {
156  GitterImplType* grid = ( macroName.empty() ) ?
157  new GitterImplType( dim ) : new GitterImplType ( dim, macroName.c_str(), projection );
158  // check whether conforming refinement should be enabled
159  checkForConformingRefinement( grid, conformingRefinement );
160  return grid ;
161  }
162 
163  GitterImplType *createALUGrid ( std::istream& stream, ALU3DSPACE ProjectVertex *projection,
164  const bool conformingRefinement )
165  {
166  GitterImplType* grid = new GitterImplType ( dim, stream, projection );
167  // check whether conforming refinement should be enabled
168  checkForConformingRefinement( grid, conformingRefinement );
169  return grid ;
170  }
171 
172  static ALUGridNoComm defaultComm () { return ALUGridNoComm(); }
173 
174  static int getRank ( ALUGridNoComm comm ) { return 0; }
175 
176  static typename ALU3DSPACE Gitter::Geometric::BuilderIF &getBuilder ( GitterImplType &grid )
177  {
178  ALU3DSPACE Gitter::Geometric::BuilderIF* builder =
179  dynamic_cast< ALU3DSPACE Gitter::Geometric::BuilderIF* >( &grid.container() );
180  if( ! builder )
181  DUNE_THROW(InvalidStateException,"dynamic_cast of ALUGrid builder failed");
182  return *builder;
183  }
184 
185  static void completeGrid ( GitterImplType &grid ) {}
186 
187  void print( std::ostream& out ) const
188  {}
189 
191  };
192 
193 #if ALU3DGRID_PARALLEL
194  template< int dim, int dimworld, ALU3dGridElementType elType >
195  struct ALU3dGridCommunications< dim, dimworld, elType, ALUGridMPIComm > : public ALU3dGridCommunicationsBase
196  {
198 
200  typedef ALUGridId< ALUMacroKey > GlobalId;
201 
202  typedef ALU3DSPACE GitterDunePll GitterImplType;
203 
204  typedef Dune::CollectiveCommunication< MPI_Comm > CollectiveCommunication;
205 
206  explicit ALU3dGridCommunications ( MPI_Comm comm )
207  : ccobj_( comm ), mpAccess_( comm )
208  {}
209 
210  int nlinks () const { return mpAccess_.sendLinks(); }
211 
212  GitterImplType *createALUGrid ( const std::string &macroName, ALU3DSPACE ProjectVertex *projection,
213  const bool conformingRefinement )
214  {
215  GitterImplType* grid = new GitterImplType( dim, macroName.c_str(), mpAccess_, projection );
216  // check whether conforming refinement should be enabled
217  checkForConformingRefinement( grid, conformingRefinement );
218  return grid;
219  }
220 
221  GitterImplType *createALUGrid ( std::istream& stream, ALU3DSPACE ProjectVertex *projection,
222  const bool conformingRefinement )
223  {
224  GitterImplType* grid = new GitterImplType ( dim, stream, mpAccess_, projection );
225  // check whether conforming refinement should be enabled
226  checkForConformingRefinement( grid, conformingRefinement );
227  return grid ;
228  }
229 
230  static MPI_Comm defaultComm () { return MPI_COMM_WORLD; }
231 
232  static int getRank ( MPI_Comm comm )
233  {
234  int rank = 0;
235  MPI_Comm_rank( comm, &rank );
236  return rank;
237  }
238 
239  void print( std::ostream& out ) const
240  {
241  mpAccess_.printLinkage( out );
242  }
243 
244  static typename ALU3DSPACE Gitter::Geometric::BuilderIF &getBuilder ( GitterImplType &grid )
245  {
246  ALU3DSPACE Gitter::Geometric::BuilderIF* builder =
247  dynamic_cast< ALU3DSPACE Gitter::Geometric::BuilderIF* >( &grid.containerPll() );
248  if( ! builder )
249  DUNE_THROW(InvalidStateException,"dynamic_cast of ALUGrid builder failed");
250  return *builder;
251  }
252 
253  static void completeGrid ( GitterImplType &grid )
254  {
255  // setup communication patterns
256  grid.notifyMacroGridChanges();
257  // rebuild ghost cells
258  grid.rebuildGhostCells();
259  }
260 
261  CollectiveCommunication ccobj_;
262  ALU3DSPACE MpAccessMPI mpAccess_;
263  };
264 #endif // #if ALU3DGRID_PARALLEL
265 
266 
267 
268  // ALU3dGridTwist
269  // --------------
270 
271  template< int dim, ALU3dGridElementType elType, int codim >
273 
274  template<int dim>
275  struct ALU3dGridTwists< dim, tetra, 0 >
276  {
278  };
279 
280  template<int dim>
281  struct ALU3dGridTwists< dim, hexa, 0 >
282  {
284  };
285 
286  template< int dim, ALU3dGridElementType elType >
287  struct ALU3dGridTwists< dim, elType, 1 >
288  {
290  };
291 
292  template< ALU3dGridElementType elType >
293  struct ALU3dGridTwists< 3, elType, 2 >
294  {
296  };
297 
298  template< ALU3dGridElementType elType >
299  struct ALU3dGridTwists< 2, elType, 2 >
300  {
302  };
303 
304  template< int dim, ALU3dGridElementType elType >
305  struct ALU3dGridTwists< dim, elType, 3 >
306  {
308  };
309 
310 
311 
312  // ALU3dGridFamily
313  // ---------------
314 
315  template< int dimG, int dimW, ALU3dGridElementType elType, class Comm >
317  {
318  static const int dim = dimG;
319  static const int dimworld = dimW;
320 
323 
326 
329 
332 
334  typedef int LocalIdType;
335 
336  struct Traits
337  {
340 
343 
344  typedef typename GridFamily::GridImp Grid;
345 
346  typedef Dune::Intersection< const Grid, LeafIntersectionWrapper< const Grid > > LeafIntersection;
347  typedef Dune::Intersection< const Grid, LevelIntersectionWrapper< const Grid > > LevelIntersection;
348 
349  typedef Dune::IntersectionIterator< const Grid, LeafIntersectionIteratorWrapper< const Grid >, LeafIntersectionWrapper< const Grid > > IntersectionIterator;
350 
351  typedef Dune::IntersectionIterator< const Grid, LeafIntersectionIteratorWrapper< const Grid >, LeafIntersectionWrapper< const Grid > > LeafIntersectionIterator;
352  typedef Dune::IntersectionIterator< const Grid, LevelIntersectionIteratorWrapper< const Grid >, LevelIntersectionWrapper< const Grid > > LevelIntersectionIterator;
353 
354  typedef Dune::EntityIterator< 0, const Grid, ALU3dGridHierarchicIterator< const Grid > > HierarchicIterator;
355 
356  typedef DuneBoundaryProjection< dimworld > DuneBoundaryProjectionType;
357  typedef std::vector< const DuneBoundaryProjectionType * > DuneBoundaryProjectionVector;
358 
359  template< int cd >
360  struct Codim
361  {
363  typedef typename Twists::Twist Twist;
364 
365  // IMPORTANT: Codim<codim>::Geometry == Geometry<dim-codim,dimw>
368  typedef Dune::Geometry< dim-cd, dimworld, const Grid, ALU3dGridGeometry > Geometry;
369  typedef Dune::Geometry< dim-cd, dim, const Grid, ALU3dGridGeometry > LocalGeometry;
370 
372  typedef Dune::Entity< cd, dim, const Grid, ALU3dGridEntity > Entity;
373 
374  // minimal information to generate entities
376 
377 #if ! DUNE_VERSION_NEWER(DUNE_GRID,2,5)
380 #endif
381 
382  template< PartitionIteratorType pitype >
383  struct Partition
384  {
385  typedef Dune::EntityIterator< cd, const Grid, ALU3dGridLevelIterator< cd, pitype, const Grid > > LevelIterator;
386  typedef Dune::EntityIterator< cd, const Grid, ALU3dGridLeafIterator< cd, pitype, const Grid > > LeafIterator;
387  }; // struct Partition
388 
391  }; // struct Codim
392 
393  template< PartitionIteratorType pitype >
394  struct Partition
395  {
396  typedef Dune::GridView< ALU3dLevelGridViewTraits< const Grid, pitype > > LevelGridView;
397  typedef Dune::GridView< ALU3dLeafGridViewTraits< const Grid, pitype > > LeafGridView;
399  }; // struct Partition
400 
404 
407 
410 
411  typedef IndexSet< Grid, LevelIndexSetImp > LevelIndexSet;
412  typedef IndexSet< Grid, LeafIndexSetImp > LeafIndexSet;
413  typedef IdSet< Grid, LocalIdSetImp, LocalIdType > LocalIdSet;
414  typedef IdSet< Grid, GlobalIdSetImp, GlobalIdType > GlobalIdSet;
415 
418  }; // struct Traits
419 
422 
425 
426  }; // struct ALU3dGridFamily
427 
428 
429 
430  //**********************************************************************
431  //
432  // --ALU3dGrid
433  // --Grid
434  //
435  //**********************************************************************
436 
457  template< int dim, int dimworld, ALU3dGridElementType elType, class Comm >
458  class ALU3dGrid
459  : public GridDefaultImplementation< dim, dimworld, alu3d_ctype,
460  ALU3dGridFamily< dim, dimworld, elType, Comm > >,
461  public HasObjectStream,
462  public HasHierarchicIndexSet
463  {
465  typedef GridDefaultImplementation< dim, dimworld, alu3d_ctype, ALU3dGridFamily< dim, dimworld, elType, Comm > > BaseType;
466 
467  // for compatibility: MyType := ThisType
468  typedef ThisType MyType;
469 
470  // friend declarations
471  friend class ALU3dGridEntity< 0, dim, const ThisType>;
472  friend class ALU3dGridEntity< 1, dim, const ThisType>;
473  friend class ALU3dGridEntity< 2, dim, const ThisType>;
474  friend class ALU3dGridEntity< dim, dim, const ThisType>;
475 
476  friend class ALU3dGridIntersectionIterator< ThisType >;
477 
478  friend class ALU3dGridEntityPointerBase< 0, const ThisType >;
479  friend class ALU3dGridEntityPointerBase< 1, const ThisType >;
480  friend class ALU3dGridEntityPointerBase< 2, const ThisType >;
481  friend class ALU3dGridEntityPointerBase< dim, const ThisType >;
482 
483  friend class ALU3dGridEntityPointer< 0, const ThisType >;
484  friend class ALU3dGridEntityPointer< 1, const ThisType >;
485  friend class ALU3dGridEntityPointer< 2, const ThisType >;
486  friend class ALU3dGridEntityPointer< dim, const ThisType >;
487 
488  friend class ALU3dGridIntersectionIterator< const ThisType >;
489  friend class ALU3dGridHierarchicIterator< const ThisType >;
490 
491  friend class ALU3dGridHierarchicIndexSet< dim, dimworld, elType, Comm >;
492  friend class ALU3dGridGlobalIdSet< dim, dimworld, elType, Comm >;
493  friend class ALU3dGridLocalIdSet< dim, dimworld, elType, Comm >;
494 
495  // new intersection iterator is a wrapper which get itersectioniteratoimp as pointers
496  public:
503 
506  friend class LeafIntersectionIteratorWrapper < const ThisType > ;
507  friend class LevelIntersectionIteratorWrapper< const ThisType > ;
508 
509  //**********************************************************
510  // The Interface Methods
511  //**********************************************************
512  public:
513  enum { refineStepsForHalf = 1 };
514 
515  static const ALU3dGridElementType elementType = elType;
516 
517  typedef typename ALU3DSPACE GatherScatterType::ObjectStreamType ObjectStreamType;
520 
522  typedef typename GridFamily::Traits Traits;
523 
524  static const int dimension = BaseType::dimension;
525  static const int dimensionworld = BaseType::dimensionworld;
526 
527  template< int codim >
528  struct Codim
529  : public BaseType::template Codim< codim >
530  {
531  typedef typename Traits::template Codim< codim >::EntityImp EntityImp;
532  typedef typename Traits::template Codim< codim >::Twists Twists;
533  typedef typename Twists::Twist Twist;
534 
535 #if ! DUNE_VERSION_NEWER(DUNE_GRID,2,5)
536  typedef typename Traits::template Codim< codim >::EntityPointerImpl EntityPointerImpl;
537 #endif
538  };
539 
540  protected:
541  typedef MakeableInterfaceObject< typename Traits::template Codim< 0 >::Geometry > GeometryObject;
542  friend class ALULocalGeometryStorage< const ThisType, GeometryObject, 8 >;
543 
544  public:
546  template <PartitionIteratorType pitype>
547  struct Partition
548  {
549  typedef typename GridFamily::Traits::template Partition<pitype>::LevelGridView
551  typedef typename GridFamily::Traits::template Partition<pitype>::LeafGridView
553  typedef typename GridFamily::Traits::template Partition<pitype>::MacroGridView
555  };
560 
563 
568 
569  // type of container for reference elements
570  typedef ReferenceElements< alu3d_ctype, dim > ReferenceElementContainerType;
571  // type of container for reference faces
572  typedef ReferenceElements< alu3d_ctype, dim-1 > ReferenceFaceContainerType;
573 
574  // type of reference element
575  typedef std::decay_t< decltype( ReferenceElementContainerType::general( std::declval< const Dune::GeometryType & >() ) ) > ReferenceElementType;
576  // type of reference face
577  typedef std::decay_t< decltype( ReferenceFaceContainerType::general( std::declval< const Dune::GeometryType & >() ) ) > ReferenceFaceType;
578 
583 
586 
589 
592 
593  protected:
595  // type of ALUGrid boundary projection wrapper
597 
600 
602 
603  public:
606 
608  typedef typename Traits::LocalIdSet LocalIdSet;
609 
610  protected:
612  typedef typename Traits::template Codim< 0 >::LeafIterator LeafIteratorType;
613  typedef typename Traits::template Codim< 0 >::LeafIterator LeafIterator;
614 
616 
618 
620  enum {
623 
625  enum {
630 
631  public:
632  typedef Comm MPICommunicatorType;
633 
635 
636  protected:
639 
641 
642  public:
645  ALU3dGrid ( const std::string &macroTriangFilename,
646  const MPICommunicatorType mpiComm,
647  const DuneBoundaryProjectionType *bndPrj,
648  const DuneBoundaryProjectionVector *bndVec,
649  const ALUGridRefinementType refinementType );
650 
652  virtual ~ALU3dGrid();
653 
655  static inline std::string name ();
656 
660  int maxLevel() const;
661 
663  template<int cd, PartitionIteratorType pitype>
664  typename Traits::template Codim<cd>::template Partition<pitype>::LevelIterator
665  lbegin (int level) const;
666 
668  template<int cd, PartitionIteratorType pitype>
669  typename Traits::template Codim<cd>::template Partition<pitype>::LevelIterator
670  lend (int level) const;
671 
673  template<int cd>
674  typename Traits::template Codim<cd>::
676  lbegin (int level) const;
677 
679  template<int cd>
680  typename Traits::template Codim<cd>::
682  lend (int level) const;
683 
686 
688  ileafbegin( const typename Traits::template Codim< 0 >::Entity& entity ) const
689  {
690  return LefInterItWrapperType( *this,
691  getRealImplementation( entity ),
692  entity.level(), false );
693  }
694 
696  ileafend( const typename Traits::template Codim< 0 >::Entity& entity ) const
697  {
698  return LefInterItWrapperType( *this,
699  getRealImplementation( entity ),
700  entity.level(), true );
701  }
702 
704  ilevelbegin( const typename Traits::template Codim< 0 >::Entity& entity ) const
705  {
706  return LvlInterItWrapperType( *this,
707  getRealImplementation( entity ),
708  entity.level(), false );
709  }
710 
712  ilevelend( const typename Traits::template Codim< 0 >::Entity& entity ) const
713  {
714  return LvlInterItWrapperType( *this,
715  getRealImplementation( entity ),
716  entity.level(), true );
717  }
718 
719  private:
721  template <int codim, PartitionIteratorType pitype>
722  typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
723  leafbegin(int level) const;
724 
726  template <int codim, PartitionIteratorType pitype>
727  typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
728  leafend(int level) const;
729 
731  template <int codim>
732  typename Traits::template Codim<codim>::LeafIterator
733  leafbegin(int level) const;
734 
736  template <int codim>
737  typename Traits::template Codim<codim>::LeafIterator
738  leafend(int level) const;
739 
741  LeafIteratorType leafbegin (int level) const;
742 
744  LeafIteratorType leafend (int level) const;
745 
747  LeafIteratorType leafbegin () const;
748 
750  LeafIteratorType leafend () const;
751 
752  public:
754  template <int codim, PartitionIteratorType pitype>
755  typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
756  leafbegin() const;
757 
759  template <int codim, PartitionIteratorType pitype>
761  leafend() const;
762 
764  template <int codim>
765  typename Traits::template Codim<codim>::LeafIterator
766  leafbegin() const;
767 
769  template <int codim>
770  typename Traits::template Codim<codim>::LeafIterator
771  leafend() const;
772 
773  private:
775  template <int codim, PartitionIteratorType pitype>
777  createLeafIteratorBegin (int level) const;
778 
780  template <int codim, PartitionIteratorType pitype>
782  createLeafIteratorEnd(int level) const;
783 
784  public:
786  int size (int level, int cd) const;
787 
789  int size (int codim) const;
790 
792  int size (int level, GeometryType type) const;
793 
795  size_t numBoundarySegments() const;
796 
798  int size (GeometryType type) const;
799 
801  int global_size (int cd) const ;
802 
803  // (no interface method) number of grid entities in the entire grid for given codim
804  int hierSetSize (int cd) const;
805 
807  const GlobalIdSet &globalIdSet () const
808  {
809  if( !globalIdSet_ )
810  {
811  globalIdSet_.reset( new GlobalIdSetImp( *this ) );
812  }
813  return *globalIdSet_;
814  }
815 
817  template<PartitionIteratorType pitype>
819  {
820  typedef typename Traits::template Partition<pitype>::MacroGridView View;
821  return View(*this);
822  }
823 
826  {
827  typedef MacroGridView View;
828  return View(*this);
829  }
830 
832  template<PartitionIteratorType pitype>
833  DUNE_DEPRECATED_MSG("macroView is deprecated, use macroGridView")
834  typename Partition<pitype>::MacroGridView macroView() const
835  {
836  typedef typename Traits::template Partition<pitype>::MacroGridView View;
837  return View(*this);
838  }
839 
841  DUNE_DEPRECATED_MSG("macroView is deprecated, use macroGridView")
843  {
844  typedef MacroGridView View;
845  return View(*this);
846  }
847 
849  const LocalIdSet & localIdSet () const { return localIdSet_; }
850 
852  const typename Traits :: LeafIndexSet & leafIndexSet () const;
853 
855  const typename Traits :: LevelIndexSet & levelIndexSet (int level) const
856  {
857  assert( (level >= 0) && (level < int( levelIndexVec_.size() )) );
858  if( ! levelIndexVec_[ level ] )
859  {
860  levelIndexVec_[ level ] = createLevelIndexSet( level );
861  }
862  return (*levelIndexVec_[ level ]);
863  }
864 
869  std::shared_ptr< LevelIndexSetImp > accessLevelIndexSet ( int level ) const
870  {
871  assert( (level >= 0) && (level < int( levelIndexVec_.size() )) );
872  if( levelIndexVec_[ level ] )
873  {
874  return levelIndexVec_[ level ];
875  }
876  else
877  {
878  return createLevelIndexSet( level );
879  }
880  }
881 
882  protected:
883  std::shared_ptr< LevelIndexSetImp > createLevelIndexSet ( int level ) const
884  {
885  return std::shared_ptr< LevelIndexSetImp > (new LevelIndexSetImp( *this, lbegin< 0 >( level ), lend< 0 >( level ), level ) );
886  }
887 
888  public:
889  template< int cd >
890  typename Codim< cd >::Twists twists ( GeometryType type ) const
891  {
892  assert( type.dim() == dimension - cd );
893  assert( elType == tetra ? type.isSimplex() : type.isCube() );
894  return typename Traits::template Codim< cd >::Twists();
895  }
896 
897  protected:
898  typedef ALU3DSPACE GatherScatter GatherScatterType;
899 
928  bool loadBalance ( GatherScatterType* lbData );
929 
930  public:
935  bool loadBalance ()
936  {
937  return loadBalance( (GatherScatterType* ) 0 );
938  }
939 
946  template< class DataHandleImpl, class Data >
947  bool loadBalance ( CommDataHandleIF< DataHandleImpl, Data > &dataHandleIF )
948  {
949  typedef ALU3DSPACE GatherScatterLoadBalanceDataHandle
950  < ThisType, GatherScatterType, DataHandleImpl, Data, false > DataHandleType;
951  DataHandleType dataHandle( *this, dataHandleIF );
952 
953  // call the above loadBalance method with general GatherScatterType
954  return loadBalance( &dataHandle );
955  }
956 
966  template< class LBWeights, class DataHandleImpl, class Data >
967  bool loadBalance ( LBWeights &weights,
968  CommDataHandleIF< DataHandleImpl, Data > &dataHandleIF )
969  {
970  typedef ALU3DSPACE GatherScatterLoadBalanceDataHandle
971  < ThisType, LBWeights, DataHandleImpl, Data, false > DataHandleType;
972  DataHandleType dataHandle( *this, dataHandleIF, weights );
973 
974  // call the above loadBalance method with general GatherScatterType
975  return loadBalance( &dataHandle );
976  }
977 
985  template< class LBWeights >
986  typename std::enable_if< !IsDataHandle< LBWeights >::value, bool >::type loadBalance ( LBWeights &weights )
987  {
988  typedef ALU3DSPACE GatherScatterLoadBalance < ThisType, LBWeights, false > LoadBalanceHandleType;
989  LoadBalanceHandleType loadBalanceHandle( *this, weights );
990  return loadBalance( &loadBalanceHandle );
991  }
992 
1001  template< class LBDestinations >
1002  bool repartition ( LBDestinations &destinations )
1003  {
1004  typedef ALU3DSPACE GatherScatterLoadBalance< ThisType, LBDestinations, true > LoadBalanceHandleType ;
1005  LoadBalanceHandleType loadBalanceHandle( *this, destinations );
1006  return loadBalance( &loadBalanceHandle );
1007  }
1008 
1019  template< class LBDestinations, class DataHandleImpl, class Data >
1020  bool repartition ( LBDestinations &destinations,
1021  CommDataHandleIF< DataHandleImpl, Data > &dataHandleIF )
1022  {
1023  typedef ALU3DSPACE GatherScatterLoadBalanceDataHandle< ThisType, LBDestinations, DataHandleImpl, Data, true > DataHandleType;
1024  DataHandleType dataHandle( *this, dataHandleIF, destinations );
1025 
1026  // call the above loadBalance method with general GatherScatterType
1027  return loadBalance( &dataHandle );
1028  }
1029 
1030 
1032  int ghostSize (int level, int codim) const;
1033 
1035  int overlapSize (int level, int codim) const { return 0; }
1036 
1038  int ghostSize (int codim) const;
1039 
1041  int overlapSize (int codim) const { return 0; }
1042 
1044  template< class DataHandle, class Data >
1045  LevelCommunication communicate ( CommDataHandleIF< DataHandle, Data > &data,
1046  InterfaceType iftype,
1047  CommunicationDirection dir,
1048  int level ) const
1049  {
1050  return LevelCommunication( *this, data, iftype, dir, level );
1051  }
1052 
1056  template< class DataHandle, class Data >
1057  LeafCommunication communicate ( CommDataHandleIF< DataHandle, Data > &data,
1058  InterfaceType iftype,
1059  CommunicationDirection dir ) const
1060  {
1061  return LeafCommunication( *this, data, iftype, dir );
1062  }
1063 
1064  protected:
1065  // load balance and compress memory if possible
1066  void finalizeGridCreation();
1067 
1069  void clearIsNewMarkers( );
1070 
1071  public:
1073  const CollectiveCommunication &comm () const { return communications().ccobj_; }
1074 
1076  bool preAdapt ( );
1077 
1079  void postAdapt ( );
1080 
1082  bool adapt ();
1083 
1088  template< class GridImp, class DataHandle >
1089  bool adapt ( AdaptDataHandleInterface< GridImp, DataHandle > &handle );
1090 
1092  void globalRefine ( int refCount );
1093 
1094  template< class GridImp, class DataHandle >
1095  void globalRefine ( int refCount, AdaptDataHandleInterface< GridImp, DataHandle > &handle );
1096 
1097  //**********************************************************
1098  // End of Interface Methods
1099  //**********************************************************
1100 
1102  bool writeMacroGrid( const std::string path, const std::string filename,
1103  const ALU3DSPACE MacroFileHeader::Format format = ALU3DSPACE MacroFileHeader::defaultFormat ) const ;
1104 
1106  void backup( std::ostream&, const ALU3DSPACE MacroFileHeader::Format format ) const ;
1107 
1109  void restore( std::istream& ) ;
1110 
1111  // (no interface method) get hierarchic index set of the grid
1112  const HierarchicIndexSet & hierarchicIndexSet () const { return hIndexSet_; }
1113 
1114  // no interface method, but has to be public
1115  void updateStatus ();
1116 
1118  bool mark( int refCount , const typename Traits::template Codim<0>::Entity & e);
1119 
1121  int getMark( const typename Traits::template Codim<0>::Entity & e) const;
1122 
1123  public:
1125  {
1126  return Communications::defaultComm();
1127  }
1128 
1129  using BaseType :: getRealImplementation ;
1130 
1131  template< class IntersectionType >
1132  static const typename BaseType
1133  :: template ReturnImplementationType< IntersectionType >
1134  :: ImplementationType &
1135  getRealIntersection ( const IntersectionType &intersection )
1136  {
1137  return getRealImplementation( intersection );
1138  }
1139 
1141  const std::vector<GeometryType>& geomTypes (int codim) const { return geomTypes_[codim]; }
1142 
1143  // return reference to org ALU3dGrid
1144  // private method, but otherwise we have to friend class all possible
1145  // types of LevelIterator ==> later
1146  GitterImplType &myGrid () const;
1147 
1148  virtual GitterImplType *createALUGrid ( const std::string &macroName )
1149  {
1151  return communications_->createALUGrid( macroName, vertexProjection(), conformingRefinement() );
1152  }
1153 
1154  virtual GitterImplType *createALUGrid ( std::istream& stream )
1155  {
1157  return communications_->createALUGrid( stream, vertexProjection(), conformingRefinement() );
1158  }
1159 
1161 
1162  // return appropriate ALUGrid builder
1163  virtual typename ALU3DSPACE Gitter::Geometric::BuilderIF &getBuilder () const
1164  {
1165  return Communications::getBuilder( myGrid() );
1166  }
1167 
1168  // helper function for factory
1169  virtual void completeGrid ()
1170  {
1171  Communications::completeGrid( myGrid() );
1173  // update macro boundary segment index
1175  }
1176 
1179  {
1180  static const auto& refElem = ( elType == tetra ) ?
1183  return refElem ;
1184  }
1185 
1188  {
1189  static const auto& refElem = ( elType == tetra ) ?
1192  return refElem ;
1193  }
1194 
1195  template < class EntitySeed >
1196  typename Traits :: template Codim< EntitySeed :: codimension > :: EntityPointer
1197  entityPointer( const EntitySeed& seed ) const
1198  {
1199  enum { codim = EntitySeed :: codimension };
1200  return typename Traits :: template Codim< codim > :: EntityPointerImpl( seed );
1201  }
1202 
1203  template < class EntitySeed >
1204  typename Traits :: template Codim< EntitySeed :: codimension > :: Entity
1205  entity( const EntitySeed& seed ) const
1206  {
1207  typedef typename Traits :: template Codim< EntitySeed :: codimension > :: Entity Entity;
1208  return Entity( typename Traits :: template Codim< EntitySeed :: codimension > :: EntityImp( seed ) );
1209  }
1210 
1211  // number of links to other processors, for internal use only
1212  int nlinks () const { return communications().nlinks(); }
1213 
1215  {
1217  return leafVertexList_;
1218  }
1219 
1221  {
1223  return leafVertexList_.getLevel(vertex);
1224  }
1225 
1226  VertexListType & getVertexList(int level) const
1227  {
1228  alugrid_assert ( level >= 0 );
1229  alugrid_assert ( level <= maxLevel() );
1230  VertexListType & vxList = vertexList_[level];
1231  if(!vxList.up2Date()) vxList.setupVxList(*this,level);
1232  return vxList;
1233  }
1234 
1236  {
1237  alugrid_assert ( codim >= 1 );
1238  alugrid_assert ( codim <= 3 );
1239  return ghostLeafList_[codim-1];
1240  }
1241 
1242  ALU3dGridItemListType & getGhostLevelList(int codim, int level) const
1243  {
1244  alugrid_assert ( codim >= 1 );
1245  alugrid_assert ( codim <= 3 );
1246 
1247  alugrid_assert ( level >= 0 );
1248  alugrid_assert ( level <= maxLevel() );
1249  alugrid_assert ( level < int(ghostLevelList_[codim-1].size()) );
1250  return ghostLevelList_[codim-1][level];
1251  }
1252 
1254  {
1255  alugrid_assert ( level >= 0 );
1256  alugrid_assert ( level <= maxLevel() );
1257  return levelEdgeList_[level];
1258  }
1259 
1260  protected:
1262  ALU3dGrid( const ThisType & );
1263 
1265  const ThisType &operator= ( const ThisType & );
1266 
1268  void calcExtras();
1269 
1271  void calcMaxLevel();
1272 
1275 
1277  void checkMacroGridFile (const std::string filename);
1278 
1280  void checkMacroGrid ();
1281 
1283  const DuneBoundaryProjectionType* boundaryProjection(const int segmentId) const
1284  {
1285  if( bndPrj_ )
1286  {
1287  return bndPrj_;
1288  }
1289  else
1290  {
1291  // pointer can be zero (which is emulates the identity mapping then)
1292  alugrid_assert ( bndVec_ );
1293  alugrid_assert ( segmentId < (int) bndVec_->size() );
1294  return (*bndVec_)[ segmentId ];
1295  }
1296  }
1297 
1299  {
1301  return *communications_;
1302  }
1303 
1304  // initialize geometry types and return correct geometryInFather storage
1305  void makeGeometries();
1306 
1307  public:
1308  // return true if conforming refinement is enabled
1310  {
1311  return (refinementType_ == conforming) ;
1312  }
1313 
1314  // return true if ghost cells are available
1315  bool ghostCellsEnabled () const
1316  {
1317  return comm().size() > 1 && myGrid().ghostCellsEnabled();
1318  }
1319 
1321  {
1323  {
1325  }
1328  }
1329 
1330  protected:
1332  //
1333  // Internal variables
1334  //
1336 
1337  // the real ALU grid
1338  mutable std::unique_ptr< GitterImplType > mygrid_;
1339 
1340  // max level of grid
1342 
1343  // count how much elements where marked
1344  mutable int coarsenMarked_;
1345  mutable int refineMarked_;
1346 
1347  // at the moment the number of different geom types is 1
1348  enum { numberOfGeomTypes = 1 };
1349  std::vector< std::vector<GeometryType> > geomTypes_;
1350 
1351  // our hierarchic index set
1353 
1354  // out global id set
1355  mutable std::unique_ptr< GlobalIdSetImp > globalIdSet_;
1356 
1357  // out global id set
1359 
1360  // the level index set ( default type )
1361  mutable std::vector < std::shared_ptr< LevelIndexSetImp > > levelIndexVec_;
1362 
1363  // the leaf index set
1364  mutable std::unique_ptr< LeafIndexSetImp > leafIndexSet_;
1365 
1366  mutable std::vector< VertexListType > vertexList_;
1367 
1368  //the ghostleaf list is used in alu3diterators, where we use the internal aluIterators
1369  // the vertex codim there is 3, so the list has to fulfill that
1371  mutable std::vector< ALU3dGridItemListType > ghostLevelList_[ 3 ];
1372 
1373  mutable std::vector< ALU3dGridItemListType > levelEdgeList_;
1374 
1376 
1377  // the type of our size cache
1378  typedef SizeCache<MyType> SizeCacheType;
1379  std::unique_ptr< SizeCacheType > sizeCache_;
1380 
1381  // macro boundary segment index
1383 
1384  // variable to ensure that postAdapt ist called after adapt
1386 
1387  // pointer to Dune boundary projection
1389 
1390  // pointer to Dune boundary projection
1391  std::unique_ptr< const DuneBoundaryProjectionVector > bndVec_;
1392 
1393  // boundary projection for vertices
1394  std::unique_ptr< ALUGridBoundaryProjectionType > vertexProjection_ ;
1395 
1396  // pointer to communications object
1397  std::unique_ptr< Communications > communications_;
1398 
1399  // refinement type (nonconforming or conforming)
1401  }; // end class ALU3dGrid
1402 
1403 
1405  const std::string filename );
1406  const char* elType2Name( ALU3dGridElementType elType );
1407 
1408  namespace Capabilities
1409  {
1410 
1411  template< int dim, int dimworld, ALU3dGridElementType elType, class Comm, int cdim >
1412  struct hasEntity< Dune::ALU3dGrid< dim, dimworld, elType, Comm >, cdim >
1413  {
1414  static const bool v = true;
1415  };
1416 
1417 #if !DUNE_VERSION_NEWER(DUNE_GRID,2,5)
1418  template< int dim, int dimworld, ALU3dGridElementType elType, class Comm >
1419  struct isParallel< ALU3dGrid< dim, dimworld, elType, Comm > >
1420  {
1421  static const bool v = true;
1422  };
1423 #endif //#if !DUNE_VERSION_NEWER(DUNE_GRID,2,5)
1424 
1425  template< int dim, int dimworld, ALU3dGridElementType elType, class Comm >
1426  struct isLevelwiseConforming< ALU3dGrid< dim, dimworld, elType, Comm > >
1427  {
1428  static const bool v = true;
1429  };
1430 
1431  template< int dim, int dimworld, ALU3dGridElementType elType, class Comm >
1432  struct hasBackupRestoreFacilities< ALU3dGrid< dim, dimworld, elType, Comm > >
1433  {
1434  static const bool v = true;
1435  };
1436 
1437  } // end namespace Capabilities
1438 
1439 } // end namespace Dune
1440 
1441 #include "grid_inline.hh"
1442 #if COMPILE_ALUGRID_INLINE
1443  #include "grid_imp.cc"
1444 #endif
1445 #endif
#define ALU3DSPACE
Definition: alu3dinclude.hh:24
#define alugrid_assert(EX)
Definition: alugrid_assert.hh:20
Provides default index set implementations for Level- and LeafIndexsets used by ALUGrid.
Provides a Interfaces for detection of specific behavior.
Provides proxy classes for IntersectionsIterators.
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:651
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
bool up2Date() const
Definition: alu3dinclude.hh:357
void setupVxList(const GridType &grid, int level)
Definition: alu3dinclude.hh:381
void setupVxList(const GridType &grid)
int getLevel(const VertexType &vertex) const
Definition: alu3dinclude.hh:406
bool up2Date() const
Definition: alu3dinclude.hh:394
Definition: alu3dinclude.hh:426
Definition: communication.hh:26
Definition: communication.hh:29
[ provides Dune::Grid ]
Definition: alugrid/3d/grid.hh:463
int ghostSize(int level, int codim) const
ghostSize is one for codim 0 and zero otherwise for this grid
Definition: grid_imp.cc:281
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:534
bool repartition(LBDestinations &destinations, CommDataHandleIF< DataHandleImpl, Data > &dataHandleIF)
Distribute the grid based on a user defined partitioning.
Definition: alugrid/3d/grid.hh:1020
int getLevelOfLeafVertex(const typename ALU3dImplTraits< elType, Comm >::VertexType &vertex) const
Definition: alugrid/3d/grid.hh:1220
ALUGridBoundaryProjection< ThisType, alu3d_ctype > ALUGridBoundaryProjectionType
Definition: alugrid/3d/grid.hh:596
MakeableInterfaceObject< typename Traits::template Codim< 0 >::Geometry > GeometryObject
Definition: alugrid/3d/grid.hh:541
Traits::template Codim< codim >::template Partition< pitype >::LeafIterator leafbegin() const
General definiton for a leaf iterator.
const HierarchicIndexSet & hierarchicIndexSet() const
Definition: alugrid/3d/grid.hh:1112
Traits::CollectiveCommunication CollectiveCommunication
type of collective communication object
Definition: alugrid/3d/grid.hh:588
ALU3dGridIntersectionIterator< const ThisType > IntersectionIteratorImp
Definition: alugrid/3d/grid.hh:498
void globalRefine(int refCount)
uses the interface, mark on entity and refineLocal
Definition: grid_imp.cc:405
void calcExtras()
reset size and global size, update Level- and LeafIndexSet, if they exist
Definition: grid_imp.cc:331
static const int dimensionworld
Definition: alugrid/3d/grid.hh:525
bool mark(int refCount, const typename Traits::template Codim< 0 >::Entity &e)
Definition: grid_inline.hh:306
LevelCommunication communicate(CommDataHandleIF< DataHandle, Data > &data, InterfaceType iftype, CommunicationDirection dir, int level) const
Definition: alugrid/3d/grid.hh:1045
int overlapSize(int level, int codim) const
overlapSize is zero for this grid
Definition: alugrid/3d/grid.hh:1035
bool preAdapt()
returns if a least one entity was marked for coarsening
Definition: grid_imp.cc:421
bool loadBalance()
Calculates load of each process and repartition by using ALUGrid's default partitioning method....
Definition: alugrid/3d/grid.hh:935
int coarsenMarked_
Definition: alugrid/3d/grid.hh:1344
std::unique_ptr< Communications > communications_
Definition: alugrid/3d/grid.hh:1397
Partition< pitype >::MacroGridView macroGridView() const
View for te macro grid with some alu specific methods.
Definition: alugrid/3d/grid.hh:818
Traits::template Codim< codim >::template Partition< pitype >::LeafIterator leafend() const
General definition for an end iterator on leaf level.
ALU3dGridLevelIntersectionIterator< const ThisType > LevelIntersectionIteratorImp
Definition: alugrid/3d/grid.hh:502
ALU3dGrid(const ThisType &)
Copy constructor should not be used.
Traits ::template Codim< EntitySeed ::codimension >::EntityPointer entityPointer(const EntitySeed &seed) const
Definition: alugrid/3d/grid.hh:1197
ALUGridVertexProjectionType * vertexProjection()
Definition: alugrid/3d/grid.hh:1160
Traits::template Codim< codim >::LeafIterator leafend() const
General definition for an end iterator on leaf level.
virtual ALU3DSPACE Gitter::Geometric::BuilderIF & getBuilder() const
Definition: alugrid/3d/grid.hh:1163
static const ReferenceFaceType & faceReferenceElement()
return reference to Dune face reference element according to elType
Definition: alugrid/3d/grid.hh:1187
HierarchicIndexSet hIndexSet_
Definition: alugrid/3d/grid.hh:1352
Traits::LeafIntersectionIterator ileafend(const typename Traits::template Codim< 0 >::Entity &entity) const
Definition: alugrid/3d/grid.hh:696
std::unique_ptr< const DuneBoundaryProjectionVector > bndVec_
Definition: alugrid/3d/grid.hh:1391
Traits::template Codim< 0 >::LeafIterator LeafIterator
Definition: alugrid/3d/grid.hh:613
std::vector< std::shared_ptr< LevelIndexSetImp > > levelIndexVec_
Definition: alugrid/3d/grid.hh:1361
int maxLevel() const
Return maximum level defined in this grid. Levels are numbered maxLevel with 0 the coarsest level.
Definition: grid_inline.hh:107
ALULeafCommunication< dim, dimworld, elType, Comm > LeafCommunication
Definition: alugrid/3d/grid.hh:590
GridFamily::Traits Traits
Definition: alugrid/3d/grid.hh:522
Traits::DuneBoundaryProjectionType DuneBoundaryProjectionType
boundary projection type
Definition: alugrid/3d/grid.hh:580
ALU3dGridCommunications< dim, dimworld, elType, Comm > Communications
Definition: alugrid/3d/grid.hh:634
int hierSetSize(int cd) const
Definition: grid_inline.hh:99
static const ReferenceElementType & referenceElement()
return reference to Dune reference element according to elType
Definition: alugrid/3d/grid.hh:1178
GitterImplType & myGrid() const
Definition: grid_inline.hh:115
Traits::LocalIdSet LocalIdSet
Type of the local id set.
Definition: alugrid/3d/grid.hh:608
void finalizeGridCreation()
Definition: grid_inline.hh:428
std::shared_ptr< LevelIndexSetImp > createLevelIndexSet(int level) const
Definition: alugrid/3d/grid.hh:883
const Communications & communications() const
Definition: alugrid/3d/grid.hh:1298
static MPICommunicatorType defaultCommunicator()
Definition: alugrid/3d/grid.hh:1124
ALULevelCommunication< dim, dimworld, elType, Comm > LevelCommunication
Definition: alugrid/3d/grid.hh:591
Partition< pitype >::MacroGridView macroView() const
View for te macro grid with some alu specific methods.
Definition: alugrid/3d/grid.hh:834
std::decay_t< decltype(ReferenceElementContainerType::general(std::declval< const Dune::GeometryType & >))) > ReferenceElementType
Definition: alugrid/3d/grid.hh:575
const Traits ::LevelIndexSet & levelIndexSet(int level) const
get level index set of the grid
Definition: alugrid/3d/grid.hh:855
ALU3DSPACE GatherScatterType::ObjectStreamType ObjectStreamType
Definition: alugrid/3d/grid.hh:517
bool adapt()
Definition: grid_imp.cc:430
void checkMacroGridFile(const std::string filename)
check whether macro grid format is of our type
Definition: grid_imp.cc:592
bool loadBalance(LBWeights &weights, CommDataHandleIF< DataHandleImpl, Data > &dataHandleIF)
Calculates load of each process and repartition by using ALUGrid's default partitioning method,...
Definition: alugrid/3d/grid.hh:967
const GlobalIdSet & globalIdSet() const
get global id set of grid
Definition: alugrid/3d/grid.hh:807
std::unique_ptr< ALUGridBoundaryProjectionType > vertexProjection_
Definition: alugrid/3d/grid.hh:1394
int maxlevel_
Definition: alugrid/3d/grid.hh:1341
BoundarySegmentIndexSetType macroBoundarySegmentIndexSet_
Definition: alugrid/3d/grid.hh:1382
Traits::template Codim< codim >::LeafIterator leafbegin() const
General definiton for a leaf iterator.
ALU3dGridIntersectionIterator< const ThisType > LeafIntersectionIteratorImp
Definition: alugrid/3d/grid.hh:500
ALU3DSPACE ProjectVertex ALUGridVertexProjectionType
type of ALUGrid Vertex Projection Interface
Definition: alugrid/3d/grid.hh:585
bool repartition(LBDestinations &destinations)
Distribute the grid based on a user defined partitioning.
Definition: alugrid/3d/grid.hh:1002
bool ghostCellsEnabled() const
Definition: alugrid/3d/grid.hh:1315
ALU3dGridLeafIterator< 0, All_Partition, const ThisType > LeafIteratorImp
Definition: alugrid/3d/grid.hh:611
static std::string name()
for grid identification
Definition: grid_inline.hh:446
bool lockPostAdapt_
Definition: alugrid/3d/grid.hh:1385
const ThisType & operator=(const ThisType &)
assignment operator should not be used
Definition: grid_imp.cc:194
const DuneBoundaryProjectionType * boundaryProjection(const int segmentId) const
return boudanry projection for given segment Id
Definition: alugrid/3d/grid.hh:1283
static const int dimension
Definition: alugrid/3d/grid.hh:524
LeafIntersectionIteratorWrapper< const ThisType > LefInterItWrapperType
Definition: alugrid/3d/grid.hh:684
std::shared_ptr< LevelIndexSetImp > accessLevelIndexSet(int level) const
return instance of level index set
Definition: alugrid/3d/grid.hh:869
std::unique_ptr< GlobalIdSetImp > globalIdSet_
Definition: alugrid/3d/grid.hh:1355
Traits ::template Codim< EntitySeed ::codimension >::Entity entity(const EntitySeed &seed) const
Definition: alugrid/3d/grid.hh:1205
ALU3dGridHierarchicIterator< const ThisType > HierarchicIteratorImp
Definition: alugrid/3d/grid.hh:615
int nlinks() const
Definition: alugrid/3d/grid.hh:1212
ALU3dGridItemListType & getGhostLevelList(int codim, int level) const
Definition: alugrid/3d/grid.hh:1242
Traits::LeafIntersectionIterator ileafbegin(const typename Traits::template Codim< 0 >::Entity &entity) const
Definition: alugrid/3d/grid.hh:688
int refineMarked_
Definition: alugrid/3d/grid.hh:1345
GridFamily::LevelIndexSetImp LevelIndexSetImp
Type of the level index set, needed by data handle.
Definition: alugrid/3d/grid.hh:565
ALU3dGrid(const std::string &macroTriangFilename, const MPICommunicatorType mpiComm, const DuneBoundaryProjectionType *bndPrj, const DuneBoundaryProjectionVector *bndVec, const ALUGridRefinementType refinementType)
Definition: grid_inline.hh:22
GridFamily::LocalIdSetImp LocalIdSetImp
Type of the local id set.
Definition: alugrid/3d/grid.hh:599
ALU3dGridItemListType & getGhostLeafList(int codim) const
Definition: alugrid/3d/grid.hh:1235
std::unique_ptr< SizeCacheType > sizeCache_
Definition: alugrid/3d/grid.hh:1379
Partition< All_Partition >::MacroGridView MacroGridView
Definition: alugrid/3d/grid.hh:559
void recalcGlobalSize()
make grid walkthrough and calc global size
static const ALU3dGridElementType elementType
Definition: alugrid/3d/grid.hh:515
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: alugrid/3d/grid.hh:1057
Codim< cd >::Twists twists(GeometryType type) const
Definition: alugrid/3d/grid.hh:890
void backup(std::ostream &, const ALU3DSPACE MacroFileHeader::Format format) const
backup to ostream
Definition: grid_imp.cc:556
void clearIsNewMarkers()
clear all entity new markers
Definition: grid_imp.cc:478
ObjectStreamType InStreamType
Definition: alugrid/3d/grid.hh:518
void makeGeometries()
Definition: grid_inline.hh:65
ReferenceElements< alu3d_ctype, dim-1 > ReferenceFaceContainerType
Definition: alugrid/3d/grid.hh:572
void updateStatus()
Definition: grid_imp.cc:289
const ALUGridRefinementType refinementType_
Definition: alugrid/3d/grid.hh:1400
@ refineEstimate_
if one element is refined then it causes apporximately not more than this number of new elements
Definition: alugrid/3d/grid.hh:629
Partition< All_Partition >::LevelGridView LevelGridView
View types for All_Partition.
Definition: alugrid/3d/grid.hh:557
void postAdapt()
clear all entity new markers if lockPostAdapt_ is set
Definition: grid_imp.cc:520
void restore(std::istream &)
restore from istream
Definition: grid_imp.cc:564
@ numberOfGeomTypes
Definition: alugrid/3d/grid.hh:1348
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:126
std::vector< std::vector< GeometryType > > geomTypes_
Definition: alugrid/3d/grid.hh:1349
ALU3dGridItemListType & getEdgeList(int level) const
Definition: alugrid/3d/grid.hh:1253
void calcMaxLevel()
calculate maxlevel
Definition: grid_imp.cc:298
bool conformingRefinement() const
Definition: alugrid/3d/grid.hh:1309
std::vector< ALU3dGridItemListType > levelEdgeList_
Definition: alugrid/3d/grid.hh:1373
ObjectStreamType OutStreamType
Definition: alugrid/3d/grid.hh:519
ALU3dGridFamily< dim, dimworld, elType, Comm > GridFamily
Definition: alugrid/3d/grid.hh:521
VertexListType & getVertexList(int level) const
Definition: alugrid/3d/grid.hh:1226
std::unique_ptr< GitterImplType > mygrid_
Definition: alugrid/3d/grid.hh:1338
ALU3dGridLeafVertexList< Comm > LeafVertexListType
Definition: alugrid/3d/grid.hh:638
SizeCache< MyType > SizeCacheType
Definition: alugrid/3d/grid.hh:1378
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: alugrid/3d/grid.hh:637
ALU3dGridItemListType ghostLeafList_[3]
Definition: alugrid/3d/grid.hh:1370
const DuneBoundaryProjectionType * bndPrj_
Definition: alugrid/3d/grid.hh:1388
GridFamily::LeafIndexSetImp LeafIndexSetImp
Type of the leaf index set, needed by data handle.
Definition: alugrid/3d/grid.hh:567
virtual void completeGrid()
Definition: alugrid/3d/grid.hh:1169
Comm MPICommunicatorType
Definition: alugrid/3d/grid.hh:632
ALU3DSPACE GatherScatter GatherScatterType
Definition: alugrid/3d/grid.hh:898
const CollectiveCommunication & comm() const
Definition: alugrid/3d/grid.hh:1073
LeafVertexListType & getLeafVertexList() const
Definition: alugrid/3d/grid.hh:1214
int getMark(const typename Traits::template Codim< 0 >::Entity &e) const
Definition: grid_inline.hh:321
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: alugrid/3d/grid.hh:986
virtual GitterImplType * createALUGrid(std::istream &stream)
Definition: alugrid/3d/grid.hh:1154
virtual GitterImplType * createALUGrid(const std::string &macroName)
Definition: alugrid/3d/grid.hh:1148
Partition< All_Partition >::LeafGridView LeafGridView
Definition: alugrid/3d/grid.hh:558
@ refineStepsForHalf
Definition: alugrid/3d/grid.hh:513
const LocalIdSet & localIdSet() const
get global id set of grid
Definition: alugrid/3d/grid.hh:849
std::vector< VertexListType > vertexList_
Definition: alugrid/3d/grid.hh:1366
ALU3dImplTraits< elType, Comm >::GitterImplType GitterImplType
Definition: alugrid/3d/grid.hh:617
static const BaseType ::template ReturnImplementationType< IntersectionType >::ImplementationType & getRealIntersection(const IntersectionType &intersection)
Definition: alugrid/3d/grid.hh:1135
std::decay_t< decltype(ReferenceFaceContainerType::general(std::declval< const Dune::GeometryType & >))) > ReferenceFaceType
Definition: alugrid/3d/grid.hh:577
MacroGridView macroGridView() const
View for te macro grid with some alu specific methods (All_Partition)
Definition: alugrid/3d/grid.hh:825
Traits::LevelIntersectionIterator ilevelbegin(const typename Traits::template Codim< 0 >::Entity &entity) const
Definition: alugrid/3d/grid.hh:704
LeafVertexListType leafVertexList_
Definition: alugrid/3d/grid.hh:1375
Traits::template Codim< cd >::template Partition< pitype >::LevelIterator lend(int level) const
one past the end on this level
Definition: grid_inline.hh:140
@ newElementsChunk_
normal default number of new elements for new adapt method
Definition: alugrid/3d/grid.hh:622
std::vector< ALU3dGridItemListType > ghostLevelList_[3]
Definition: alugrid/3d/grid.hh:1371
GridFamily::GlobalIdSetImp GlobalIdSetImp
Definition: alugrid/3d/grid.hh:601
bool loadBalance(CommDataHandleIF< DataHandleImpl, Data > &dataHandleIF)
Calculates load of each process and repartition by using ALUGrid's default partitioning method....
Definition: alugrid/3d/grid.hh:947
const BoundarySegmentIndexSetType & macroBoundarySegmentIndexSet() const
Definition: alugrid/3d/grid.hh:1320
Traits::DuneBoundaryProjectionVector DuneBoundaryProjectionVector
boundary projection type
Definition: alugrid/3d/grid.hh:582
int global_size(int cd) const
number of grid entities on all levels for given codim
Definition: grid_inline.hh:89
Traits::template Codim< 0 >::LeafIterator LeafIteratorType
Definition: alugrid/3d/grid.hh:612
Traits::LevelIntersectionIterator ilevelend(const typename Traits::template Codim< 0 >::Entity &entity) const
Definition: alugrid/3d/grid.hh:712
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:631
Traits::GlobalIdSet GlobalIdSet
Type of the global id set.
Definition: alugrid/3d/grid.hh:605
const Traits ::LeafIndexSet & leafIndexSet() const
get leaf index set of the grid
Definition: grid_imp.cc:390
std::unique_ptr< LeafIndexSetImp > leafIndexSet_
Definition: alugrid/3d/grid.hh:1364
DefaultBoundarySegmentIndexSet< ThisType > BoundarySegmentIndexSetType
Definition: alugrid/3d/grid.hh:640
LevelIntersectionIteratorWrapper< const ThisType > LvlInterItWrapperType
Definition: alugrid/3d/grid.hh:685
const std::vector< GeometryType > & geomTypes(int codim) const
deliver all geometry types used in this grid
Definition: alugrid/3d/grid.hh:1141
ALU3dGridHierarchicIndexSet< dim, dimworld, elType, Comm > HierarchicIndexSet
Type of the hierarchic index set.
Definition: alugrid/3d/grid.hh:562
LocalIdSetImp localIdSet_
Definition: alugrid/3d/grid.hh:1358
ReferenceElements< alu3d_ctype, dim > ReferenceElementContainerType
Definition: alugrid/3d/grid.hh:570
int overlapSize(int codim) const
overlapSize is zero for this grid
Definition: alugrid/3d/grid.hh:1041
Definition: entity.hh:47
Definition: entity.hh:629
Definition: geometry.hh:632
Definition: iterator.hh:713
Definition: iterator.hh:56
Leaf iterator.
Definition: iterator.hh:639
Definition: entity.hh:463
Definition: entityseed.hh:212
Definition: iterator.hh:297
Definition: alugrid/3d/grid.hh:72
Definition: alugrid/3d/grid.hh:74
Definition: alugrid/3d/grid.hh:76
Definition: alugrid/3d/grid.hh:78
hierarchic index set of ALU3dGrid
Definition: indexsets.hh:38
Factory class for ALUGrids.
Definition: gridfactory.hh:30
Definition: geostorage.hh:23
ALU3dGrid< dim, dimw, hexa, Comm > BaseGrid
Definition: alugrid/3d/grid.hh:106
ALU3dGrid< dim, dimw, tetra, Comm > BaseGrid
Definition: alugrid/3d/grid.hh:112
Definition: alugrid/3d/grid.hh:120
void checkForConformingRefinement(GitterImpl *grid, const bool conformingRefinement)
Definition: alugrid/3d/grid.hh:122
Definition: alugrid/3d/grid.hh:135
static int getRank(ALUGridNoComm comm)
Definition: alugrid/3d/grid.hh:174
CollectiveCommunication ccobj_
Definition: alugrid/3d/grid.hh:190
static ALU3DSPACE Gitter::Geometric::BuilderIF & getBuilder(GitterImplType &grid)
Definition: alugrid/3d/grid.hh:176
int nlinks() const
Definition: alugrid/3d/grid.hh:151
void print(std::ostream &out) const
Definition: alugrid/3d/grid.hh:187
GitterImplType * createALUGrid(std::istream &stream, ALU3DSPACE ProjectVertex *projection, const bool conformingRefinement)
Definition: alugrid/3d/grid.hh:163
Dune::CollectiveCommunication< No_Comm > CollectiveCommunication
Definition: alugrid/3d/grid.hh:147
GitterImplType * createALUGrid(const std::string &macroName, ALU3DSPACE ProjectVertex *projection, const bool conformingRefinement)
Definition: alugrid/3d/grid.hh:153
static void completeGrid(GitterImplType &grid)
Definition: alugrid/3d/grid.hh:185
ALU3dGridCommunications(ALUGridNoComm comm)
Definition: alugrid/3d/grid.hh:149
ALU3DSPACE GitterDuneImpl GitterImplType
Definition: alugrid/3d/grid.hh:145
ALU3dGridLocalIdSet< dim, dimworld, elType, ALUGridNoComm > GlobalIdSet
Definition: alugrid/3d/grid.hh:142
static ALUGridNoComm defaultComm()
Definition: alugrid/3d/grid.hh:172
Definition: alugrid/3d/grid.hh:272
TrivialTwists< Impl::SimplexTopology< dim >::type::id, dim > Type
Definition: alugrid/3d/grid.hh:277
TrivialTwists< Impl::CubeTopology< dim >::type::id, dim > Type
Definition: alugrid/3d/grid.hh:283
ALUTwists< dim==2 ? 2 :ElementTopologyMapping< elType >::numVerticesPerFace, dim-1 > Type
Definition: alugrid/3d/grid.hh:289
ALUTwists< 2, 1 > Type
Definition: alugrid/3d/grid.hh:295
TrivialTwists< 0u, 0 > Type
Definition: alugrid/3d/grid.hh:301
TrivialTwists< 0u, 0 > Type
Definition: alugrid/3d/grid.hh:307
Definition: alugrid/3d/grid.hh:317
ALU3dGridCommunications< dim, dimworld, elType, Comm >::GlobalIdSet GlobalIdSetImp
Type of the global id set.
Definition: alugrid/3d/grid.hh:328
ALU3dGridCommunications< dim, dimworld, elType, Comm >::GlobalId GlobalIdType
type of ALU3dGrids global id
Definition: alugrid/3d/grid.hh:331
ALU3dGridLocalIdSet< dim, dimworld, elType, Comm > LocalIdSetImp
Type of the local id set.
Definition: alugrid/3d/grid.hh:325
static const int dimworld
Definition: alugrid/3d/grid.hh:319
ALU3dGridFamily< dim, dimworld, elType, Comm > GridFamily
Definition: alugrid/3d/grid.hh:322
Traits ::LevelIndexSetImp LevelIndexSetImp
Type of the level index set implementation.
Definition: alugrid/3d/grid.hh:421
ALU3dGrid< dim, dimworld, elType, Comm > GridImp
Definition: alugrid/3d/grid.hh:321
Traits ::LeafIndexSetImp LeafIndexSetImp
Type of the leaf index set implementation.
Definition: alugrid/3d/grid.hh:424
int LocalIdType
type of ALU3dGrids local id
Definition: alugrid/3d/grid.hh:334
static const int dim
Definition: alugrid/3d/grid.hh:318
Definition: alugrid/3d/grid.hh:337
IndexSet< Grid, LeafIndexSetImp > LeafIndexSet
Definition: alugrid/3d/grid.hh:412
GridFamily::LocalIdType LocalIdType
type of ALU3dGrids local id
Definition: alugrid/3d/grid.hh:339
Partition< All_Partition >::MacroGridView MacroGridView
Definition: alugrid/3d/grid.hh:401
DefaultIndexSet< GridImp, typename Codim< 0 >::LeafIterator > LeafIndexSetImp
Type of the leaf index set.
Definition: alugrid/3d/grid.hh:409
DefaultIndexSet< GridImp, typename Codim< 0 >::LevelIterator > LevelIndexSetImp
Type of the level index set.
Definition: alugrid/3d/grid.hh:406
ALU3dGridCommunications< dim, dimworld, elType, Comm >::CollectiveCommunication CollectiveCommunication
Type of the communication class.
Definition: alugrid/3d/grid.hh:417
Dune::EntityIterator< 0, const Grid, ALU3dGridHierarchicIterator< const Grid > > HierarchicIterator
Definition: alugrid/3d/grid.hh:354
IdSet< Grid, GlobalIdSetImp, GlobalIdType > GlobalIdSet
Definition: alugrid/3d/grid.hh:414
Dune::IntersectionIterator< const Grid, LevelIntersectionIteratorWrapper< const Grid >, LevelIntersectionWrapper< const Grid > > LevelIntersectionIterator
Definition: alugrid/3d/grid.hh:352
Dune::IntersectionIterator< const Grid, LeafIntersectionIteratorWrapper< const Grid >, LeafIntersectionWrapper< const Grid > > LeafIntersectionIterator
Definition: alugrid/3d/grid.hh:351
GridFamily::GridImp Grid
Definition: alugrid/3d/grid.hh:344
IdSet< Grid, LocalIdSetImp, LocalIdType > LocalIdSet
Definition: alugrid/3d/grid.hh:413
GridFamily::GlobalIdType GlobalIdType
type of ALU3dGrids global id
Definition: alugrid/3d/grid.hh:342
IndexSet< Grid, LevelIndexSetImp > LevelIndexSet
Definition: alugrid/3d/grid.hh:411
Partition< All_Partition >::LeafGridView LeafGridView
Definition: alugrid/3d/grid.hh:402
Dune::IntersectionIterator< const Grid, LeafIntersectionIteratorWrapper< const Grid >, LeafIntersectionWrapper< const Grid > > IntersectionIterator
Definition: alugrid/3d/grid.hh:349
Partition< All_Partition >::LevelGridView LevelGridView
Definition: alugrid/3d/grid.hh:403
Dune::Intersection< const Grid, LevelIntersectionWrapper< const Grid > > LevelIntersection
Definition: alugrid/3d/grid.hh:347
DuneBoundaryProjection< dimworld > DuneBoundaryProjectionType
Definition: alugrid/3d/grid.hh:356
Dune::Intersection< const Grid, LeafIntersectionWrapper< const Grid > > LeafIntersection
Definition: alugrid/3d/grid.hh:346
std::vector< const DuneBoundaryProjectionType * > DuneBoundaryProjectionVector
Definition: alugrid/3d/grid.hh:357
Definition: alugrid/3d/grid.hh:361
ALU3dGridTwists< dim, elType, cd >::Type Twists
Definition: alugrid/3d/grid.hh:362
Dune::Geometry< dim-cd, dimworld, const Grid, ALU3dGridGeometry > Geometry
Definition: alugrid/3d/grid.hh:368
ALU3dGridGeometry< dim-cd, dim, const Grid > LocalGeometryImpl
Definition: alugrid/3d/grid.hh:367
Twists::Twist Twist
Definition: alugrid/3d/grid.hh:363
ALU3dGridGeometry< dim-cd, dimworld, const Grid > GeometryImpl
Definition: alugrid/3d/grid.hh:366
ALU3dGridEntitySeed< cd, const Grid > EntitySeed
Definition: alugrid/3d/grid.hh:375
ALU3dGridEntity< cd, dim, const Grid > EntityImp
Definition: alugrid/3d/grid.hh:371
Dune::Geometry< dim-cd, dim, const Grid, ALU3dGridGeometry > LocalGeometry
Definition: alugrid/3d/grid.hh:369
Dune::Entity< cd, dim, const Grid, ALU3dGridEntity > Entity
Definition: alugrid/3d/grid.hh:372
Partition< All_Partition >::LevelIterator LevelIterator
Definition: alugrid/3d/grid.hh:389
EntityImp EntityPointerImpl
Definition: alugrid/3d/grid.hh:378
Partition< All_Partition >::LeafIterator LeafIterator
Definition: alugrid/3d/grid.hh:390
Entity EntityPointer
Definition: alugrid/3d/grid.hh:379
Definition: alugrid/3d/grid.hh:384
Dune::EntityIterator< cd, const Grid, ALU3dGridLeafIterator< cd, pitype, const Grid > > LeafIterator
Definition: alugrid/3d/grid.hh:386
Dune::EntityIterator< cd, const Grid, ALU3dGridLevelIterator< cd, pitype, const Grid > > LevelIterator
Definition: alugrid/3d/grid.hh:385
Definition: alugrid/3d/grid.hh:395
Dune::GridView< ALU3dLeafGridViewTraits< const Grid, pitype > > LeafGridView
Definition: alugrid/3d/grid.hh:397
Dune::GridView< ALU3dLevelGridViewTraits< const Grid, pitype > > LevelGridView
Definition: alugrid/3d/grid.hh:396
Dune::MacroGridView< const Grid, pitype > MacroGridView
Definition: alugrid/3d/grid.hh:398
Definition: alugrid/3d/grid.hh:530
Traits::template Codim< codim >::Twists Twists
Definition: alugrid/3d/grid.hh:532
Traits::template Codim< codim >::EntityPointerImpl EntityPointerImpl
Definition: alugrid/3d/grid.hh:536
Traits::template Codim< codim >::EntityImp EntityImp
Definition: alugrid/3d/grid.hh:531
Twists::Twist Twist
Definition: alugrid/3d/grid.hh:533
Types for GridView.
Definition: alugrid/3d/grid.hh:548
GridFamily::Traits::template Partition< pitype >::LeafGridView LeafGridView
Definition: alugrid/3d/grid.hh:552
GridFamily::Traits::template Partition< pitype >::MacroGridView MacroGridView
Definition: alugrid/3d/grid.hh:554
GridFamily::Traits::template Partition< pitype >::LevelGridView LevelGridView
Definition: alugrid/3d/grid.hh:550
Definition: indexsets.hh:177
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:65
void invalidate()
Definition: defaultindexsets.hh:432
void update(const GridViewType &gridView)
Definition: defaultindexsets.hh:397
bool valid() const
Definition: defaultindexsets.hh:431
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:228
Class that wraps IntersectionIteratorImp of a grid and gets it's internal object from a object stack ...
Definition: intersectioniteratorwrapper.hh:253
Class that wraps IntersectionIteratorImp of a grid and gets it's internal object from a object stack ...
Definition: intersectioniteratorwrapper.hh:333
Class that wraps IntersectionIteratorImp of a grid and gets it's internal object from a object stack ...
Definition: intersectioniteratorwrapper.hh:357
Definition: macrogridview.hh:76
Definition: twists.hh:23
Definition: twists.hh:440
Definition: twists.hh:595