Dune Core Modules (2.3.1)

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