3 #ifndef DUNE_ALBERTAGRID_IMP_HH
4 #define DUNE_ALBERTAGRID_IMP_HH
11 #if HAVE_ALBERTA || DOXYGEN
21 #include <dune/common/fvector.hh>
22 #include <dune/common/fmatrix.hh>
23 #include <dune/common/stdstreams.hh>
24 #include <dune/common/parallel/collectivecommunication.hh>
50 #include "indexsets.hh"
51 #include "geometry.hh"
53 #include "entitypointer.hh"
54 #include "hierarchiciterator.hh"
56 #include "leveliterator.hh"
57 #include "leafiterator.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
483 template< GrapeIOFileFormatType ftype >
487 template< GrapeIOFileFormatType ftype >
524 return dofNumbering_;
529 return levelProvider_;
561 typedef std::vector<int> ArrayType;
582 template<
int codim >
589 template<
int codim >
630 size_t numBoundarySegments_;
636 DofNumbering dofNumbering_;
638 LevelProvider levelProvider_;
648 mutable std::vector< typename GridFamily::LevelIndexSetImp * > levelIndexVec_;
659 mutable MarkerVector leafMarkerVector_;
662 mutable std::vector< MarkerVector > levelMarkerVector_;
664 #if DUNE_ALBERTA_CACHE_COORDINATES
669 AdaptationState adaptationState_;
680 #ifdef _ABS_NOT_DEFINED_
684 #ifdef _MIN_NOT_DEFINED_
688 #ifdef _MAX_NOT_DEFINED_
692 #if DUNE_ALBERTA_VERSION >= 0x300
693 #ifdef obstack_chunk_alloc
694 #undef obstack_chunk_alloc
696 #ifdef obstack_chunk_free
697 #undef obstack_chunk_free
719 #endif // #ifdef ERROR
724 #endif // #ifdef ERROR_EXIT
729 #endif // #ifdef WARNING
734 #endif // #ifdef TEST
739 #endif // #ifdef TEST_EXIT
744 #endif // #ifdef DEBUG_TEST
747 #ifdef DEBUG_TEST_EXIT
748 #undef DEBUG_TEST_EXIT
749 #endif // #ifdef DEBUG_TEST_EXIT
754 #endif // #ifdef INFO
759 #endif // #ifdef PRINT_INFO
764 #endif // #ifdef PRINT_INT_VEC
767 #ifdef PRINT_REAL_VEC
768 #undef PRINT_REAL_VEC
769 #endif // #ifdef PRINT_REAL_VEC
774 #endif // #ifdef WAIT
779 #endif // #ifdef WAIT_REALLY
784 #endif // #ifdef GET_WORKSPACE
787 #ifdef FREE_WORKSPACE
788 #undef FREE_WORKSPACE
789 #endif // #ifdef FREE_WORKSPACE
794 #endif // #ifdef MAT_ALLOC
799 #endif // #ifdef MAT_FREE
804 #endif // #ifdef NAME
809 #endif // #ifdef GET_STRUCT
814 #endif // #ifdef ADD_PARAMETER
819 #endif // #ifdef GET_PARAMETER
823 #endif // HAVE_ALBERTA || DOXYGEN