dune-alugrid  2.8-git
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/mpicommunication.hh>
44 #else
45 #include <dune/common/parallel/communication.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  template< int dim, int dimworld, ALU3dGridElementType elType, class Comm >
118 
119  template< int dim, int dimworld, ALU3dGridElementType elType >
120  struct ALU3dGridCommunications< dim, dimworld, elType, ALUGridNoComm >
121  {
123  typedef int GlobalId;
124 
125  typedef ALU3DSPACE GitterDuneImpl GitterImplType;
126 
127  typedef Dune::CollectiveCommunication< No_Comm > CollectiveCommunication;
128 
130 
131  int nlinks () const { return 0; }
132 
133  GitterImplType *createALUGrid ( const std::string &macroName, const ALU3DSPACE ProjectVertexPtrPair& projections,
134  const bool conformingRefinement )
135  {
136  GitterImplType* grid = ( macroName.empty() ) ?
137  new GitterImplType( dim, conformingRefinement ) : new GitterImplType ( dim, conformingRefinement, macroName.c_str(), projections );
138  return grid ;
139  }
140 
141  GitterImplType *createALUGrid ( std::istream& stream, const ALU3DSPACE ProjectVertexPtrPair& projection,
142  const bool conformingRefinement )
143  {
144  return new GitterImplType ( dim, conformingRefinement, stream, projection );
145  }
146 
147  // ALUGridNoComm casts into No_Comm and MPI_Comm and here the default is MPI_COMM_SELF
148  static ALUGridNoComm defaultComm () { return ALUGridNoComm(); }
149 
150  static int getRank ( ALUGridNoComm comm ) { return 0; }
151 
152  static typename ALU3DSPACE Gitter::Geometric::BuilderIF &getBuilder ( GitterImplType &grid )
153  {
154  ALU3DSPACE Gitter::Geometric::BuilderIF* builder =
155  dynamic_cast< ALU3DSPACE Gitter::Geometric::BuilderIF* >( &grid.container() );
156  if( ! builder )
157  DUNE_THROW(InvalidStateException,"dynamic_cast of ALUGrid builder failed");
158  return *builder;
159  }
160 
161  static void completeGrid ( GitterImplType &grid ) {}
162 
163  void print( std::ostream& out ) const
164  {}
165 
167  };
168 
169 #if ALU3DGRID_PARALLEL
170  template< int dim, int dimworld, ALU3dGridElementType elType >
171  struct ALU3dGridCommunications< dim, dimworld, elType, ALUGridMPIComm >
172  {
174  typedef ALUGridId< ALUMacroKey > GlobalId;
175 
176  typedef ALU3DSPACE GitterDunePll GitterImplType;
177 
178  typedef Dune::CollectiveCommunication< MPI_Comm > CollectiveCommunication;
179 
180  explicit ALU3dGridCommunications ( MPI_Comm comm )
181  : ccobj_( comm ), mpAccess_( comm )
182  {}
183 
184  int nlinks () const { return mpAccess_.sendLinks(); }
185 
186  GitterImplType *createALUGrid ( const std::string &macroName, const ALU3DSPACE ProjectVertexPtrPair& projections,
187  const bool conformingRefinement )
188  {
189  return new GitterImplType( dim, conformingRefinement, macroName.c_str(), mpAccess_, projections );
190  }
191 
192  GitterImplType *createALUGrid ( std::istream& stream, const ALU3DSPACE ProjectVertexPtrPair& projections,
193  const bool conformingRefinement )
194  {
195  return new GitterImplType ( dim, conformingRefinement, stream, mpAccess_, projections );
196  }
197 
198  // ALUGridMPIComm casts into MPI_Comm and the default is MPI_COMM_WORLD
199  static ALUGridMPIComm defaultComm () { return ALUGridMPIComm(); }
200 
201  static int getRank ( MPI_Comm comm )
202  {
203  int rank = 0;
204  MPI_Comm_rank( comm, &rank );
205  return rank;
206  }
207 
208  void print( std::ostream& out ) const
209  {
210  mpAccess_.printLinkage( out );
211  }
212 
213  static typename ALU3DSPACE Gitter::Geometric::BuilderIF &getBuilder ( GitterImplType &grid )
214  {
215  ALU3DSPACE Gitter::Geometric::BuilderIF* builder =
216  dynamic_cast< ALU3DSPACE Gitter::Geometric::BuilderIF* >( &grid.containerPll() );
217  if( ! builder )
218  DUNE_THROW(InvalidStateException,"dynamic_cast of ALUGrid builder failed");
219  return *builder;
220  }
221 
222  static void completeGrid ( GitterImplType &grid )
223  {
224  // setup communication patterns
225  grid.notifyMacroGridChanges();
226  // rebuild ghost cells
227  grid.rebuildGhostCells();
228  }
229 
230  CollectiveCommunication ccobj_;
231  ALU3DSPACE MpAccessMPI mpAccess_;
232  };
233 #endif // #if ALU3DGRID_PARALLEL
234 
235 
236 
237  // ALU3dGridTwist
238  // --------------
239 
240  template< int dim, ALU3dGridElementType elType, int codim >
242 
243  template<int dim>
244  struct ALU3dGridTwists< dim, tetra, 0 >
245  {
246  static const unsigned int topoId = GeometryTypes::simplex(dim).id();
248  };
249 
250  template<int dim>
251  struct ALU3dGridTwists< dim, hexa, 0 >
252  {
253  static const unsigned int topoId = GeometryTypes::cube(dim).id();
255  };
256 
257  template< int dim, ALU3dGridElementType elType >
258  struct ALU3dGridTwists< dim, elType, 1 >
259  {
261  };
262 
263  template< ALU3dGridElementType elType >
264  struct ALU3dGridTwists< 3, elType, 2 >
265  {
267  };
268 
269  template< ALU3dGridElementType elType >
270  struct ALU3dGridTwists< 2, elType, 2 >
271  {
273  };
274 
275  template< int dim, ALU3dGridElementType elType >
276  struct ALU3dGridTwists< dim, elType, 3 >
277  {
279  };
280 
281 
282 
283  // ALU3dGridFamily
284  // ---------------
285 
286  template< int dimG, int dimW, ALU3dGridElementType elType, class Comm >
288  {
289  static const int dim = dimG;
290  static const int dimworld = dimW;
291 
294 
297 
300 
303 
305  typedef int LocalIdType;
306 
307  struct Traits
308  {
311 
314 
315  typedef typename GridFamily::GridImp Grid;
316 
317  typedef Dune::Intersection< const Grid, LeafIntersectionWrapper< const Grid > > LeafIntersection;
318  typedef Dune::Intersection< const Grid, LevelIntersectionWrapper< const Grid > > LevelIntersection;
319 
320  typedef Dune::IntersectionIterator< const Grid, LeafIntersectionIteratorWrapper< const Grid >, LeafIntersectionWrapper< const Grid > > IntersectionIterator;
321 
322  typedef Dune::IntersectionIterator< const Grid, LeafIntersectionIteratorWrapper< const Grid >, LeafIntersectionWrapper< const Grid > > LeafIntersectionIterator;
323  typedef Dune::IntersectionIterator< const Grid, LevelIntersectionIteratorWrapper< const Grid >, LevelIntersectionWrapper< const Grid > > LevelIntersectionIterator;
324 
325  typedef Dune::EntityIterator< 0, const Grid, ALU3dGridHierarchicIterator< const Grid > > HierarchicIterator;
326 
327  typedef DuneBoundaryProjection< dimworld > DuneBoundaryProjectionType;
328  typedef std::vector< const DuneBoundaryProjectionType * > DuneBoundaryProjectionVector;
329 
330  template< int cd >
331  struct Codim
332  {
334  typedef typename Twists::Twist Twist;
335 
336  // IMPORTANT: Codim<codim>::Geometry == Geometry<dim-codim,dimw>
339  typedef Dune::Geometry< dim-cd, dimworld, const Grid, ALU3dGridGeometry > Geometry;
340  typedef Dune::Geometry< dim-cd, dim, const Grid, ALU3dGridGeometry > LocalGeometry;
341 
343  typedef Dune::Entity< cd, dim, const Grid, ALU3dGridEntity > Entity;
344 
345  // minimal information to generate entities
347 
348  template< PartitionIteratorType pitype >
349  struct Partition
350  {
351  typedef Dune::EntityIterator< cd, const Grid, ALU3dGridLevelIterator< cd, pitype, const Grid > > LevelIterator;
352  typedef Dune::EntityIterator< cd, const Grid, ALU3dGridLeafIterator< cd, pitype, const Grid > > LeafIterator;
353  }; // struct Partition
354 
357  }; // struct Codim
358 
359  template< PartitionIteratorType pitype >
360  struct Partition
361  {
362  typedef Dune::GridView< ALU3dLevelGridViewTraits< const Grid, pitype > > LevelGridView;
363  typedef Dune::GridView< ALU3dLeafGridViewTraits< const Grid, pitype > > LeafGridView;
365  }; // struct Partition
366 
370 
373 
376 
377  typedef IndexSet< Grid, LevelIndexSetImp > LevelIndexSet;
378  typedef IndexSet< Grid, LeafIndexSetImp > LeafIndexSet;
379  typedef IdSet< Grid, LocalIdSetImp, LocalIdType > LocalIdSet;
380  typedef IdSet< Grid, GlobalIdSetImp, GlobalIdType > GlobalIdSet;
381 
384  }; // struct Traits
385 
388 
391 
392  }; // struct ALU3dGridFamily
393 
394 
395 
396  //**********************************************************************
397  //
398  // --ALU3dGrid
399  // --Grid
400  //
401  //**********************************************************************
402 
423  template< int dim, int dimworld, ALU3dGridElementType elType, class Comm >
424  class ALU3dGrid
425  : public GridDefaultImplementation< dim, dimworld, alu3d_ctype,
426  ALU3dGridFamily< dim, dimworld, elType, Comm > >,
427  public HasObjectStream,
428  public HasHierarchicIndexSet
429  {
431  typedef GridDefaultImplementation< dim, dimworld, alu3d_ctype, ALU3dGridFamily< dim, dimworld, elType, Comm > > BaseType;
432 
433  // for compatibility: MyType := ThisType
434  typedef ThisType MyType;
435 
436  // friend declarations
437  friend class ALU3dGridEntity< 0, dim, const ThisType>;
438  friend class ALU3dGridEntity< 1, dim, const ThisType>;
439  friend class ALU3dGridEntity< 2, dim, const ThisType>;
440  friend class ALU3dGridEntity< dim, dim, const ThisType>;
441 
442  friend class ALU3dGridIntersectionIterator< ThisType >;
443 
444  friend class ALU3dGridEntityPointerBase< 0, const ThisType >;
445  friend class ALU3dGridEntityPointerBase< 1, const ThisType >;
446  friend class ALU3dGridEntityPointerBase< 2, const ThisType >;
447  friend class ALU3dGridEntityPointerBase< dim, const ThisType >;
448 
449  friend class ALU3dGridEntityPointer< 0, const ThisType >;
450  friend class ALU3dGridEntityPointer< 1, const ThisType >;
451  friend class ALU3dGridEntityPointer< 2, const ThisType >;
452  friend class ALU3dGridEntityPointer< dim, const ThisType >;
453 
454  friend class ALU3dGridIntersectionIterator< const ThisType >;
455  friend class ALU3dGridHierarchicIterator< const ThisType >;
456 
457  friend class ALU3dGridHierarchicIndexSet< dim, dimworld, elType, Comm >;
458  friend class ALU3dGridGlobalIdSet< dim, dimworld, elType, Comm >;
459  friend class ALU3dGridLocalIdSet< dim, dimworld, elType, Comm >;
460 
461  // new intersection iterator is a wrapper which get itersectioniteratoimp as pointers
462  public:
469 
472  friend class LeafIntersectionIteratorWrapper < const ThisType > ;
473  friend class LevelIntersectionIteratorWrapper< const ThisType > ;
474 
475  //**********************************************************
476  // The Interface Methods
477  //**********************************************************
478  public:
479  enum { refineStepsForHalf = 1 };
480 
481  static const ALU3dGridElementType elementType = elType;
482 
483  typedef typename ALU3DSPACE GatherScatterType::ObjectStreamType ObjectStreamType;
486 
488  typedef typename GridFamily::Traits Traits;
489 
490  static const int dimension = BaseType::dimension;
491  static const int dimensionworld = BaseType::dimensionworld;
492 
493  template< int codim >
494  struct Codim
495  : public BaseType::template Codim< codim >
496  {
497  typedef typename Traits::template Codim< codim >::EntityImp EntityImp;
498  typedef typename Traits::template Codim< codim >::Twists Twists;
499  typedef typename Twists::Twist Twist;
500  };
501 
502  protected:
503  typedef MakeableInterfaceObject< typename Traits::template Codim< 0 >::Geometry > GeometryObject;
504  friend class ALULocalGeometryStorage< const ThisType, GeometryObject, 8 >;
505 
506  public:
508  template <PartitionIteratorType pitype>
509  struct Partition
510  {
511  typedef typename GridFamily::Traits::template Partition<pitype>::LevelGridView
513  typedef typename GridFamily::Traits::template Partition<pitype>::LeafGridView
515  typedef typename GridFamily::Traits::template Partition<pitype>::MacroGridView
517  };
522 
525 
530 
531  // type of container for reference elements
532  typedef ReferenceElements< alu3d_ctype, dim > ReferenceElementContainerType;
533  // type of container for reference faces
534  typedef ReferenceElements< alu3d_ctype, dim-1 > ReferenceFaceContainerType;
535 
536  // type of reference element
537  typedef std::decay_t< decltype( ReferenceElementContainerType::general( std::declval< const Dune::GeometryType & >() ) ) > ReferenceElementType;
538  // type of reference face
539  typedef std::decay_t< decltype( ReferenceFaceContainerType::general( std::declval< const Dune::GeometryType & >() ) ) > ReferenceFaceType;
540 
543 
546 
549  typedef ALU3DSPACE ProjectVertexPtrPair ALUGridVertexProjectionPairType;
550 
553 
556 
557  protected:
560 
562 
563  public:
566 
568  typedef typename Traits::LocalIdSet LocalIdSet;
569 
570  protected:
572  typedef typename Traits::template Codim< 0 >::LeafIterator LeafIteratorType;
573  typedef typename Traits::template Codim< 0 >::LeafIterator LeafIterator;
574 
576 
578 
580  enum {
583 
585  enum {
590 
591  public:
592  typedef Comm MPICommunicatorType;
593 
595 
596  protected:
599 
601 
602  public:
605  ALU3dGrid ( const std::string &macroTriangFilename,
606  const MPICommunicatorType mpiComm,
607  const ALUGridVertexProjectionPairType& bndPrj,
608  const ALUGridRefinementType refinementType );
609 
611  virtual ~ALU3dGrid() {}
612 
614  static inline std::string name ();
615 
619  int maxLevel() const;
620 
622  template<int cd, PartitionIteratorType pitype>
623  typename Traits::template Codim<cd>::template Partition<pitype>::LevelIterator
624  lbegin (int level) const;
625 
627  template<int cd, PartitionIteratorType pitype>
628  typename Traits::template Codim<cd>::template Partition<pitype>::LevelIterator
629  lend (int level) const;
630 
632  template<int cd>
633  typename Traits::template Codim<cd>::
634  template Partition<All_Partition>::LevelIterator
635  lbegin (int level) const;
636 
638  template<int cd>
639  typename Traits::template Codim<cd>::
640  template Partition<All_Partition>::LevelIterator
641  lend (int level) const;
642 
645 
647  ileafbegin( const typename Traits::template Codim< 0 >::Entity& entity ) const
648  {
649  return LefInterItWrapperType( *this,
650  entity.impl(),
651  entity.level(), false );
652  }
653 
655  ileafend( const typename Traits::template Codim< 0 >::Entity& entity ) const
656  {
657  return LefInterItWrapperType( *this,
658  entity.impl(),
659  entity.level(), true );
660  }
661 
663  ilevelbegin( const typename Traits::template Codim< 0 >::Entity& entity ) const
664  {
665  return LvlInterItWrapperType( *this,
666  entity.impl(),
667  entity.level(), false );
668  }
669 
671  ilevelend( const typename Traits::template Codim< 0 >::Entity& entity ) const
672  {
673  return LvlInterItWrapperType( *this,
674  entity.impl(),
675  entity.level(), true );
676  }
677 
678  public:
680  template <int codim, PartitionIteratorType pitype>
681  typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
682  leafbegin() const;
683 
685  template <int codim, PartitionIteratorType pitype>
686  typename Traits::template Codim<codim>::template Partition<pitype>::LeafIterator
687  leafend() const;
688 
690  template <int codim>
691  typename Traits::template Codim<codim>::LeafIterator
692  leafbegin() const;
693 
695  template <int codim>
696  typename Traits::template Codim<codim>::LeafIterator
697  leafend() const;
698 
699  public:
701  int size (int level, int cd) const;
702 
704  int size (int codim) const;
705 
707  int size (int level, GeometryType type) const;
708 
710  size_t numBoundarySegments() const;
711 
713  int size (GeometryType type) const;
714 
716  int global_size (int cd) const ;
717 
718  // (no interface method) number of grid entities in the entire grid for given codim
719  int hierSetSize (int cd) const;
720 
722  const GlobalIdSet &globalIdSet () const
723  {
724  if( !globalIdSet_ )
725  {
726  globalIdSet_.reset( new GlobalIdSetImp( *this ) );
727  }
728  return *globalIdSet_;
729  }
730 
732  template<PartitionIteratorType pitype>
734  {
735  typedef typename Traits::template Partition<pitype>::MacroGridView View;
736  return View(*this);
737  }
738 
741  {
742  typedef MacroGridView View;
743  return View(*this);
744  }
745 
747  const LocalIdSet & localIdSet () const { return localIdSet_; }
748 
750  const typename Traits :: LeafIndexSet & leafIndexSet () const;
751 
753  const typename Traits :: LevelIndexSet & levelIndexSet (int level) const;
754 
759  std::shared_ptr< LevelIndexSetImp > accessLevelIndexSet ( int level ) const;
760 
761  protected:
762  std::shared_ptr< LevelIndexSetImp > createLevelIndexSet ( int level ) const;
763 
764  public:
765  template< int cd >
766  typename Codim< cd >::Twists twists ( GeometryType type ) const
767  {
768  assert( type.dim() == dimension - cd );
769  assert( elType == tetra ? type.isSimplex() : type.isCube() );
770  return typename Traits::template Codim< cd >::Twists();
771  }
772 
773  protected:
774  typedef ALU3DSPACE GatherScatter GatherScatterType;
775 
804  bool loadBalance ( GatherScatterType* lbData );
805 
806  public:
844  static void setLoadBalanceMethod( const int mthd,
845  const double ldbUnder = 0.0,
846  const double ldbOver = 1.2 )
847  {
848  using DataBase = ALU3DSPACE LoadBalancer::DataBase ;
849  if( mthd < int( DataBase::NONE ) && mthd > DataBase::ZOLTAN_LB_PARMETIS )
850  {
851  DUNE_THROW(InvalidStateException,"ALUGrid::setLoadBalanceMethod: wrong method passed, check documentation for correect values");
852  }
853 
854  ALU3DSPACE ALUGridExternalParameters::setLoadBalanceParameters( mthd, ldbUnder, ldbOver );
855  }
856 
857 
858 
863  bool loadBalance ()
864  {
865  return loadBalance( (GatherScatterType* ) 0 );
866  }
867 
874  template< class DataHandleImpl, class Data >
875  bool loadBalance ( CommDataHandleIF< DataHandleImpl, Data > &dataHandleIF )
876  {
877  typedef ALU3DSPACE GatherScatterLoadBalanceDataHandle
878  < ThisType, GatherScatterType, DataHandleImpl, Data, false > DataHandleType;
879  DataHandleType dataHandle( *this, dataHandleIF );
880 
881  // call the above loadBalance method with general GatherScatterType
882  return loadBalance( &dataHandle );
883  }
884 
894  template< class LBWeights, class DataHandleImpl, class Data >
895  bool loadBalance ( LBWeights &weights,
896  CommDataHandleIF< DataHandleImpl, Data > &dataHandleIF )
897  {
898  typedef ALU3DSPACE GatherScatterLoadBalanceDataHandle
899  < ThisType, LBWeights, DataHandleImpl, Data, false > DataHandleType;
900  DataHandleType dataHandle( *this, dataHandleIF, weights );
901 
902  // call the above loadBalance method with general GatherScatterType
903  return loadBalance( &dataHandle );
904  }
905 
913  template< class LBWeights >
914  typename std::enable_if< !IsDataHandle< LBWeights >::value, bool >::type loadBalance ( LBWeights &weights )
915  {
916  typedef ALU3DSPACE GatherScatterLoadBalance < ThisType, LBWeights, false > LoadBalanceHandleType;
917  LoadBalanceHandleType loadBalanceHandle( *this, weights );
918  return loadBalance( &loadBalanceHandle );
919  }
920 
929  template< class LBDestinations >
930  bool repartition ( LBDestinations &destinations )
931  {
932  typedef ALU3DSPACE GatherScatterLoadBalance< ThisType, LBDestinations, true > LoadBalanceHandleType ;
933  LoadBalanceHandleType loadBalanceHandle( *this, destinations );
934  return loadBalance( &loadBalanceHandle );
935  }
936 
947  template< class LBDestinations, class DataHandleImpl, class Data >
948  bool repartition ( LBDestinations &destinations,
949  CommDataHandleIF< DataHandleImpl, Data > &dataHandleIF )
950  {
951  typedef ALU3DSPACE GatherScatterLoadBalanceDataHandle< ThisType, LBDestinations, DataHandleImpl, Data, true > DataHandleType;
952  DataHandleType dataHandle( *this, dataHandleIF, destinations );
953 
954  // call the above loadBalance method with general GatherScatterType
955  return loadBalance( &dataHandle );
956  }
957 
958 
960  int ghostSize (int level, int codim) const;
961 
963  int overlapSize (int level, int codim) const { return 0; }
964 
966  int ghostSize (int codim) const;
967 
969  int overlapSize (int codim) const { return 0; }
970 
972  template< class DataHandle, class Data >
973  LevelCommunication communicate ( CommDataHandleIF< DataHandle, Data > &data,
974  InterfaceType iftype,
975  CommunicationDirection dir,
976  int level ) const
977  {
978  return LevelCommunication( *this, data, iftype, dir, level );
979  }
980 
984  template< class DataHandle, class Data >
985  LeafCommunication communicate ( CommDataHandleIF< DataHandle, Data > &data,
986  InterfaceType iftype,
987  CommunicationDirection dir ) const
988  {
989  return LeafCommunication( *this, data, iftype, dir );
990  }
991 
992  protected:
993  // load balance and compress memory if possible
994  void finalizeGridCreation();
995 
997  void clearIsNewMarkers( );
998 
999  public:
1001  const CollectiveCommunication &comm () const { return communications().ccobj_; }
1002 
1004  bool preAdapt ( );
1005 
1007  void postAdapt ( );
1008 
1010  bool adapt ();
1011 
1016  template< class GridImp, class DataHandle >
1017  bool adapt ( AdaptDataHandleInterface< GridImp, DataHandle > &handle );
1018 
1020  void globalRefine ( int refCount );
1021 
1022  template< class GridImp, class DataHandle >
1023  void globalRefine ( int refCount, AdaptDataHandleInterface< GridImp, DataHandle > &handle );
1024 
1025  //**********************************************************
1026  // End of Interface Methods
1027  //**********************************************************
1028 
1030  bool writeMacroGrid( const std::string path, const std::string filename,
1031  const ALU3DSPACE MacroFileHeader::Format format = ALU3DSPACE MacroFileHeader::defaultFormat ) const ;
1032 
1034  void backup( std::ostream&, const ALU3DSPACE MacroFileHeader::Format format ) const ;
1035 
1037  void restore( std::istream& ) ;
1038 
1039  // (no interface method) get hierarchic index set of the grid
1040  const HierarchicIndexSet & hierarchicIndexSet () const { return hIndexSet_; }
1041 
1042  // no interface method, but has to be public
1043  void updateStatus ();
1044 
1046  bool mark( int refCount , const typename Traits::template Codim<0>::Entity & e);
1047 
1049  int getMark( const typename Traits::template Codim<0>::Entity & e) const;
1050 
1051  public:
1053  {
1054  return Communications::defaultComm();
1055  }
1056 
1058  const std::vector<GeometryType>& geomTypes (int codim) const { return geomTypes_[codim]; }
1059 
1060  // return reference to org ALU3dGrid
1061  // private method, but otherwise we have to friend class all possible
1062  // types of LevelIterator ==> later
1063  GitterImplType &myGrid () const;
1064 
1065  virtual GitterImplType *createALUGrid ( const std::string &macroName )
1066  {
1068  return communications_->createALUGrid( macroName, vertexProjections(), conformingRefinement() );
1069  }
1070 
1071  virtual GitterImplType *createALUGrid ( std::istream& stream )
1072  {
1074  return communications_->createALUGrid( stream, vertexProjections(), conformingRefinement() );
1075  }
1076 
1078  {
1079  return vertexProjections_ ;
1080  }
1081 
1082  // return appropriate ALUGrid builder
1083  virtual typename ALU3DSPACE Gitter::Geometric::BuilderIF &getBuilder () const
1084  {
1085  return Communications::getBuilder( myGrid() );
1086  }
1087 
1088  // helper function for factory
1089  virtual void completeGrid ()
1090  {
1091  Communications::completeGrid( myGrid() );
1093  // update macro boundary segment index
1095  }
1096 
1099  {
1100  static const auto& refElem = ( elType == tetra ) ?
1103  return refElem ;
1104  }
1105 
1108  {
1109  static const auto& refElem = ( elType == tetra ) ?
1112  return refElem ;
1113  }
1114 
1115  template < class EntitySeed >
1116  typename Traits :: template Codim< EntitySeed :: codimension > :: EntityPointer
1117  entityPointer( const EntitySeed& seed ) const
1118  {
1119  enum { codim = EntitySeed :: codimension };
1120  return typename Traits :: template Codim< codim > :: EntityPointerImpl( seed );
1121  }
1122 
1123  template < class EntitySeed >
1124  typename Traits :: template Codim< EntitySeed :: codimension > :: Entity
1125  entity( const EntitySeed& seed ) const
1126  {
1127  typedef typename Traits :: template Codim< EntitySeed :: codimension > :: Entity Entity;
1128  return Entity( typename Traits :: template Codim< EntitySeed :: codimension > :: EntityImp( seed ) );
1129  }
1130 
1131  // number of links to other processors, for internal use only
1132  int nlinks () const { return communications().nlinks(); }
1133 
1135  {
1137  return leafVertexList_;
1138  }
1139 
1141  {
1143  return leafVertexList_.getLevel(vertex);
1144  }
1145 
1146  VertexListType & getVertexList(int level) const
1147  {
1148  alugrid_assert ( level >= 0 );
1149  alugrid_assert ( level <= maxLevel() );
1150  VertexListType & vxList = vertexList_[level];
1151  if(!vxList.up2Date()) vxList.setupVxList(*this,level);
1152  return vxList;
1153  }
1154 
1156  {
1157  alugrid_assert ( codim >= 1 );
1158  alugrid_assert ( codim <= 3 );
1159  return ghostLeafList_[codim-1];
1160  }
1161 
1162  ALU3dGridItemListType & getGhostLevelList(int codim, int level) const
1163  {
1164  alugrid_assert ( codim >= 1 );
1165  alugrid_assert ( codim <= 3 );
1166 
1167  alugrid_assert ( level >= 0 );
1168  alugrid_assert ( level <= maxLevel() );
1169  alugrid_assert ( level < int(ghostLevelList_[codim-1].size()) );
1170  return ghostLevelList_[codim-1][level];
1171  }
1172 
1174  {
1175  alugrid_assert ( level >= 0 );
1176  alugrid_assert ( level <= maxLevel() );
1177  return levelEdgeList_[level];
1178  }
1179 
1180  protected:
1182  ALU3dGrid( const ThisType & );
1183 
1185  const ThisType &operator= ( const ThisType & );
1186 
1188  void calcExtras();
1189 
1191  void calcMaxLevel();
1192 
1195 
1197  void checkMacroGridFile (const std::string filename);
1198 
1200  void checkMacroGrid ();
1201 
1203  {
1205  return *communications_;
1206  }
1207 
1208  // initialize geometry types and return correct geometryInFather storage
1209  void makeGeometries();
1210 
1211  public:
1212  // return true if conforming refinement is enabled
1214  {
1215  return (refinementType_ == conforming) ;
1216  }
1217 
1218  // return true if ghost cells are available
1219  bool ghostCellsEnabled () const
1220  {
1221  return comm().size() > 1 && myGrid().ghostCellsEnabled();
1222  }
1223 
1225  {
1227  {
1229  }
1232  }
1233 
1234  protected:
1236  //
1237  // Internal variables
1238  //
1240 
1241  // the real ALU grid
1242  mutable std::unique_ptr< GitterImplType > mygrid_;
1243 
1244  // max level of grid
1246 
1247  // count how much elements where marked
1248  mutable int coarsenMarked_;
1249  mutable int refineMarked_;
1250 
1251  // at the moment the number of different geom types is 1
1252  enum { numberOfGeomTypes = 1 };
1253  std::vector< std::vector<GeometryType> > geomTypes_;
1254 
1255  // our hierarchic index set
1257 
1258  // out global id set
1259  mutable std::unique_ptr< GlobalIdSetImp > globalIdSet_;
1260 
1261  // out global id set
1263 
1264  // the level index set ( default type )
1265  mutable std::vector < std::shared_ptr< LevelIndexSetImp > > levelIndexVec_;
1266 
1267  // the leaf index set
1268  mutable std::unique_ptr< LeafIndexSetImp > leafIndexSet_;
1269 
1270  mutable std::vector< VertexListType > vertexList_;
1271 
1272  //the ghostleaf list is used in alu3diterators, where we use the internal aluIterators
1273  // the vertex codim there is 3, so the list has to fulfill that
1275  mutable std::vector< ALU3dGridItemListType > ghostLevelList_[ 3 ];
1276 
1277  mutable std::vector< ALU3dGridItemListType > levelEdgeList_;
1278 
1280 
1281  // the type of our size cache
1282  typedef SizeCache<MyType> SizeCacheType;
1283  std::unique_ptr< SizeCacheType > sizeCache_;
1284 
1285  // macro boundary segment index
1287 
1288  // variable to ensure that postAdapt ist called after adapt
1290 
1291  // boundary projection for vertices
1292  // pair: first is globalProjection_ for boundaries
1293  // second is surfaceProjection_ for manifolds
1295 
1296  // pointer to communications object
1297  std::unique_ptr< Communications > communications_;
1298 
1299  // refinement type (nonconforming or conforming)
1301  }; // end class ALU3dGrid
1302 
1303 
1305  const std::string filename );
1306  const char* elType2Name( ALU3dGridElementType elType );
1307 
1308  namespace Capabilities
1309  {
1310 
1311  template< int dim, int dimworld, ALU3dGridElementType elType, class Comm, int cdim >
1312  struct hasEntity< Dune::ALU3dGrid< dim, dimworld, elType, Comm >, cdim >
1313  {
1314  static const bool v = true;
1315  };
1316 
1317  template< int dim, int dimworld, ALU3dGridElementType elType, class Comm >
1318  struct isLevelwiseConforming< ALU3dGrid< dim, dimworld, elType, Comm > >
1319  {
1320  static const bool v = true;
1321  };
1322 
1323  template< int dim, int dimworld, ALU3dGridElementType elType, class Comm >
1324  struct hasBackupRestoreFacilities< ALU3dGrid< dim, dimworld, elType, Comm > >
1325  {
1326  static const bool v = true;
1327  };
1328 
1329  } // end namespace Capabilities
1330 
1331 } // end namespace Dune
1332 
1333 #include "grid_inline.hh"
1334 #if COMPILE_ALUGRID_INLINE
1335  #include "grid_imp.cc"
1336 #endif
1337 #endif
#define ALU3DSPACE
Definition: alu3dinclude.hh:7
#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:63
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:68
const char * elType2Name(ALU3dGridElementType elType)
Definition: grid_imp.cc:363
ALUGridRefinementType
available refinement types for ALUGrid
Definition: declaration.hh:24
@ conforming
use conforming bisection refinement
Definition: declaration.hh:25
Definition: alu3dinclude.hh:242
Definition: alu3dinclude.hh:328
bool up2Date() const
Definition: alu3dinclude.hh:340
void setupVxList(const GridType &grid, int level)
Definition: alu3dinclude.hh:364
void setupVxList(const GridType &grid)
int getLevel(const VertexType &vertex) const
Definition: alu3dinclude.hh:389
bool up2Date() const
Definition: alu3dinclude.hh:377
Definition: alu3dinclude.hh:409
Definition: communication.hh:27
Definition: communication.hh:30
[ provides Dune::Grid ]
Definition: 3d/grid.hh:429
bool repartition(LBDestinations &destinations, CommDataHandleIF< DataHandleImpl, Data > &dataHandleIF)
Distribute the grid based on a user defined partitioning.
Definition: 3d/grid.hh:948
int getLevelOfLeafVertex(const typename ALU3dImplTraits< elType, Comm >::VertexType &vertex) const
Definition: 3d/grid.hh:1140
MakeableInterfaceObject< typename Traits::template Codim< 0 >::Geometry > GeometryObject
Definition: 3d/grid.hh:503
const HierarchicIndexSet & hierarchicIndexSet() const
Definition: 3d/grid.hh:1040
ALU3dGrid(const std::string &macroTriangFilename, const MPICommunicatorType mpiComm, const ALUGridVertexProjectionPairType &bndPrj, const ALUGridRefinementType refinementType)
Definition: grid_inline.hh:24
const Traits ::LeafIndexSet & leafIndexSet() const
get leaf index set of the grid
Definition: grid_inline.hh:431
Traits::CollectiveCommunication CollectiveCommunication
type of collective communication object
Definition: 3d/grid.hh:552
ALU3dGridIntersectionIterator< const ThisType > IntersectionIteratorImp
Definition: 3d/grid.hh:464
static const int dimensionworld
Definition: 3d/grid.hh:491
bool mark(int refCount, const typename Traits::template Codim< 0 >::Entity &e)
Definition: grid_inline.hh:190
LevelCommunication communicate(CommDataHandleIF< DataHandle, Data > &data, InterfaceType iftype, CommunicationDirection dir, int level) const
Definition: 3d/grid.hh:973
int overlapSize(int level, int codim) const
overlapSize is zero for this grid
Definition: 3d/grid.hh:963
bool loadBalance()
Calculates load of each process and repartition by using ALUGrid's default partitioning method....
Definition: 3d/grid.hh:863
int coarsenMarked_
Definition: 3d/grid.hh:1248
std::unique_ptr< Communications > communications_
Definition: 3d/grid.hh:1297
Partition< pitype >::MacroGridView macroGridView() const
View for te macro grid with some alu specific methods.
Definition: 3d/grid.hh:733
void updateStatus()
Definition: grid_inline.hh:361
static void setLoadBalanceMethod(const int mthd, const double ldbUnder=0.0, const double ldbOver=1.2)
Set load balancing method and lower and upper bound for decision on whether to load balance or not.
Definition: 3d/grid.hh:844
ALU3dGridLevelIntersectionIterator< const ThisType > LevelIntersectionIteratorImp
Definition: 3d/grid.hh:468
ALU3dGrid(const ThisType &)
Copy constructor should not be used.
Traits ::template Codim< EntitySeed ::codimension >::EntityPointer entityPointer(const EntitySeed &seed) const
Definition: 3d/grid.hh:1117
virtual ALU3DSPACE Gitter::Geometric::BuilderIF & getBuilder() const
Definition: 3d/grid.hh:1083
static const ReferenceFaceType & faceReferenceElement()
return reference to Dune face reference element according to elType
Definition: 3d/grid.hh:1107
HierarchicIndexSet hIndexSet_
Definition: 3d/grid.hh:1256
Traits::LeafIntersectionIterator ileafend(const typename Traits::template Codim< 0 >::Entity &entity) const
Definition: 3d/grid.hh:655
Traits::template Codim< 0 >::LeafIterator LeafIterator
Definition: 3d/grid.hh:573
std::vector< std::shared_ptr< LevelIndexSetImp > > levelIndexVec_
Definition: 3d/grid.hh:1265
int maxLevel() const
Return maximum level defined in this grid. Levels are numbered maxLevel with 0 the coarsest level.
Definition: grid_inline.hh:81
ALULeafCommunication< dim, dimworld, elType, Comm > LeafCommunication
Definition: 3d/grid.hh:554
Traits::template Codim< codim >::template Partition< pitype >::LeafIterator leafend() const
General definition for an end iterator on leaf level.
Definition: grid_inline.hh:171
GridFamily::Traits Traits
Definition: 3d/grid.hh:488
Traits::DuneBoundaryProjectionType DuneBoundaryProjectionType
boundary projection type
Definition: 3d/grid.hh:542
const Traits ::LevelIndexSet & levelIndexSet(int level) const
get level index set of the grid
Definition: grid_inline.hh:446
ALU3dGridCommunications< dim, dimworld, elType, Comm > Communications
Definition: 3d/grid.hh:594
int hierSetSize(int cd) const
Definition: grid_inline.hh:73
static const ReferenceElementType & referenceElement()
return reference to Dune reference element according to elType
Definition: 3d/grid.hh:1098
GitterImplType & myGrid() const
Definition: grid_inline.hh:89
Traits::LocalIdSet LocalIdSet
Type of the local id set.
Definition: 3d/grid.hh:568
const Communications & communications() const
Definition: 3d/grid.hh:1202
static MPICommunicatorType defaultCommunicator()
Definition: 3d/grid.hh:1052
ALULevelCommunication< dim, dimworld, elType, Comm > LevelCommunication
Definition: 3d/grid.hh:555
std::decay_t< decltype(ReferenceElementContainerType::general(std::declval< const Dune::GeometryType & >))) > ReferenceElementType
Definition: 3d/grid.hh:537
ALU3DSPACE GatherScatterType::ObjectStreamType ObjectStreamType
Definition: 3d/grid.hh:483
void checkMacroGridFile(const std::string filename)
check whether macro grid format is of our type
Definition: grid_imp.cc:304
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:895
const GlobalIdSet & globalIdSet() const
get global id set of grid
Definition: 3d/grid.hh:722
std::shared_ptr< LevelIndexSetImp > createLevelIndexSet(int level) const
Definition: grid_inline.hh:479
virtual ~ALU3dGrid()
Desctructor.
Definition: 3d/grid.hh:611
int maxlevel_
Definition: 3d/grid.hh:1245
void globalRefine(int refCount)
uses the interface, mark on entity and refineLocal
Definition: grid_inline.hh:488
BoundarySegmentIndexSetType macroBoundarySegmentIndexSet_
Definition: 3d/grid.hh:1286
bool adapt()
Definition: grid_inline.hh:516
ALU3dGridIntersectionIterator< const ThisType > LeafIntersectionIteratorImp
Definition: 3d/grid.hh:466
ALU3DSPACE ProjectVertex ALUGridVertexProjectionType
type of vertex projection
Definition: 3d/grid.hh:545
bool repartition(LBDestinations &destinations)
Distribute the grid based on a user defined partitioning.
Definition: 3d/grid.hh:930
bool ghostCellsEnabled() const
Definition: 3d/grid.hh:1219
void makeGeometries()
Definition: grid_imp.cc:178
ALU3dGridLeafIterator< 0, All_Partition, const ThisType > LeafIteratorImp
Definition: 3d/grid.hh:571
static std::string name()
for grid identification
Definition: grid_inline.hh:278
bool lockPostAdapt_
Definition: 3d/grid.hh:1289
const ThisType & operator=(const ThisType &)
assignment operator should not be used
Definition: grid_imp.cc:205
static const int dimension
Definition: 3d/grid.hh:490
LeafIntersectionIteratorWrapper< const ThisType > LefInterItWrapperType
Definition: 3d/grid.hh:643
std::unique_ptr< GlobalIdSetImp > globalIdSet_
Definition: 3d/grid.hh:1259
std::shared_ptr< LevelIndexSetImp > accessLevelIndexSet(int level) const
return instance of level index set
Definition: grid_inline.hh:463
Traits ::template Codim< EntitySeed ::codimension >::Entity entity(const EntitySeed &seed) const
Definition: 3d/grid.hh:1125
ALU3dGridHierarchicIterator< const ThisType > HierarchicIteratorImp
Definition: 3d/grid.hh:575
int nlinks() const
Definition: 3d/grid.hh:1132
ALU3dGridItemListType & getGhostLevelList(int codim, int level) const
Definition: 3d/grid.hh:1162
Traits::LeafIntersectionIterator ileafbegin(const typename Traits::template Codim< 0 >::Entity &entity) const
Definition: 3d/grid.hh:647
int refineMarked_
Definition: 3d/grid.hh:1249
GridFamily::LevelIndexSetImp LevelIndexSetImp
Type of the level index set, needed by data handle.
Definition: 3d/grid.hh:527
GridFamily::LocalIdSetImp LocalIdSetImp
Type of the local id set.
Definition: 3d/grid.hh:559
ALU3dGridItemListType & getGhostLeafList(int codim) const
Definition: 3d/grid.hh:1155
std::unique_ptr< SizeCacheType > sizeCache_
Definition: 3d/grid.hh:1283
Partition< All_Partition >::MacroGridView MacroGridView
Definition: 3d/grid.hh:521
ALU3DSPACE ProjectVertexPtr ALUGridVertexProjectionPointerType
type of ALUGrid Vertex Projection Interface (shared_ptr)
Definition: 3d/grid.hh:548
void finalizeGridCreation()
Definition: grid_imp.cc:376
void recalcGlobalSize()
make grid walkthrough and calc global size
static const ALU3dGridElementType elementType
Definition: 3d/grid.hh:481
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:985
Codim< cd >::Twists twists(GeometryType type) const
Definition: 3d/grid.hh:766
void backup(std::ostream &, const ALU3DSPACE MacroFileHeader::Format format) const
backup to ostream
Definition: grid_imp.cc:268
void clearIsNewMarkers()
clear all entity new markers
Definition: grid_imp.cc:444
ObjectStreamType InStreamType
Definition: 3d/grid.hh:484
ReferenceElements< alu3d_ctype, dim-1 > ReferenceFaceContainerType
Definition: 3d/grid.hh:534
ALU3DSPACE ProjectVertexPtrPair ALUGridVertexProjectionPairType
Definition: 3d/grid.hh:549
const ALUGridRefinementType refinementType_
Definition: 3d/grid.hh:1300
@ refineEstimate_
if one element is refined then it causes apporximately not more than this number of new elements
Definition: 3d/grid.hh:589
Partition< All_Partition >::LevelGridView LevelGridView
View types for All_Partition.
Definition: 3d/grid.hh:519
void postAdapt()
clear all entity new markers if lockPostAdapt_ is set
Definition: grid_imp.cc:429
void restore(std::istream &)
restore from istream
Definition: grid_imp.cc:276
@ numberOfGeomTypes
Definition: 3d/grid.hh:1252
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:99
std::vector< std::vector< GeometryType > > geomTypes_
Definition: 3d/grid.hh:1253
ALU3dGridItemListType & getEdgeList(int level) const
Definition: 3d/grid.hh:1173
void calcMaxLevel()
calculate maxlevel
Definition: grid_imp.cc:214
bool conformingRefinement() const
Definition: 3d/grid.hh:1213
std::vector< ALU3dGridItemListType > levelEdgeList_
Definition: 3d/grid.hh:1277
ALUGridVertexProjectionPairType vertexProjections_
Definition: 3d/grid.hh:1294
ObjectStreamType OutStreamType
Definition: 3d/grid.hh:485
ALU3dGridFamily< dim, dimworld, elType, Comm > GridFamily
Definition: 3d/grid.hh:487
bool preAdapt()
returns if a least one entity was marked for coarsening
Definition: grid_inline.hh:507
void calcExtras()
reset size and global size, update Level- and LeafIndexSet, if they exist
Definition: grid_inline.hh:371
VertexListType & getVertexList(int level) const
Definition: 3d/grid.hh:1146
std::unique_ptr< GitterImplType > mygrid_
Definition: 3d/grid.hh:1242
ALU3dGridLeafVertexList< Comm > LeafVertexListType
Definition: 3d/grid.hh:598
SizeCache< MyType > SizeCacheType
Definition: 3d/grid.hh:1282
ALU3dGridVertexList< Comm > VertexListType
Definition: 3d/grid.hh:597
ALU3dGridItemListType ghostLeafList_[3]
Definition: 3d/grid.hh:1274
GridFamily::LeafIndexSetImp LeafIndexSetImp
Type of the leaf index set, needed by data handle.
Definition: 3d/grid.hh:529
virtual void completeGrid()
Definition: 3d/grid.hh:1089
Comm MPICommunicatorType
Definition: 3d/grid.hh:592
ALU3DSPACE GatherScatter GatherScatterType
Definition: 3d/grid.hh:774
const CollectiveCommunication & comm() const
Definition: 3d/grid.hh:1001
LeafVertexListType & getLeafVertexList() const
Definition: 3d/grid.hh:1134
int getMark(const typename Traits::template Codim< 0 >::Entity &e) const
Definition: grid_inline.hh:205
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:914
virtual GitterImplType * createALUGrid(std::istream &stream)
Definition: 3d/grid.hh:1071
virtual GitterImplType * createALUGrid(const std::string &macroName)
Definition: 3d/grid.hh:1065
Partition< All_Partition >::LeafGridView LeafGridView
Definition: 3d/grid.hh:520
@ refineStepsForHalf
Definition: 3d/grid.hh:479
const LocalIdSet & localIdSet() const
get global id set of grid
Definition: 3d/grid.hh:747
std::vector< VertexListType > vertexList_
Definition: 3d/grid.hh:1270
ALU3dImplTraits< elType, Comm >::GitterImplType GitterImplType
Definition: 3d/grid.hh:577
std::decay_t< decltype(ReferenceFaceContainerType::general(std::declval< const Dune::GeometryType & >))) > ReferenceFaceType
Definition: 3d/grid.hh:539
Traits::template Codim< codim >::template Partition< pitype >::LeafIterator leafbegin() const
General definiton for a leaf iterator.
Definition: grid_inline.hh:148
MacroGridView macroGridView() const
View for te macro grid with some alu specific methods (All_Partition)
Definition: 3d/grid.hh:740
Traits::LevelIntersectionIterator ilevelbegin(const typename Traits::template Codim< 0 >::Entity &entity) const
Definition: 3d/grid.hh:663
LeafVertexListType leafVertexList_
Definition: 3d/grid.hh:1279
Traits::template Codim< cd >::template Partition< pitype >::LevelIterator lend(int level) const
one past the end on this level
Definition: grid_inline.hh:113
ALUGridVertexProjectionPairType vertexProjections() const
Definition: 3d/grid.hh:1077
@ newElementsChunk_
normal default number of new elements for new adapt method
Definition: 3d/grid.hh:582
std::vector< ALU3dGridItemListType > ghostLevelList_[3]
Definition: 3d/grid.hh:1275
GridFamily::GlobalIdSetImp GlobalIdSetImp
Definition: 3d/grid.hh:561
bool loadBalance(CommDataHandleIF< DataHandleImpl, Data > &dataHandleIF)
Calculates load of each process and repartition by using ALUGrid's default partitioning method....
Definition: 3d/grid.hh:875
const BoundarySegmentIndexSetType & macroBoundarySegmentIndexSet() const
Definition: 3d/grid.hh:1224
int global_size(int cd) const
number of grid entities on all levels for given codim
Definition: grid_inline.hh:63
Traits::template Codim< 0 >::LeafIterator LeafIteratorType
Definition: 3d/grid.hh:572
int ghostSize(int level, int codim) const
ghostSize is one for codim 0 and zero otherwise for this grid
Definition: grid_inline.hh:352
int size(int level, int cd) const
number of grid entities per level and codim
Definition: grid_inline.hh:289
Traits::LevelIntersectionIterator ilevelend(const typename Traits::template Codim< 0 >::Entity &entity) const
Definition: 3d/grid.hh:671
size_t numBoundarySegments() const
number of boundary segments
Definition: grid_inline.hh:303
void checkMacroGrid()
check whether macro grid has the right element type
Definition: grid_imp.cc:343
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:246
Traits::GlobalIdSet GlobalIdSet
Type of the global id set.
Definition: 3d/grid.hh:565
std::unique_ptr< LeafIndexSetImp > leafIndexSet_
Definition: 3d/grid.hh:1268
DefaultBoundarySegmentIndexSet< ThisType > BoundarySegmentIndexSetType
Definition: 3d/grid.hh:600
LevelIntersectionIteratorWrapper< const ThisType > LvlInterItWrapperType
Definition: 3d/grid.hh:644
const std::vector< GeometryType > & geomTypes(int codim) const
deliver all geometry types used in this grid
Definition: 3d/grid.hh:1058
ALU3dGridHierarchicIndexSet< dim, dimworld, elType, Comm > HierarchicIndexSet
Type of the hierarchic index set.
Definition: 3d/grid.hh:524
LocalIdSetImp localIdSet_
Definition: 3d/grid.hh:1262
ReferenceElements< alu3d_ctype, dim > ReferenceElementContainerType
Definition: 3d/grid.hh:532
int overlapSize(int codim) const
overlapSize is zero for this grid
Definition: 3d/grid.hh:969
Definition: entity.hh:48
Definition: entity.hh:620
Definition: geometry.hh:632
Definition: iterator.hh:722
Definition: iterator.hh:56
Leaf iterator.
Definition: iterator.hh:648
Definition: entity.hh:454
Definition: entityseed.hh:212
Definition: iterator.hh:296
Definition: 3d/grid.hh:72
Definition: 3d/grid.hh:74
Definition: 3d/grid.hh:76
Definition: 3d/grid.hh:78
hierarchic index set of ALU3dGrid
Definition: indexsets.hh:39
Factory class for ALUGrids.
Definition: gridfactory.hh:30
Definition: geostorage.hh:23
ALU3dGrid< dim, dimw, hexa, Comm > BaseGrid
Definition: 3d/grid.hh:106
ALU3dGrid< dim, dimw, tetra, Comm > BaseGrid
Definition: 3d/grid.hh:112
Definition: 3d/grid.hh:117
static int getRank(ALUGridNoComm comm)
Definition: 3d/grid.hh:150
CollectiveCommunication ccobj_
Definition: 3d/grid.hh:166
GitterImplType * createALUGrid(std::istream &stream, const ALU3DSPACE ProjectVertexPtrPair &projection, const bool conformingRefinement)
Definition: 3d/grid.hh:141
static ALU3DSPACE Gitter::Geometric::BuilderIF & getBuilder(GitterImplType &grid)
Definition: 3d/grid.hh:152
void print(std::ostream &out) const
Definition: 3d/grid.hh:163
Dune::CollectiveCommunication< No_Comm > CollectiveCommunication
Definition: 3d/grid.hh:127
GitterImplType * createALUGrid(const std::string &macroName, const ALU3DSPACE ProjectVertexPtrPair &projections, const bool conformingRefinement)
Definition: 3d/grid.hh:133
static void completeGrid(GitterImplType &grid)
Definition: 3d/grid.hh:161
ALU3dGridCommunications(ALUGridNoComm comm)
Definition: 3d/grid.hh:129
ALU3DSPACE GitterDuneImpl GitterImplType
Definition: 3d/grid.hh:125
ALU3dGridLocalIdSet< dim, dimworld, elType, ALUGridNoComm > GlobalIdSet
Definition: 3d/grid.hh:122
static ALUGridNoComm defaultComm()
Definition: 3d/grid.hh:148
Definition: 3d/grid.hh:241
TrivialTwists< topoId, dim > Type
Definition: 3d/grid.hh:247
TrivialTwists< topoId, dim > Type
Definition: 3d/grid.hh:254
ALUTwists< dim==2 ? 2 :ElementTopologyMapping< elType >::numVerticesPerFace, dim-1 > Type
Definition: 3d/grid.hh:260
ALUTwists< 2, 1 > Type
Definition: 3d/grid.hh:266
TrivialTwists< 0u, 0 > Type
Definition: 3d/grid.hh:272
TrivialTwists< 0u, 0 > Type
Definition: 3d/grid.hh:278
Definition: 3d/grid.hh:288
ALU3dGridCommunications< dim, dimworld, elType, Comm >::GlobalIdSet GlobalIdSetImp
Type of the global id set.
Definition: 3d/grid.hh:299
ALU3dGridCommunications< dim, dimworld, elType, Comm >::GlobalId GlobalIdType
type of ALU3dGrids global id
Definition: 3d/grid.hh:302
ALU3dGridLocalIdSet< dim, dimworld, elType, Comm > LocalIdSetImp
Type of the local id set.
Definition: 3d/grid.hh:296
static const int dimworld
Definition: 3d/grid.hh:290
ALU3dGridFamily< dim, dimworld, elType, Comm > GridFamily
Definition: 3d/grid.hh:293
Traits ::LevelIndexSetImp LevelIndexSetImp
Type of the level index set implementation.
Definition: 3d/grid.hh:387
ALU3dGrid< dim, dimworld, elType, Comm > GridImp
Definition: 3d/grid.hh:292
Traits ::LeafIndexSetImp LeafIndexSetImp
Type of the leaf index set implementation.
Definition: 3d/grid.hh:390
int LocalIdType
type of ALU3dGrids local id
Definition: 3d/grid.hh:305
static const int dim
Definition: 3d/grid.hh:289
Definition: 3d/grid.hh:308
IndexSet< Grid, LeafIndexSetImp > LeafIndexSet
Definition: 3d/grid.hh:378
DefaultIndexSet< Grid, typename Codim< 0 >::LevelIterator > LevelIndexSetImp
Type of the level index set.
Definition: 3d/grid.hh:372
GridFamily::LocalIdType LocalIdType
type of ALU3dGrids local id
Definition: 3d/grid.hh:310
Partition< All_Partition >::MacroGridView MacroGridView
Definition: 3d/grid.hh:367
ALU3dGridCommunications< dim, dimworld, elType, Comm >::CollectiveCommunication CollectiveCommunication
Type of the communication class.
Definition: 3d/grid.hh:383
Dune::EntityIterator< 0, const Grid, ALU3dGridHierarchicIterator< const Grid > > HierarchicIterator
Definition: 3d/grid.hh:325
IdSet< Grid, GlobalIdSetImp, GlobalIdType > GlobalIdSet
Definition: 3d/grid.hh:380
Dune::IntersectionIterator< const Grid, LevelIntersectionIteratorWrapper< const Grid >, LevelIntersectionWrapper< const Grid > > LevelIntersectionIterator
Definition: 3d/grid.hh:323
Dune::IntersectionIterator< const Grid, LeafIntersectionIteratorWrapper< const Grid >, LeafIntersectionWrapper< const Grid > > LeafIntersectionIterator
Definition: 3d/grid.hh:322
GridFamily::GridImp Grid
Definition: 3d/grid.hh:315
IdSet< Grid, LocalIdSetImp, LocalIdType > LocalIdSet
Definition: 3d/grid.hh:379
GridFamily::GlobalIdType GlobalIdType
type of ALU3dGrids global id
Definition: 3d/grid.hh:313
IndexSet< Grid, LevelIndexSetImp > LevelIndexSet
Definition: 3d/grid.hh:377
Partition< All_Partition >::LeafGridView LeafGridView
Definition: 3d/grid.hh:368
Dune::IntersectionIterator< const Grid, LeafIntersectionIteratorWrapper< const Grid >, LeafIntersectionWrapper< const Grid > > IntersectionIterator
Definition: 3d/grid.hh:320
Partition< All_Partition >::LevelGridView LevelGridView
Definition: 3d/grid.hh:369
Dune::Intersection< const Grid, LevelIntersectionWrapper< const Grid > > LevelIntersection
Definition: 3d/grid.hh:318
DuneBoundaryProjection< dimworld > DuneBoundaryProjectionType
Definition: 3d/grid.hh:327
Dune::Intersection< const Grid, LeafIntersectionWrapper< const Grid > > LeafIntersection
Definition: 3d/grid.hh:317
DefaultIndexSet< Grid, typename Codim< 0 >::LeafIterator > LeafIndexSetImp
Type of the leaf index set.
Definition: 3d/grid.hh:375
std::vector< const DuneBoundaryProjectionType * > DuneBoundaryProjectionVector
Definition: 3d/grid.hh:328
Definition: 3d/grid.hh:332
ALU3dGridTwists< dim, elType, cd >::Type Twists
Definition: 3d/grid.hh:333
Dune::Geometry< dim-cd, dimworld, const Grid, ALU3dGridGeometry > Geometry
Definition: 3d/grid.hh:339
ALU3dGridGeometry< dim-cd, dim, const Grid > LocalGeometryImpl
Definition: 3d/grid.hh:338
Twists::Twist Twist
Definition: 3d/grid.hh:334
ALU3dGridGeometry< dim-cd, dimworld, const Grid > GeometryImpl
Definition: 3d/grid.hh:337
ALU3dGridEntitySeed< cd, const Grid > EntitySeed
Definition: 3d/grid.hh:346
ALU3dGridEntity< cd, dim, const Grid > EntityImp
Definition: 3d/grid.hh:342
Dune::Geometry< dim-cd, dim, const Grid, ALU3dGridGeometry > LocalGeometry
Definition: 3d/grid.hh:340
Dune::Entity< cd, dim, const Grid, ALU3dGridEntity > Entity
Definition: 3d/grid.hh:343
Partition< All_Partition >::LevelIterator LevelIterator
Definition: 3d/grid.hh:355
Partition< All_Partition >::LeafIterator LeafIterator
Definition: 3d/grid.hh:356
Dune::EntityIterator< cd, const Grid, ALU3dGridLeafIterator< cd, pitype, const Grid > > LeafIterator
Definition: 3d/grid.hh:352
Dune::EntityIterator< cd, const Grid, ALU3dGridLevelIterator< cd, pitype, const Grid > > LevelIterator
Definition: 3d/grid.hh:351
Dune::GridView< ALU3dLeafGridViewTraits< const Grid, pitype > > LeafGridView
Definition: 3d/grid.hh:363
Dune::GridView< ALU3dLevelGridViewTraits< const Grid, pitype > > LevelGridView
Definition: 3d/grid.hh:362
Dune::MacroGridView< const Grid, pitype > MacroGridView
Definition: 3d/grid.hh:364
Definition: 3d/grid.hh:496
Traits::template Codim< codim >::Twists Twists
Definition: 3d/grid.hh:498
Traits::template Codim< codim >::EntityImp EntityImp
Definition: 3d/grid.hh:497
Twists::Twist Twist
Definition: 3d/grid.hh:499
Types for GridView.
Definition: 3d/grid.hh:510
GridFamily::Traits::template Partition< pitype >::LeafGridView LeafGridView
Definition: 3d/grid.hh:514
GridFamily::Traits::template Partition< pitype >::MacroGridView MacroGridView
Definition: 3d/grid.hh:516
GridFamily::Traits::template Partition< pitype >::LevelGridView LevelGridView
Definition: 3d/grid.hh:512
Definition: indexsets.hh:186
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:43
Definition: declaration.hh:82
DefaultIndexSet creates an index set by using the grids persistent container an a given pair of itera...
Definition: defaultindexsets.hh:68
void invalidate()
Definition: defaultindexsets.hh:434
void update(const GridViewType &gridView)
Definition: defaultindexsets.hh:399
bool valid() const
Definition: defaultindexsets.hh:433
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:23
Definition: intersectioniteratorwrapper.hh:221
Class that wraps IntersectionIteratorImp of a grid and gets it's internal object from a object stack ...
Definition: intersectioniteratorwrapper.hh:246
Class that wraps IntersectionIteratorImp of a grid and gets it's internal object from a object stack ...
Definition: intersectioniteratorwrapper.hh:322
Class that wraps IntersectionIteratorImp of a grid and gets it's internal object from a object stack ...
Definition: intersectioniteratorwrapper.hh:346
Definition: macrogridview.hh:71
Definition: twists.hh:23
Definition: twists.hh:440
Definition: twists.hh:595