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>
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
const MeshPointer & meshPointer() const
Definition: agrid.hh:517
Definition: albertagrid/gridfamily.hh:81
A Traits struct that collects all associated types of one implementation.
Definition: common/grid.hh:435
Traits::template Codim< codim >::template Partition< pitype >::LeafIterator leafend() const
return LeafIterator which points behind last leaf entity
interfaces and wrappers needed for the callback adaptation provided by AlbertaGrid and ALUGrid ...
static ReturnImplementationType< InterfaceType >::ImplementationType & getRealImplementation(InterfaceType &i)
return real implementation of interface class
Definition: common/grid.hh:1223
const LocalIdSet & localIdSet() const
return local IdSet
Definition: agrid.hh:506
Definition: albertagrid/entity.hh:27
GridFamily::ctype ctype
Definition: agrid.hh:175
size_t numBoundarySegments() const
number of boundary segments within the macro grid
Definition: agrid.hh:383
Definition: topology.hh:13
Definition: common.hh:179
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
Definition: albertagrid/intersection.hh:29
void globalRefine(int refCount)
uses the interface, mark on entity and refineLocal
Definition: albertagrid.cc:302
IndexSet< GridImp, LeafIndexSetImp, int > LeafIndexSet
Definition: albertagrid/gridfamily.hh:147
Index Set Interface base class.
Definition: common/grid.hh:359
Contains #undefs for all preprocessor macros defined by alberta.
void postAdapt()
clean up some markers
Definition: albertagrid.cc:354
int alberta2dune(int codim, int i) const
Definition: misc.hh:424
Provide a generic factory class for unstructured grids.
Definition: common/gridfactory.hh:263
Provides size cache classes to implement the grids size method efficiently.
Traits::template Partition< pitype >::LeafGridView leafView() const
View for the leaf grid.
Definition: agrid.hh:400
int alberta2generic(int codim, int i) const
Definition: agrid.hh:547
const HierarchicIndexSet & hierarchicIndexSet() const
Definition: agrid.hh:491
Provide a generic factory class for unstructured grids.
int getMark(const typename Traits::template Codim< 0 >::Entity &e) const
returns adaptation mark for given entity, i.e. here the default implementation returns 0...
Definition: common/grid.hh:1133
int dune2alberta(int codim, int i) const
Definition: agrid.hh:532
static const int dimensionworld
Definition: agrid.hh:178
Types for GridView.
Definition: common/grid.hh:418
bool writeGrid(const std::string &filename, ctype time) const
write Grid to file in specified GrapeIOFileFormatType
Definition: albertagrid.cc:580
Definition: albertagrid/gridview.hh:20
ALBERTA REAL_D GlobalVector
Definition: misc.hh:47
EntityPointer implementation for AlbertaGrid.
Definition: albertagrid/entity.hh:21
ALBERTA MESH * getMesh() const
Definition: agrid.hh:512
int generic2alberta(int codim, int i) const
Definition: agrid.hh:542
Definition: albertagrid/gridview.hh:23
bool adapt()
Refine all positive marked leaf entities, coarsen all negative marked entities if possible...
Definition: albertagrid.cc:413
Definition: adaptcallback.hh:27
static int getTwistInOutside(const typename Traits::LeafIntersection &intersection)
Definition: agrid.hh:603
~AlbertaGrid()
desctructor
Definition: albertagrid.cc:194
AlbertaGrid()
create an empty grid
Definition: albertagrid.cc:40
static std::string typeName()
Definition: agrid.hh:463
const DofNumbering & dofNumbering() const
Definition: agrid.hh:522
Definition: objectfactory.hh:23
const CollectiveCommunication & comm() const
return reference to collective communication, if MPI found this is specialisation for MPI ...
Definition: agrid.hh:458
Definition: albertagrid/datahandle.hh:24
Traits::template Partition< pitype >::LevelGridView levelView(int level) const
View for a grid level.
Definition: agrid.hh:391
Definition: albertagrid/gridfamily.hh:51
provides the GridFamily for AlbertaGrid
[ provides Dune::Grid ]
Definition: agrid.hh:137
static const int dimension
Definition: albertagrid/gridfamily.hh:87
int dune2alberta(int codim, int i) const
Definition: misc.hh:417
Traits::template Partition< All_Partition >::LevelGridView levelView(int level) const
View for a grid level for All_Partition.
Definition: agrid.hh:409
Traits::HierarchicIndexSet HierarchicIndexSet
type of hierarchic index set
Definition: agrid.hh:189
Traits::template Codim< cd >::template Partition< pitype >::LevelIterator lbegin(int level) const
Iterator to first entity of given codim on level.
const LevelProvider & levelProvider() const
Definition: agrid.hh:527
Definition: albertagrid/gridfamily.hh:66
bool mark(int refCount, const typename Traits::template Codim< 0 >::Entity &e)
Marks an entity to be refined/coarsened in a subsequent adapt.
Definition: common/grid.hh:1121
Interface class for vertex projection at the boundary.
Definition: boundaryprojection.hh:23
organizes the caching of sizes for one grid and one GeometryType
Definition: sizecache.hh:29
const Alberta::GlobalVector & getCoord(const ElementInfo &elementInfo, int vertex) const
Definition: albertagrid.cc:475
Definition: albertagrid/entity.hh:33
Traits::template Codim< cd >::template Partition< pitype >::LevelIterator lend(int level) const
one past the end on this level
AlbertaGridIndexSet< dim, dimworld > LeafIndexSetImp
Definition: albertagrid/gridfamily.hh:91
Definition: coordcache.hh:22
Definition: albertagrid/gridfamily.hh:96
Traits::template Codim< codim >::template Partition< pitype >::LeafIterator leafbegin() const
return LeafIterator which points to first leaf entity
static const int dimension
Definition: agrid.hh:177
#define ALBERTA
Definition: albertaheader.hh:27
Intersection of a mesh entities of codimension 0 ("elements") with a "neighboring" element or with th...
Definition: albertagrid/dgfparser.hh:26
bool mark(int refCount, const typename Traits::template Codim< 0 >::Entity &e)
Marks an entity to be refined/coarsened in a subsequent adapt.
Definition: albertagrid.cc:383
const AlbertaGridLeafIntersection< const This > & getRealIntersection(const typename Traits::LeafIntersection &intersection) const
Definition: agrid.hh:609
Traits::CollectiveCommunication CollectiveCommunication
type of collective communication
Definition: agrid.hh:197
Store a reference to an entity with a minimal memory footprint.
Definition: common/entityseed.hh:23
Traits::template Partition< All_Partition >::LeafGridView leafView() const
View for the leaf grid for All_Partition.
Definition: agrid.hh:417
bool readGridXdr(const std::string &filename, ctype &time)
reads ALBERTA mesh file
Definition: albertagrid.cc:635
bool writeGridXdr(const std::string &filename, ctype time) const
Definition: albertagrid.cc:625
marker assigning subentities to one element containing them
Definition: treeiterator.hh:29
static int getTwist(const typename Traits::template Codim< codim >::Entity &entity)
Definition: agrid.hh:584
static int getTwist(const typename Traits::template Codim< 0 >::Entity &entity, int subEntity)
Definition: agrid.hh:591
Different resources needed by all grid implementations.
Dune::CollectiveCommunication< No_Comm > CollectiveCommunication
Definition: albertagrid/gridfamily.hh:152
Definition: common/geometry.hh:24
bool readGrid(const std::string &filename, ctype &time)
read Grid from file filename and store time of mesh in time
Definition: albertagrid.cc:604
Definition: albertagrid/entity.hh:30
const GlobalIdSet & globalIdSet() const
return global IdSet
Definition: agrid.hh:500
Contains #undefs for all preprocessor macros defined by alberta.
bool preAdapt()
returns true, if a least one element is marked for coarsening
Definition: albertagrid.cc:346
ALBERTA REAL Real
Definition: misc.hh:45
IndexSet< GridImp, LevelIndexSetImp, int > LevelIndexSet
Definition: albertagrid/gridfamily.hh:146
hierarchic index set of AlbertaGrid
Definition: albertagrid/gridfamily.hh:63
const Traits::LeafIndexSet & leafIndexSet() const
return leaf index set
Definition: albertagrid.cc:539
Definition: albertagrid/entity.hh:45
static int getTwistInInside(const typename Traits::LeafIntersection &intersection)
Definition: agrid.hh:597
int maxLevel() const
Definition: albertagrid.cc:487
static const int dimensionworld
Definition: albertagrid/gridfamily.hh:88
int alberta2dune(int codim, int i) const
Definition: agrid.hh:537
int size(int level, int codim) const
Number of grid entities per level and codim because lbegin and lend are none const, and we need this methods counting the entities on each level, you know.
Definition: albertagrid.cc:494
Definition: albertagrid/projection.hh:77
Id Set Interface.
Definition: common/grid.hh:360
int getMark(const typename Traits::template Codim< 0 >::Entity &e) const
returns adaptation mark for given entity
Definition: albertagrid.cc:406
Implementation of the IntersectionIterator for AlbertaGrid.
Traits::template Codim< EntitySeed::codimension >::EntityPointer entityPointer(const EntitySeed &seed) const
obtain EntityPointer from EntitySeed.
Definition: agrid.hh:473
Alberta::Real ctype
Definition: albertagrid/gridfamily.hh:85
const Traits::LevelIndexSet & levelIndexSet(int level) const
return level index set for given level
Definition: albertagrid.cc:524