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 >
34 , localIdSet_( *this )
35 , levelIndexVec_( 1, nullptr ) , leafIndexSet_()
37 , lockPostAdapt_( false )
42 , refinementType_( refinementType )
48 checkMacroGridFile( macroTriangFilename );
50 mygrid_.reset( createALUGrid( macroTriangFilename ) );
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
204 ALU3dGrid< dim, dimworld, elType, Comm >::leafbegin ()
const
206 return createLeafIteratorBegin< cd, pitype > (maxlevel_) ;
210 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
212 inline typename ALU3dGrid< dim, dimworld, elType, Comm >::Traits::template Codim< cd >::LeafIterator
213 ALU3dGrid< dim, dimworld, elType, Comm >::leafbegin ()
const
215 return createLeafIteratorBegin< cd, All_Partition> (maxlevel_) ;
219 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
221 ALU3dGrid< dim, dimworld, elType, Comm >::leafbegin (
int level )
const
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
271 ALU3dGrid< dim, dimworld, elType, Comm >::leafend ()
const
273 return createLeafIteratorEnd < cd, pitype> (maxlevel_);
277 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
279 inline typename ALU3dGrid< dim, dimworld, elType, Comm >::Traits::template Codim< cd >::LeafIterator
280 ALU3dGrid< dim, dimworld, elType, Comm >::leafend ()
const
282 return createLeafIteratorEnd < cd, All_Partition> (maxlevel_);
286 template<
int dim,
int dimworld, ALU3dGr
idElementType elType,
class Comm >
288 ALU3dGrid< dim, dimworld, elType, Comm >::leafend (
int level )
const
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 >
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";