1 #ifndef DUNE_ALBERTAGRID_IMP_HH
2 #define DUNE_ALBERTAGRID_IMP_HH
13 #include <dune/common/deprecated.hh>
20 #include <dune/common/misc.hh>
21 #include <dune/common/fvector.hh>
22 #include <dune/common/fmatrix.hh>
23 #include <dune/common/stdstreams.hh>
24 #include <dune/common/collectivecommunication.hh>
65 template<
class Gr
id >
136 template<
int dim,
int dimworld = Alberta::dimWorld >
139 < dim, dimworld, Alberta::Real, AlbertaGridFamily< dim, dimworld > >
160 #if (__GNUC__ < 4) && !(defined __ICC)
168 template< class, class >
201 typedef typename Traits::template
Codim<0>::LeafIterator LeafIterator;
207 struct AdaptationState
209 enum Phase { ComputationPhase, PreAdaptationPhase, PostAdaptationPhase };
218 : phase_( ComputationPhase ),
223 void mark (
int count )
228 refineMarked_ += (2 << count);
231 void unmark (
int count )
236 refineMarked_ -= (2 << count);
239 bool coarsen ()
const
241 return (coarsenMarked_ > 0);
244 int refineMarked ()
const
246 return refineMarked_;
251 if( phase_ != ComputationPhase )
252 error(
"preAdapt may only be called in computation phase." );
253 phase_ = PreAdaptationPhase;
258 if( phase_ != PreAdaptationPhase )
259 error(
"adapt may only be called in preadapdation phase." );
260 phase_ = PostAdaptationPhase;
265 if( phase_ != PostAdaptationPhase )
266 error(
"postAdapt may only be called in postadaptation phase." );
267 phase_ = ComputationPhase;
274 void error (
const std::string &message )
276 DUNE_THROW( InvalidStateException, message );
280 template<
class DataHandler >
281 struct AdaptationCallback;
284 static const int MAXL = 64;
293 This &operator= (
const This & );
308 template<
class Proj,
class Impl >
316 AlbertaGrid (
const std::string ¯oGridFileName );
326 template<
int cd, PartitionIteratorType pitype>
327 typename Traits::template Codim<cd>::template Partition<pitype>::LevelIterator
331 template<
int cd, PartitionIteratorType pitype>
332 typename Traits::template Codim<cd>::template Partition<pitype>::LevelIterator
333 lend (
int level)
const;
336 template<
int codim >
337 typename Traits::template Codim< codim >::LevelIterator
338 lbegin (
int level )
const;
341 template<
int codim >
342 typename Traits::template Codim< codim >::LevelIterator
343 lend (
int level )
const;
346 template<
int codim, PartitionIteratorType pitype >
348 ::template Codim< codim >::template Partition< pitype >::LeafIterator
352 template<
int codim, PartitionIteratorType pitype >
354 ::template Codim< codim >::template Partition< pitype >::LeafIterator
358 template<
int codim >
359 typename Traits::template Codim< codim >::LeafIterator
363 template<
int codim >
364 typename Traits::template Codim< codim >::LeafIterator
371 int size (
int level,
int codim)
const;
377 int size (
int codim)
const;
385 return numBoundarySegments_;
389 template< PartitionIteratorType pitype >
390 typename Traits::template Partition< pitype >::LevelGridView
394 typedef typename View::GridViewImp ViewImp;
395 return View( ViewImp( *
this, level ) );
399 template< PartitionIteratorType pitype >
403 typedef typename View::GridViewImp ViewImp;
404 return View( ViewImp( *
this ) );
408 typename Traits::template Partition< All_Partition >::LevelGridView
412 typedef typename View::GridViewImp ViewImp;
413 return View( ViewImp( *
this, level ) );
420 typedef typename View::GridViewImp ViewImp;
421 return View( ViewImp( *
this ) );
432 int getMark (
const typename Traits::template Codim< 0 >::Entity &e )
const;
435 bool mark (
int refCount,
const typename Traits::template Codim< 0 >::Entity &e );
440 template<
class DataHandle >
447 template<
class DataHandle >
465 std::ostringstream s;
466 s <<
"AlbertaGrid< " << dim <<
", " << dimworld <<
" >";
471 template<
class EntitySeed >
472 typename Traits::template Codim< EntitySeed::codimension >::EntityPointer
476 return EntityPointerImpl( *
this, seed.elementInfo(
meshPointer() ), seed.subEntity() );
483 template< GrapeIOFileFormatType ftype >
487 template< GrapeIOFileFormatType ftype >
524 return dofNumbering_;
529 return levelProvider_;
555 typedef std::vector<int> ArrayType;
564 bool writeGridXdr (
const std::string &filename,
ctype time )
const;
567 bool readGridXdr (
const std::string &filename,
ctype &time );
571 bool readGridAscii (
const std::string &filename,
ctype &time );
586 template<
int codim >
593 template<
int codim >
634 size_t numBoundarySegments_;
640 DofNumbering dofNumbering_;
642 LevelProvider levelProvider_;
652 mutable std::vector< typename GridFamily::LevelIndexSetImp * > levelIndexVec_;
663 mutable MarkerVector leafMarkerVector_;
666 mutable std::vector< MarkerVector > levelMarkerVector_;
668 #if DUNE_ALBERTA_CACHE_COORDINATES
673 AdaptationState adaptationState_;
684 #ifdef _ABS_NOT_DEFINED_
688 #ifdef _MIN_NOT_DEFINED_
692 #ifdef _MAX_NOT_DEFINED_
696 #if DUNE_ALBERTA_VERSION >= 0x300
697 #ifdef obstack_chunk_alloc
698 #undef obstack_chunk_alloc
700 #ifdef obstack_chunk_free
701 #undef obstack_chunk_free
723 #endif // #ifdef ERROR
728 #endif // #ifdef ERROR_EXIT
733 #endif // #ifdef WARNING
738 #endif // #ifdef TEST
743 #endif // #ifdef TEST_EXIT
748 #endif // #ifdef DEBUG_TEST
751 #ifdef DEBUG_TEST_EXIT
752 #undef DEBUG_TEST_EXIT
753 #endif // #ifdef DEBUG_TEST_EXIT
758 #endif // #ifdef INFO
763 #endif // #ifdef PRINT_INFO
768 #endif // #ifdef PRINT_INT_VEC
771 #ifdef PRINT_REAL_VEC
772 #undef PRINT_REAL_VEC
773 #endif // #ifdef PRINT_REAL_VEC
778 #endif // #ifdef WAIT
783 #endif // #ifdef WAIT_REALLY
788 #endif // #ifdef GET_WORKSPACE
791 #ifdef FREE_WORKSPACE
792 #undef FREE_WORKSPACE
793 #endif // #ifdef FREE_WORKSPACE
798 #endif // #ifdef MAT_ALLOC
803 #endif // #ifdef MAT_FREE
808 #endif // #ifdef NAME
813 #endif // #ifdef GET_STRUCT
818 #endif // #ifdef ADD_PARAMETER
823 #endif // #ifdef GET_PARAMETER
827 #endif // HAVE_ALBERTA