dune-grid  2.2.0
grid_inline.hh
Go to the documentation of this file.
1 // Dune includes
2 #include <dune/common/stdstreams.hh>
3 
4 // Local includes
5 #include "alu3dinclude.hh"
6 #include "entity.hh"
7 #include "iterator.hh"
8 #include "datahandle.hh"
9 #include "grid.hh"
10 
11 namespace Dune
12 {
13 
14  // Implementation of ALU3dGrid
15  // ---------------------------
16 
17  template< ALU3dGridElementType elType, class Comm >
19  ::ALU3dGrid ( const std::string &macroTriangFilename,
20  const MPICommunicatorType mpiComm,
21  const DuneBoundaryProjectionType *bndPrj,
22  const DuneBoundaryProjectionVector *bndVec,
23  const ALUGridRefinementType refinementType )
24  : mygrid_( 0 )
25  , maxlevel_( 0 )
26  , coarsenMarked_( 0 )
27  , refineMarked_( 0 )
28  , geomTypes_() //dim+1, std::vector<GeometryType>(1) )
29  , hIndexSet_ (*this)
30  , globalIdSet_( 0 )
31  , localIdSet_( *this )
32  , levelIndexVec_(MAXL,0) , leafIndexSet_(0)
33  , referenceElement_( elType == tetra
34  ? GenericReferenceElements< alu3d_ctype, dimension > :: simplex()
35  : GenericReferenceElements< alu3d_ctype, dimension > :: cube() )
36  , sizeCache_ ( 0 )
37 #ifdef USE_SMP_PARALLEL
38  , factoryVec_( GridObjectFactoryType :: maxThreads(), GridObjectFactoryType( *this ) )
39 #else
40  , factory_( *this )
41 #endif
42  , lockPostAdapt_( false )
43  , bndPrj_ ( bndPrj )
44  , bndVec_ ( (bndVec) ? (new DuneBoundaryProjectionVector( *bndVec )) : 0 )
45  , vertexProjection_( (bndPrj || bndVec) ? new ALUGridBoundaryProjectionType( *this ) : 0 )
46  , communications_( new Communications( mpiComm ) )
47  , refinementType_( refinementType )
48  {
49  assert( elType == tetra || elType == hexa );
50 
51  geomTypes_.resize( dimension+1 );
52  GeometryType tmpType;
53  for( int codim = 0; codim <= dimension; ++codim )
54  {
55  if (elType == tetra)
56  tmpType.makeSimplex( dimension - codim );
57  else
58  tmpType.makeCube( dimension - codim );
59 
60  geomTypes_[ codim ].push_back( tmpType );
61  }
62 
63  // check macro grid file for keyword
64  checkMacroGridFile( macroTriangFilename );
65 
66  mygrid_ = createALUGrid( macroTriangFilename );
67  assert( mygrid_ );
68 
69  dverb << "************************************************" << std::endl;
70  dverb << "Created grid on p=" << comm().rank() << std::endl;
71  dverb << "************************************************" << std::endl;
72  checkMacroGrid ();
73 
74  postAdapt();
75  calcExtras();
76  } // end constructor
77 
78 
79  template< ALU3dGridElementType elType, class Comm >
80  inline int ALU3dGrid< elType, Comm >::global_size ( int codim ) const
81  {
82  // return actual size of hierarchical index set
83  // this is always up to date
84  // maxIndex is the largest index used + 1
85  return myGrid().indexManager(codim).getMaxIndex();
86  }
87 
88 
89  template< ALU3dGridElementType elType, class Comm >
90  inline int ALU3dGrid< elType, Comm >::hierSetSize ( int codim ) const
91  {
92  // return actual size of hierarchical index set
93  return myGrid().indexManager(codim).getMaxIndex();
94  }
95 
96 
97  template< ALU3dGridElementType elType, class Comm >
99  {
100  return maxlevel_;
101  }
102 
103 
104  template< ALU3dGridElementType elType, class Comm >
107  {
108  assert( mygrid_ );
109  return *mygrid_;
110  }
111 
112 
113  // lbegin methods
114  template< ALU3dGridElementType elType, class Comm >
115  template< int cd, PartitionIteratorType pitype >
116  inline typename ALU3dGrid< elType, Comm >::Traits::template Codim< cd >::template Partition< pitype >::LevelIterator
118  {
119  assert( level >= 0 );
120  // if we dont have this level return empty iterator
121  if( level > maxlevel_ )
122  return this->template lend<cd,pitype> (level);
123 
124  return ALU3dGridLevelIterator< cd, pitype, const ThisType >( factory(), level, true );
125  }
126 
127 
128  template< ALU3dGridElementType elType, class Comm >
129  template< int cd, PartitionIteratorType pitype >
130  inline typename ALU3dGrid< elType, Comm >::Traits::template Codim< cd >::template Partition< pitype >::LevelIterator
132  {
133  assert( level >= 0 );
134  return ALU3dGridLevelIterator< cd, pitype, const ThisType >( factory(), level );
135  }
136 
137 
138  // lbegin methods
139  template< ALU3dGridElementType elType, class Comm >
140  template< int cd >
141  inline typename ALU3dGrid< elType, Comm >::Traits::template Codim< cd >::template Partition< All_Partition >::LevelIterator
142  ALU3dGrid< elType, Comm >::lbegin ( int level ) const
143  {
144  return this->template lbegin<cd,All_Partition>( level );
145  }
146 
147 
148  template< ALU3dGridElementType elType, class Comm >
149  template< int cd >
150  inline typename ALU3dGrid< elType, Comm >::Traits::template Codim< cd >::template Partition< All_Partition >::LevelIterator
151  ALU3dGrid< elType, Comm >::lend ( int level ) const
152  {
153  assert( level >= 0 );
154  return this->template lend<cd,All_Partition>( level );
155  }
156 
157 
158  //***********************************************************
159  //
160  // leaf methods , first all begin methods
161  //
162  //***********************************************************
163  template< ALU3dGridElementType elType, class Comm >
164  template< int cd, PartitionIteratorType pitype >
165  inline typename ALU3dGrid< elType, Comm >::Traits::template Codim< cd >::template Partition< pitype >::LeafIterator
166  ALU3dGrid< elType, Comm >::createLeafIteratorBegin ( int level ) const
167  {
168  assert( level >= 0 );
169  return ALU3dGridLeafIterator< cd, pitype, const ThisType >( factory(), level, true );
170  }
171 
172 
173  template< ALU3dGridElementType elType, class Comm >
174  template< int cd, PartitionIteratorType pitype >
175  inline typename ALU3dGrid< elType, Comm >::Traits::template Codim< cd >::template Partition< pitype >::LeafIterator
176  ALU3dGrid< elType, Comm >::leafbegin ( int level ) const
177  {
178  return createLeafIteratorBegin<cd, pitype> (level) ;
179  }
180 
181 
182  template< ALU3dGridElementType elType, class Comm >
183  template< int cd >
184  inline typename ALU3dGrid< elType, Comm >::Traits::template Codim< cd >::LeafIterator
185  ALU3dGrid< elType, Comm >::leafbegin ( int level ) const
186  {
187  return createLeafIteratorBegin<cd, All_Partition> (level) ;
188  }
189 
190 
191  template< ALU3dGridElementType elType, class Comm >
192  template< int cd, PartitionIteratorType pitype >
193  inline typename ALU3dGrid< elType, Comm >::Traits::template Codim< cd >::template Partition< pitype >::LeafIterator
194  ALU3dGrid< elType, Comm >::leafbegin () const
195  {
196  return createLeafIteratorBegin< cd, pitype > (maxlevel_) ;
197  }
198 
199 
200  template< ALU3dGridElementType elType, class Comm >
201  template< int cd >
202  inline typename ALU3dGrid< elType, Comm >::Traits::template Codim< cd >::LeafIterator
203  ALU3dGrid< elType, Comm >::leafbegin () const
204  {
205  return createLeafIteratorBegin< cd, All_Partition> (maxlevel_) ;
206  }
207 
208 
209  template< ALU3dGridElementType elType, class Comm >
210  inline typename ALU3dGrid< elType, Comm >::LeafIteratorType
211  ALU3dGrid< elType, Comm >::leafbegin ( int level ) const
212  {
213  return createLeafIteratorBegin<0, All_Partition> (level) ;
214  }
215 
216 
217  template< ALU3dGridElementType elType, class Comm >
218  inline typename ALU3dGrid< elType, Comm >::LeafIteratorType
219  ALU3dGrid< elType, Comm >::leafbegin () const
220  {
221  return createLeafIteratorBegin<0, All_Partition> (maxlevel_) ;
222  }
223 
224 
225  //****************************************************************
226  //
227  // all leaf end methods
228  //
229  //****************************************************************
230  template< ALU3dGridElementType elType, class Comm >
231  template< int cd, PartitionIteratorType pitype >
232  inline typename ALU3dGrid< elType, Comm >::Traits::template Codim< cd >::template Partition< pitype >::LeafIterator
233  ALU3dGrid< elType, Comm >::createLeafIteratorEnd ( int level ) const
234  {
235  assert( level >= 0 );
236  return ALU3dGridLeafIterator<cd, pitype, const MyType> ( factory() , level);
237  }
238 
239 
240  template< ALU3dGridElementType elType, class Comm >
241  template< int cd, PartitionIteratorType pitype >
242  inline typename ALU3dGrid< elType, Comm >::Traits::template Codim< cd >::template Partition< pitype >::LeafIterator
243  ALU3dGrid< elType, Comm >::leafend ( int level ) const
244  {
245  return createLeafIteratorEnd < cd, pitype> (level);
246  }
247 
248 
249  template< ALU3dGridElementType elType, class Comm >
250  template< int cd >
251  inline typename ALU3dGrid< elType, Comm >::Traits::template Codim< cd >::LeafIterator
252  ALU3dGrid< elType, Comm >::leafend ( int level ) const
253  {
254  return createLeafIteratorEnd < cd, All_Partition> (level);
255  }
256 
257 
258  template< ALU3dGridElementType elType, class Comm >
259  template< int cd, PartitionIteratorType pitype >
260  inline typename ALU3dGrid< elType, Comm >::Traits::template Codim< cd >::template Partition< pitype >::LeafIterator
261  ALU3dGrid< elType, Comm >::leafend () const
262  {
263  return createLeafIteratorEnd < cd, pitype> (maxlevel_);
264  }
265 
266 
267  template< ALU3dGridElementType elType, class Comm >
268  template< int cd >
269  inline typename ALU3dGrid< elType, Comm >::Traits::template Codim< cd >::LeafIterator
270  ALU3dGrid< elType, Comm >::leafend () const
271  {
272  return createLeafIteratorEnd < cd, All_Partition> (maxlevel_);
273  }
274 
275 
276  template< ALU3dGridElementType elType, class Comm >
277  inline typename ALU3dGrid< elType, Comm >::LeafIteratorType
278  ALU3dGrid< elType, Comm >::leafend ( int level ) const
279  {
280  return createLeafIteratorEnd <0, All_Partition> (level);
281  }
282 
283 
284  template< ALU3dGridElementType elType, class Comm >
285  inline typename ALU3dGrid< elType, Comm >::LeafIteratorType
286  ALU3dGrid< elType, Comm >::leafend () const
287  {
288  return createLeafIteratorEnd <0,All_Partition> (maxlevel_);
289  }
290 
291 
292  //*****************************************************************
293 
294  // mark given entity
295  template< ALU3dGridElementType elType, class Comm >
296  inline bool ALU3dGrid< elType, Comm >
297  ::mark ( int ref, const typename Traits::template Codim< 0 >::Entity &entity )
298  {
299  bool marked = (this->getRealImplementation( entity )).mark(ref);
300  if(marked)
301  {
302  if(ref > 0) ++refineMarked_;
303  if(ref < 0) ++coarsenMarked_;
304  }
305  return marked;
306  }
307 
308 
309  // get Mark of given entity
310  template< ALU3dGridElementType elType, class Comm >
311  inline int ALU3dGrid< elType, Comm >
312  ::getMark ( const typename Traits::template Codim< 0 >::Entity &entity ) const
313  {
314  return this->getRealImplementation( entity ).getMark();
315  }
316 
317 
318  // global refine
319  template< ALU3dGridElementType elType, class Comm >
320  template< class GridImp, class DataHandle >
321  inline
324  {
325  assert( (refCount + maxLevel()) < MAXL );
326 
327  for( int count = refCount; count > 0; --count )
328  {
329  const LeafIteratorType end = leafend();
330  for( LeafIteratorType it = leafbegin(); it != end; ++it )
331  mark( 1 , *it );
332  adapt( handle );
333  }
334  }
335 
336 
337  // adapt grid
338  // --adapt
339  template< ALU3dGridElementType elType, class Comm >
340  template< class GridImp, class DataHandle >
341  inline
344  {
346 
347  typedef typename EntityObject::ImplementationType EntityImp;
348  EntityObject father( EntityImp( *this, this->maxLevel() ) );
349  EntityObject son( EntityImp( *this, this->maxLevel() ) );
350 
351  int defaultChunk = newElementsChunk_;
352  int actChunk = refineEstimate_ * refineMarked_;
353 
354  // guess how many new elements we get
355  int newElements = std::max( actChunk , defaultChunk );
356 
357  // true if at least one element was marked for coarsening
358  bool mightCoarse = preAdapt();
359  // reserve memory
360  handle.preAdapt( newElements );
361 
362  bool refined = false ;
363  if(globalIdSet_)
364  {
365  // if global id set exists then include into
366  // prolongation process
367  ALU3DSPACE AdaptRestrictProlongGlSet< MyType, AdaptDataHandle, GlobalIdSetImp >
368  rp(*this,
369  father,this->getRealImplementation(father),
370  son, this->getRealImplementation(son),
371  handle,
372  *globalIdSet_);
373 
374  refined = myGrid().duneAdapt(rp); // adapt grid
375  }
376  else
377  {
378  ALU3DSPACE AdaptRestrictProlongImpl< MyType, AdaptDataHandle >
379  rp(*this,
380  father,this->getRealImplementation(father),
381  son, this->getRealImplementation(son),
382  handle);
383 
384  refined = myGrid().duneAdapt(rp); // adapt grid
385  }
386 
387  if(refined || mightCoarse)
388  {
389  // only calc extras and skip maxLevel calculation, because of
390  // refinement maxLevel was calculated already
391  updateStatus();
392 
393  // no need to call postAdapt here, because markers
394  // are cleand during refinement callback
395  }
396 
397  // check whether we have balance
398  handle.postAdapt();
399 
400  // here postAdapt is not called, because
401  // reset of refinedTag is done in preCoarsening and postRefinement
402  // methods of datahandle (see datahandle.hh)
403 
404  return refined;
405  }
406 
407 
408 
409  //*****************************************************************
410 
411  template< ALU3dGridElementType elType, class Comm >
412  struct ALU3dGridCommHelper;
413 
414  template< ALU3dGridElementType elType >
415  struct ALU3dGridCommHelper< elType, No_Comm >
416  {
418 
419  static bool loadBalance ( Grid &grid ) { return false; }
420 
421  template< class DataHandle >
422  static bool loadBalance ( Grid &grid, DataHandle &data ) { return false; }
423 
424  template< class DataHandle, class DataType >
425  static void communicate ( const Grid &grid,
427  const InterfaceType iftype,
428  const CommunicationDirection dir,
429  const int level )
430  {}
431 
432  template< class DataHandle, class DataType >
433  static void communicate ( const Grid &grid,
435  const InterfaceType iftype,
436  const CommunicationDirection dir )
437  {}
438  }; // ALU3dGridCommHelper
439 
440 #if ALU3DGRID_PARALLEL
441  template< ALU3dGridElementType elType >
442  struct ALU3dGridCommHelper< elType, MPI_Comm >
443  {
444  typedef ALU3dGrid< elType, MPI_Comm > Grid;
445  typedef ALU3DSPACE GatherScatter GatherScatterType;
446 
447  static bool loadBalance ( Grid &grid )
448  {
449  if( grid.comm().size() <= 1 )
450  return false;
451 
452  const bool changed = grid.myGrid().duneLoadBalance();
453  if( changed )
454  {
455  // some exchanges on ALUGrid side
456  grid.myGrid().duneExchangeDynamicState();
457 
458  // calculate new maxlevel
459  // reset size and things
460  grid.updateStatus();
461 
462  // build new Id Set. Only do that after updateStatus, because here
463  // the item lists are needed
464  if( grid.globalIdSet_ )
465  grid.globalIdSet_->updateIdSet();
466 
467  // unset all leaf markers
468  grid.postAdapt();
469  }
470 
471  return changed;
472  }
473 
474 
475  template< class DataHandle >
476  static bool loadBalance ( Grid &grid, DataHandle &data )
477  {
478  if( grid.comm().size() <= 1 )
479  return false;
480 
481  typedef typename Grid :: EntityObject EntityObject;
482  typedef typename EntityObject::ImplementationType EntityImp;
483  EntityObject en ( EntityImp( grid, grid.maxLevel()) );
484  EntityObject father ( EntityImp( grid, grid.maxLevel()) );
485  EntityObject son ( EntityImp( grid, grid.maxLevel()) );
486 
487  typedef ALU3DSPACE LoadBalanceElementCount< Grid, DataHandle > LDBElCountType;
488 
489  // elCount is the adaption restPro operator used during the refinement
490  // cause be creating new elements on processors
491  LDBElCountType elCount( grid,
492  father, Grid::getRealImplementation( father ),
493  son, Grid::getRealImplementation( son ),
494  data );
495 
496  ALU3DSPACE GatherScatterLoadBalance< Grid, DataHandle, LDBElCountType >
497  gs( grid, en, Grid::getRealImplementation( en ), data, elCount );
498 
499  // call load Balance
500  const bool changed = grid.myGrid().duneLoadBalance( gs, elCount );
501 
502  if( changed )
503  {
504  // exchange some data for internal useage
505  grid.myGrid().duneExchangeDynamicState();
506 
507  // calculate new maxlevel
508  // reset size and things
509  grid.updateStatus();
510 
511  // build new Id Set. Only do that after updateStatus, because here
512  // the item lists are needed
513  if( grid.globalIdSet_ )
514  grid.globalIdSet_->updateIdSet();
515 
516  // compress data, wrapper for dof manager
517  gs.compress();
518 
519  grid.postAdapt();
520  }
521  return changed;
522  }
523 
524 
525  template< class DataHandle, class DataType >
526  static void communicate ( const Grid &grid,
527  CommDataHandleIF< DataHandle, DataType > &data,
528  const InterfaceType iftype,
529  const CommunicationDirection dir,
530  const int level )
531  {
532  typedef CommDataHandleIF< DataHandle, DataType > DataHandleType;
533  typedef MakeableInterfaceObject< typename Grid::Traits::template Codim< 3 >::Entity > VertexObject;
534  typedef typename VertexObject::ImplementationType VertexImp;
535  typedef MakeableInterfaceObject< typename Grid::Traits::template Codim< 2 >::Entity > EdgeObject;
536  typedef typename EdgeObject::ImplementationType EdgeImp;
537  typedef MakeableInterfaceObject< typename Grid::Traits::template Codim< 1 >::Entity > FaceObject;
538  typedef typename FaceObject::ImplementationType FaceImp;
539  typedef MakeableInterfaceObject< typename Grid::Traits::template Codim< 0 >::Entity> ElementObject;
540  typedef typename ElementObject::ImplementationType ElementImp;
541 
542  if( grid.comm().size() > 1 )
543  {
544  // for level communication the level index set is needed.
545  // if non-existent, then create for communicaton
546  const typename Grid::LevelIndexSetImp *levelISet;
547  if( !grid.levelIndexVec_[ level ] )
548  levelISet = new typename Grid::LevelIndexSetImp(
549  grid,
550  grid.template lbegin<0>( level ),
551  grid.template lend<0>( level ), level );
552  else
553  levelISet = grid.levelIndexVec_[ level ];
554 
555  VertexObject vx( VertexImp( grid, level ) );
556  ALU3DSPACE GatherScatterLevelData< Grid, DataHandleType, 3 >
557  vertexData( grid, vx, Grid::getRealImplementation( vx ), data, *levelISet, level );
558 
559  EdgeObject edge( EdgeImp( grid, level ) );
560  ALU3DSPACE GatherScatterLevelData< Grid, DataHandleType, 2 >
561  edgeData( grid, edge, Grid::getRealImplementation( edge ), data, *levelISet, level );
562 
563  FaceObject face( FaceImp( grid, level ) );
564  ALU3DSPACE GatherScatterLevelData< Grid, DataHandleType, 1 >
565  faceData( grid, face, Grid::getRealImplementation( face ), data, *levelISet, level );
566 
567  ElementObject element( ElementImp( grid, level ) );
568  ALU3DSPACE GatherScatterLevelData< Grid, DataHandleType, 0 >
569  elementData( grid, element, Grid::getRealImplementation( element ), data, *levelISet, level );
570 
571  doCommunication( grid, vertexData, edgeData, faceData, elementData, iftype, dir );
572 
573  if( !grid.levelIndexVec_[ level ] )
574  delete levelISet;
575  }
576  }
577 
578  template< class DataHandle, class DataType >
579  static void communicate ( const Grid &grid,
580  CommDataHandleIF< DataHandle, DataType > &data,
581  const InterfaceType iftype,
582  const CommunicationDirection dir )
583  {
584  typedef CommDataHandleIF< DataHandle, DataType > DataHandleType;
585  typedef MakeableInterfaceObject< typename Grid::Traits::template Codim< 3 >::Entity > VertexObject;
586  typedef typename VertexObject::ImplementationType VertexImp;
587  typedef MakeableInterfaceObject< typename Grid::Traits::template Codim< 2 >::Entity > EdgeObject;
588  typedef typename EdgeObject::ImplementationType EdgeImp;
589  typedef MakeableInterfaceObject< typename Grid::Traits::template Codim< 1 >::Entity > FaceObject;
590  typedef typename FaceObject::ImplementationType FaceImp;
591  typedef MakeableInterfaceObject< typename Grid::Traits::template Codim< 0 >::Entity> ElementObject;
592  typedef typename ElementObject::ImplementationType ElementImp;
593 
594  if( grid.comm().size() > 1 )
595  {
596  VertexObject vx( VertexImp( grid, grid.maxLevel() ) );
597  ALU3DSPACE GatherScatterLeafData< Grid, DataHandleType, 3 >
598  vertexData( grid, vx, Grid::getRealImplementation( vx ), data );
599 
600  EdgeObject edge( EdgeImp( grid, grid.maxLevel() ) );
601  ALU3DSPACE GatherScatterLeafData< Grid, DataHandleType, 2 >
602  edgeData( grid, edge, Grid::getRealImplementation( edge ), data );
603 
604  FaceObject face( FaceImp( grid, grid.maxLevel()) );
605  ALU3DSPACE GatherScatterLeafData< Grid, DataHandleType, 1 >
606  faceData( grid, face, Grid::getRealImplementation( face ), data );
607 
608  ElementObject element( ElementImp( grid, grid.maxLevel() ) );
609  ALU3DSPACE GatherScatterLeafData< Grid, DataHandleType, 0 >
610  elementData( grid, element, Grid::getRealImplementation( element ), data );
611 
612  doCommunication( grid, vertexData, edgeData, faceData, elementData, iftype, dir );
613  }
614  }
615 
616  static void
617  doCommunication ( const Grid &grid,
618  GatherScatterType &vertexData, GatherScatterType &edgeData,
619  GatherScatterType &faceData, GatherScatterType &elementData,
621  {
622  // check interface types
623  if( (iftype == Overlap_OverlapFront_Interface) || (iftype == Overlap_All_Interface) )
624  {
625  dverb << "ALUGrid contains no overlap, therefore no communication for" << std::endl;
626  dverb << "Overlap_OverlapFront_Interface or Overlap_All_Interface interfaces!" << std::endl;
627  }
628  // communication from border to border
629  else if( iftype == InteriorBorder_InteriorBorder_Interface )
630  grid.myGrid().borderBorderCommunication(vertexData,edgeData,faceData,elementData);
631  // communication from interior to ghost including border
632  else if( iftype == InteriorBorder_All_Interface )
633  {
634  if( dir == ForwardCommunication )
635  grid.myGrid().interiorGhostCommunication(vertexData,edgeData,faceData,elementData);
636  // reverse communiction interface (here All_InteriorBorder)
637  else if( dir == BackwardCommunication )
638  grid.myGrid().ghostInteriorCommunication(vertexData,edgeData,faceData,elementData);
639  }
640  // communication from interior to ghost including border
641  else if( iftype == All_All_Interface )
642  grid.myGrid().allAllCommunication(vertexData,edgeData,faceData,elementData);
643  else
644  DUNE_THROW( GridError, "Wrong set of parameters in ALUGridCommHelper::doCommunication" );
645  }
646  }; // ALU3dGridCommHelper
647 #endif // #if ALU3DGRID_PARALLEL
648 
649 
650 
651  template< ALU3dGridElementType elType, class Comm >
653  {
654  return ALU3dGridCommHelper< elType, Comm >::loadBalance( *this );
655  }
656 
657 
658  // load balance grid
659  template< ALU3dGridElementType elType, class Comm >
660  template< class DataHandle >
661  inline bool ALU3dGrid< elType, Comm >::loadBalance ( DataHandle &data )
662  {
663  return ALU3dGridCommHelper< elType, Comm >::loadBalance( *this, data );
664  }
665 
666 
667  // communicate level data
668  template< ALU3dGridElementType elType, class Comm >
669  template <class DataHandleImp,class DataType>
670  inline void ALU3dGrid< elType, Comm >::
672  InterfaceType iftype, CommunicationDirection dir, int level ) const
673  {
674  ALU3dGridCommHelper< elType, Comm >::communicate( *this, data, iftype, dir, level );
675  }
676 
677 
678  // communicate data
679  template< ALU3dGridElementType elType, class Comm >
680  template <class DataHandleImp, class DataType>
681  inline void ALU3dGrid< elType, Comm >::
683  InterfaceType iftype, CommunicationDirection dir) const
684  {
685  ALU3dGridCommHelper< elType, Comm >::communicate( *this, data, iftype, dir );
686  }
687 
688 
689  // return Grid name
690  template< ALU3dGridElementType elType, class Comm >
691  inline std::string ALU3dGrid< elType, Comm >::name ()
692  {
693  if( elType == hexa )
694  return "ALUCubeGrid";
695  else
696  return "ALUSimplexGrid";
697  }
698 
699 } // end namespace Dune