1#ifndef ALUGRID_GRID_INLINE_HH
2#define ALUGRID_GRID_INLINE_HH
5#include <dune/common/stdstreams.hh>
20 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
21 inline ALU3dGrid< dim, dimworld, elType, Comm >
22 ::ALU3dGrid (
const std::string ¯oTriangFilename,
34 , localIdSet_( *this )
35 , levelIndexVec_( 1, nullptr ) , leafIndexSet_()
37 , lockPostAdapt_( false )
42 , refinementType_( refinementType )
53 dverb <<
"************************************************" << std::endl;
54 dverb <<
"Created grid on p=" <<
comm().rank() << std::endl;
55 dverb <<
"************************************************" << std::endl;
63 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
76 geomTypes_.resize( dimension+1 );
78 for(
int codim = 0; codim <= dimension; ++codim )
81 tmpType.makeSimplex( dimension - codim );
83 tmpType.makeCube( dimension - codim );
85 geomTypes_[ codim ].push_back( tmpType );
89 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
95 return myGrid().indexManager(codim).getMaxIndex();
99 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
103 return myGrid().indexManager(codim).getMaxIndex();
107 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
114 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
124 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
125 template<
int cd, PartitionIteratorType pitype >
131 if( level > maxlevel_ )
132 return this->
template lend<cd,pitype> (level);
138 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
139 template<
int cd, PartitionIteratorType pitype >
149 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
154 return this->
template lbegin<cd,All_Partition>( level );
158 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
164 return this->
template lend<cd,All_Partition>( level );
173 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
174 template<
int cd, PartitionIteratorType pitype >
183 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
184 template<
int cd, PartitionIteratorType pitype >
185 inline typename ALU3dGrid< dim, dimworld, elType, Comm >::Traits::template Codim< cd >::template Partition< pitype >::LeafIterator
186 ALU3dGrid< dim, dimworld, elType, Comm >::leafbegin (
int level )
const
188 return createLeafIteratorBegin<cd, pitype> (level) ;
192 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
194 inline typename ALU3dGrid< dim, dimworld, elType, Comm >::Traits::template Codim< cd >::LeafIterator
195 ALU3dGrid< dim, dimworld, elType, Comm >::leafbegin (
int level )
const
197 return createLeafIteratorBegin<cd, All_Partition> (level) ;
201 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
202 template<
int cd, PartitionIteratorType pitype >
203 inline typename ALU3dGrid< dim, dimworld, elType, Comm >::Traits::template Codim< cd >::template Partition< pitype >::LeafIterator
206 return createLeafIteratorBegin< cd, pitype > (maxlevel_) ;
210 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
215 return createLeafIteratorBegin< cd, All_Partition> (maxlevel_) ;
219 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
223 return createLeafIteratorBegin<0, All_Partition> (level) ;
227 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
229 ALU3dGrid< dim, dimworld, elType, Comm >::leafbegin ()
const
231 return createLeafIteratorBegin<0, All_Partition> (maxlevel_) ;
240 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
241 template<
int cd, PartitionIteratorType pitype >
242 inline typename ALU3dGrid< dim, dimworld, elType, Comm >::Traits::template Codim< cd >::template Partition< pitype >::LeafIterator
243 ALU3dGrid< dim, dimworld, elType, Comm >::createLeafIteratorEnd (
int level )
const
246 return ALU3dGridLeafIterator<cd, pitype, const MyType> ( *
this, level);
250 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
251 template<
int cd, PartitionIteratorType pitype >
252 inline typename ALU3dGrid< dim, dimworld, elType, Comm >::Traits::template Codim< cd >::template Partition< pitype >::LeafIterator
253 ALU3dGrid< dim, dimworld, elType, Comm >::leafend (
int level )
const
255 return createLeafIteratorEnd < cd, pitype> (level);
259 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
261 inline typename ALU3dGrid< dim, dimworld, elType, Comm >::Traits::template Codim< cd >::LeafIterator
262 ALU3dGrid< dim, dimworld, elType, Comm >::leafend (
int level )
const
264 return createLeafIteratorEnd < cd, All_Partition> (level);
268 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
269 template<
int cd, PartitionIteratorType pitype >
270 inline typename ALU3dGrid< dim, dimworld, elType, Comm >::Traits::template Codim< cd >::template Partition< pitype >::LeafIterator
273 return createLeafIteratorEnd < cd, pitype> (maxlevel_);
277 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
282 return createLeafIteratorEnd < cd, All_Partition> (maxlevel_);
286 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
290 return createLeafIteratorEnd <0, All_Partition> (level);
294 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
296 ALU3dGrid< dim, dimworld, elType, Comm >::leafend ()
const
298 return createLeafIteratorEnd <0,All_Partition> (maxlevel_);
305 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
306 inline bool ALU3dGrid< dim, dimworld, elType, Comm >
309 bool marked = (this->getRealImplementation( entity )).mark( ref, conformingRefinement() );
312 if(ref > 0) ++refineMarked_;
313 if(ref < 0) ++coarsenMarked_;
320 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
324 return this->getRealImplementation( entity ).
getMark();
329 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
330 template<
class Gr
idImp,
class DataHandle >
333 ::globalRefine (
int refCount, AdaptDataHandleInterface< GridImp, DataHandle > &handle )
335 for(
int count = refCount; count > 0; --count )
347 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
348 template<
class Gr
idImp,
class DataHandle >
351 ::adapt ( AdaptDataHandleInterface< GridImp, DataHandle > &handle )
353 typedef AdaptDataHandleInterface< GridImp, DataHandle > AdaptDataHandle;
356 bool mightCoarse = preAdapt();
358 bool refined = false ;
363 ALU3DSPACE AdaptRestrictProlongGlSet< MyType, AdaptDataHandle, GlobalIdSetImp >
368 refined = myGrid().duneAdapt(rp);
372 ALU3DSPACE AdaptRestrictProlongImpl< MyType, AdaptDataHandle >
376 refined = myGrid().duneAdapt(rp);
379 if(refined || mightCoarse)
395 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
398 if( comm().size() <= 1 )
402 const bool changed = myGrid().loadBalance( lbData );
413 globalIdSet_->updateIdSet();
416 if( lbData && lbData->hasUserData() )
424 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
431 mygrid_.reset( GitterImplType :: compress( mygrid_.release() ) );
442 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
446 return "ALUCubeGrid";
448 return "ALUSimplexGrid";
#define alugrid_assert(EX)
Definition alugrid_assert.hh:20
#define ALU3DSPACE
Definition alu3dinclude.hh:24
Definition alu3dinclude.hh:80
@ hexa
Definition topology.hh:12
@ tetra
Definition topology.hh:12
ALUGridRefinementType
available refinement types for ALUGrid
Definition declaration.hh:24
[ provides Dune::Grid ]
Definition 3d/grid.hh:468
void calcExtras()
reset size and global size, update Level- and LeafIndexSet, if they exist
Definition grid_imp.cc:344
bool loadBalance()
Calculates load of each process and repartition by using ALUGrid's default partitioning method....
Definition 3d/grid.hh:928
const CollectiveCommunication & comm() const
Definition 3d/grid.hh:1066
int maxLevel() const
Return maximum level defined in this grid. Levels are numbered maxLevel with 0 the coarsest level.
Definition grid_inline.hh:108
Traits::DuneBoundaryProjectionType DuneBoundaryProjectionType
boundary projection type
Definition 3d/grid.hh:575
ALU3dGridCommunications< dim, dimworld, elType, Comm > Communications
Definition 3d/grid.hh:629
int hierSetSize(int cd) const
Definition grid_inline.hh:100
GitterImplType & myGrid() const
Definition grid_inline.hh:116
void finalizeGridCreation()
Definition grid_inline.hh:425
void checkMacroGridFile(const std::string filename)
check whether macro grid format is of our type
Definition grid_imp.cc:605
virtual GitterImplType * createALUGrid(const std::string ¯oName)
Definition 3d/grid.hh:1141
static std::string name()
for grid identification
Definition grid_inline.hh:443
Traits::template Codim< 0 >::LeafIterator LeafIteratorType
Definition 3d/grid.hh:607
void clearIsNewMarkers()
clear all entity new markers
Definition grid_imp.cc:491
void makeGeometries()
Definition grid_inline.hh:65
Traits::template Codim< cd >::template Partition< pitype >::LevelIterator lbegin(int level) const
Iterator to first entity of given codim on level.
Definition grid_inline.hh:127
std::unique_ptr< GitterImplType > mygrid_
Definition 3d/grid.hh:1314
Comm MPICommunicatorType
Definition 3d/grid.hh:627
ALU3DSPACE GatherScatter GatherScatterType
Definition 3d/grid.hh:891
int getMark(const typename Traits::template Codim< 0 >::Entity &e) const
Definition grid_inline.hh:322
Traits::template Codim< cd >::template Partition< pitype >::LevelIterator lend(int level) const
one past the end on this level
Definition grid_inline.hh:141
ALU3dImplTraits< elType, Comm >::GitterImplType GitterImplType
Definition 3d/grid.hh:612
Traits::DuneBoundaryProjectionVector DuneBoundaryProjectionVector
boundary projection type
Definition 3d/grid.hh:577
int global_size(int cd) const
number of grid entities on all levels for given codim
Definition grid_inline.hh:90
void checkMacroGrid()
check whether macro grid has the right element type
Definition grid_imp.cc:644
Definition iterator.hh:550
Definition geometry.hh:632
Leaf iterator.
Definition iterator.hh:635
Definition 3d/grid.hh:535
ALUGrid boundary projection implementation DuneBndProjection has to fulfil the DuneBoundaryProjection...
Definition bndprojection.hh:11