Go to the documentation of this file.
3 #ifndef DUNE_ALBERTAGRID_IMP_HH
4 #define DUNE_ALBERTAGRID_IMP_HH
11 #if HAVE_ALBERTA || DOXYGEN
23 #include <dune/common/deprecated.hh>
24 #include <dune/common/fvector.hh>
25 #include <dune/common/fmatrix.hh>
26 #include <dune/common/stdstreams.hh>
27 #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 >
338 lbegin (
int level )
const;
341 template<
int codim >
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 >
363 template<
int codim >
371 int size (
int level,
int codim)
const;
377 int size (
int codim)
const;
385 return numBoundarySegments_;
392 typedef typename View::GridViewImp ViewImp;
393 return View( ViewImp( *
this, level ) );
400 typedef typename View::GridViewImp ViewImp;
401 return View( ViewImp( *
this ) );
420 template<
class DataHandle >
427 template<
class DataHandle >
445 std::ostringstream s;
446 s <<
"AlbertaGrid< " << dim <<
", " << dimworld <<
" >";
451 template<
class EntitySeed >
502 return dofNumbering_;
507 return levelProvider_;
522 return genericNumberingMap_.dune2alberta( codim, i );
527 return genericNumberingMap_.alberta2dune( codim, i );
532 DUNE_DEPRECATED_MSG(
"Deprecated in Dune 3.0, use writeGrid instead.")
537 DUNE_DEPRECATED_MSG("Deprecated in
Dune 3.0, use
readGrid instead.")
543 typedef std::vector<
int> ArrayType;
564 template<
int codim >
571 template<
int codim >
612 size_t numBoundarySegments_;
618 DofNumbering dofNumbering_;
620 LevelProvider levelProvider_;
630 mutable std::vector< typename GridFamily::LevelIndexSetImp * > levelIndexVec_;
641 mutable MarkerVector leafMarkerVector_;
644 mutable std::vector< MarkerVector > levelMarkerVector_;
646 #if DUNE_ALBERTA_CACHE_COORDINATES
651 AdaptationState adaptationState_;
662 #ifdef _ABS_NOT_DEFINED_
666 #ifdef _MIN_NOT_DEFINED_
670 #ifdef _MAX_NOT_DEFINED_
674 #ifdef obstack_chunk_alloc
675 #undef obstack_chunk_alloc
677 #ifdef obstack_chunk_free
678 #undef obstack_chunk_free
697 #endif // #ifdef ERROR
702 #endif // #ifdef ERROR_EXIT
707 #endif // #ifdef WARNING
712 #endif // #ifdef TEST
717 #endif // #ifdef TEST_EXIT
722 #endif // #ifdef DEBUG_TEST
725 #ifdef DEBUG_TEST_EXIT
726 #undef DEBUG_TEST_EXIT
727 #endif // #ifdef DEBUG_TEST_EXIT
732 #endif // #ifdef INFO
737 #endif // #ifdef PRINT_INFO
742 #endif // #ifdef PRINT_INT_VEC
745 #ifdef PRINT_REAL_VEC
746 #undef PRINT_REAL_VEC
747 #endif // #ifdef PRINT_REAL_VEC
752 #endif // #ifdef WAIT
757 #endif // #ifdef WAIT_REALLY
762 #endif // #ifdef GET_WORKSPACE
765 #ifdef FREE_WORKSPACE
766 #undef FREE_WORKSPACE
767 #endif // #ifdef FREE_WORKSPACE
772 #endif // #ifdef MAT_ALLOC
777 #endif // #ifdef MAT_FREE
782 #endif // #ifdef NAME
787 #endif // #ifdef GET_STRUCT
792 #endif // #ifdef ADD_PARAMETER
797 #endif // #ifdef GET_PARAMETER
801 #endif // HAVE_ALBERTA || DOXYGEN
Store a reference to an entity with a minimal memory footprint.
Definition: common/entityseed.hh:23
Interface class for the Grid's adapt method where the parameter is a AdaptDataHandleInterface.
Definition: adaptcallback.hh:30
Different resources needed by all grid implementations.
GridFamily::ctype ctype
Definition: agrid.hh:175
std::size_t numBoundarySegments() const
number of boundary segments within the macro grid
Definition: agrid.hh:383
ALBERTA MESH * getMesh() const
Definition: agrid.hh:490
Provide a generic factory class for unstructured grids.
IndexSet< GridImp, LevelIndexSetImp, int, std::array< GeometryType, 1 > > LevelIndexSet
Definition: albertagrid/gridfamily.hh:141
Definition: albertagrid/intersection.hh:29
Definition: albertagrid/entity.hh:45
Intersection of a mesh entity of codimension 0 ("element") with a "neighboring" element or with the d...
Definition: albertagrid/dgfparser.hh:26
int size(int level, int codim) const
Number of grid entities per level and codim because lbegin and lend are none const,...
Definition: albertagrid.cc:488
Traits::template Codim< EntitySeed::codimension >::Entity entity(const EntitySeed &seed) const
obtain Entity from EntitySeed.
Definition: agrid.hh:453
Provide a generic factory class for unstructured grids.
Definition: common/gridfactory.hh:263
AlbertaGridIndexSet< dim, dimworld > LeafIndexSetImp
Definition: albertagrid/gridfamily.hh:91
Definition: albertagrid/gridfamily.hh:51
Definition: albertagrid/entity.hh:27
organizes the caching of sizes for one grid and one GeometryType
Definition: sizecache.hh:29
Include standard header files.
Definition: agrid.hh:59
Contains #undefs for all preprocessor macros defined by alberta.
void postAdapt()
clean up some markers
Definition: albertagrid.cc:354
Definition: common/grid.hh:1264
marker assigning subentities to one element containing them
Definition: treeiterator.hh:29
static std::string typeName()
Definition: agrid.hh:443
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:989
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:977
[ provides Dune::Grid ]
Definition: agrid.hh:137
int generic2alberta(int codim, int i) const
Definition: agrid.hh:520
bool readGridXdr(const std::string &filename, ctype &time)
reads ALBERTA mesh file
Definition: albertagrid.cc:581
Traits::template Codim< cd >::template Partition< pitype >::LevelIterator lend(int level) const
one past the end on this level
Definition: albertagrid.cc:224
Dune::CollectiveCommunication< No_Comm > CollectiveCommunication
Definition: albertagrid/gridfamily.hh:147
int getMark(const typename Traits::template Codim< 0 >::Entity &e) const
returns adaptation mark for given entity
Definition: albertagrid.cc:406
GridFamily::Traits::template Codim< cd >::LeafIterator LeafIterator
A type that is a model of Dune::LeafIterator with partition type All_Partition.
Definition: common/grid.hh:454
Definition: coordcache.hh:22
const LevelProvider & levelProvider() const
Definition: agrid.hh:505
static int getTwistInOutside(const typename Traits::LeafIntersection &intersection)
Definition: agrid.hh:585
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
int dune2alberta(int codim, int i) const
Definition: misc.hh:387
const LocalIdSet & localIdSet() const
return local IdSet
Definition: agrid.hh:484
static const int dimension
Definition: albertagrid/gridfamily.hh:87
Alberta::Real ctype
Definition: albertagrid/gridfamily.hh:85
int alberta2dune(int codim, int i) const
Definition: agrid.hh:515
Wrapper class for entities.
Definition: common/entity.hh:61
Traits ::template Codim< codim >::template Partition< pitype >::LeafIterator leafend() const
return LeafIterator which points behind last leaf entity
A Traits struct that collects all associated types of one implementation.
Definition: common/grid.hh:414
EntityPointer implementation for AlbertaGrid.
Definition: albertagrid/entity.hh:21
static const int dimensionworld
Definition: albertagrid/gridfamily.hh:88
int dune2alberta(int codim, int i) const
Definition: agrid.hh:510
Id Set Interface.
Definition: common/grid.hh:347
static int getTwist(const typename Traits::template Codim< 0 >::Entity &entity, int subEntity)
Definition: agrid.hh:573
IndexSet< GridImp, LeafIndexSetImp, int, std::array< GeometryType, 1 > > LeafIndexSet
Definition: albertagrid/gridfamily.hh:142
Traits ::template Codim< codim >::template Partition< pitype >::LeafIterator leafbegin() const
return LeafIterator which points to first leaf entity
GridFamily::Traits::template Codim< cd >::LevelIterator LevelIterator
A type that is a model of Dune::LevelIterator with partition type All_Partition.
Definition: common/grid.hh:450
const DofNumbering & dofNumbering() const
Definition: agrid.hh:500
bool adapt()
Refine all positive marked leaf entities, coarsen all negative marked entities if possible.
Definition: albertagrid.cc:413
AlbertaGrid()
create an empty grid
Definition: albertagrid.cc:40
const Traits ::LevelIndexSet & levelIndexSet(int level) const
return level index set for given level
Definition: albertagrid.cc:518
Definition: common/geometry.hh:24
Traits::template Codim< cd >::template Partition< pitype >::LevelIterator lbegin(int level) const
Iterator to first entity of given codim on level.
Definition: albertagrid.cc:204
Provides size cache classes to implement the grids size method efficiently.
int alberta2dune(int codim, int i) const
Definition: misc.hh:394
Index Set Interface base class.
Definition: common/grid.hh:346
const Traits ::LeafIndexSet & leafIndexSet() const
return leaf index set
Definition: albertagrid.cc:533
Traits::LevelGridView levelGridView(int level) const
View for a grid level for All_Partition.
Definition: agrid.hh:389
Traits::HierarchicIndexSet HierarchicIndexSet
type of hierarchic index set
Definition: agrid.hh:189
static std::conditional< std::is_reference< InterfaceType >::value, typename std::add_lvalue_reference< typename ReturnImplementationType< typename std::remove_reference< InterfaceType >::type >::ImplementationType >::type, typename std::remove_const< typename ReturnImplementationType< typename std::remove_reference< InterfaceType >::type >::ImplementationType >::type >::type getRealImplementation(InterfaceType &&i)
return real implementation of interface class
Definition: common/grid.hh:1119
Implementation of the IntersectionIterator for AlbertaGrid.
Definition: albertagrid/gridfamily.hh:66
Definition: albertagrid/entity.hh:33
Definition: albertagrid/datahandle.hh:24
#define ALBERTA
Definition: albertaheader.hh:27
AlbertaGridFamily< dim, dimworld >::Traits Traits
Definition: agrid.hh:181
bool preAdapt()
returns true, if a least one element is marked for coarsening
Definition: albertagrid.cc:346
const Alberta::GlobalVector & getCoord(const ElementInfo &elementInfo, int vertex) const
Definition: albertagrid.cc:469
bool writeGrid(const std::string &filename, ctype time) const
write Grid to file in Xdr
Definition: albertagrid.cc:589
bool writeGridXdr(const std::string &filename, ctype time) const
Definition: albertagrid.cc:573
GridFamily::Traits::template Codim< cd >::Entity Entity
A type that is a model of a Dune::Entity<cd,dim,...>.
Definition: common/grid.hh:423
bool readGrid(const std::string &filename, ctype &time)
read Grid from file filename and store time of mesh in time
Definition: albertagrid.cc:599
provides the GridFamily for AlbertaGrid
const MeshPointer & meshPointer() const
Definition: agrid.hh:495
const HierarchicIndexSet & hierarchicIndexSet() const
Definition: agrid.hh:469
Traits::LeafGridView leafGridView() const
View for the leaf grid for All_Partition.
Definition: agrid.hh:397
const GlobalIdSet & globalIdSet() const
return global IdSet
Definition: agrid.hh:478
Traits::CollectiveCommunication CollectiveCommunication
type of collective communication
Definition: agrid.hh:197
const CollectiveCommunication & comm() const
return reference to collective communication, if MPI found this is specialisation for MPI
Definition: agrid.hh:438
int alberta2generic(int codim, int i) const
Definition: agrid.hh:525
static int getTwistInInside(const typename Traits::LeafIntersection &intersection)
Definition: agrid.hh:579
interfaces and wrappers needed for the callback adaptation provided by AlbertaGrid and dune-ALUGrid
ALBERTA REAL_D GlobalVector
Definition: misc.hh:47
Definition: albertagrid/gridview.hh:20
const AlbertaGridLeafIntersection< const This > & getRealIntersection(const typename Traits::LeafIntersection &intersection) const
Definition: agrid.hh:591
Definition: albertagrid/projection.hh:77
static int getTwist(const typename Traits::template Codim< codim >::Entity &entity)
Definition: agrid.hh:566
static const int dimensionworld
Definition: agrid.hh:178
Definition: albertagrid/gridfamily.hh:96
Interface class for vertex projection at the boundary.
Definition: boundaryprojection.hh:23
ALBERTA REAL Real
Definition: misc.hh:45
Definition: common.hh:179
~AlbertaGrid()
desctructor
Definition: albertagrid.cc:194
static const int dimension
Definition: agrid.hh:177
Definition: albertagrid/gridview.hh:23
int maxLevel() const
Definition: albertagrid.cc:481
Grid view abstract base class.
Definition: common/gridview.hh:59
hierarchic index set of AlbertaGrid
Definition: albertagrid/gridfamily.hh:63
Definition: albertagrid/entity.hh:30
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
void globalRefine(int refCount)
uses the interface, mark on entity and refineLocal
Definition: albertagrid.cc:302
Definition: albertagrid/gridfamily.hh:81