Dune Core Modules (2.5.0)

[ provides Dune::Grid ] More...

#include <dune/grid/albertagrid/agrid.hh>

Public Types

typedef AlbertaGridFamily< dim, dimworld > GridFamily
 the grid family of AlbertaGrid
 
typedef Traits::LeafIndexSet LeafIndexSet
 type of leaf index set
 
typedef Traits::LevelIndexSet LevelIndexSet
 type of level index sets
 
typedef Traits::HierarchicIndexSet HierarchicIndexSet
 type of hierarchic index set
 
typedef Traits::GlobalIdSet GlobalIdSet
 type of global id set
 
typedef Traits::LocalIdSet LocalIdSet
 type of local id set
 
typedef Traits::CollectiveCommunication CollectiveCommunication
 type of collective communication
 
Exported constants
enum  
 A constant that exports the template parameter dim.
 
enum  
 A constant that exports the template parameter dimworld.
 
Exported types
typedef GridFamily::Traits::LeafGridView LeafGridView
 type of view for leaf grid
 
typedef GridFamily::Traits::LevelGridView LevelGridView
 type of view for level grid
 
typedef GridFamily::Traits::LeafIntersection LeafIntersection
 A type that is a model of Dune::Intersection, an intersections of two codimension 1 of two codimension 0 entities in the leaf view.
 
typedef GridFamily::Traits::LevelIntersection LevelIntersection
 A type that is a model of Dune::Intersection, an intersections of two codimension 1 of two codimension 0 entities in a level view.
 
typedef GridFamily::Traits::LeafIntersectionIterator LeafIntersectionIterator
 A type that is a model of Dune::IntersectionIterator which is an iterator that allows to examine, but not to modify, the intersections of codimension 1 of an leaf element (entity of codimension 0) with other leaf elements.
 
typedef GridFamily::Traits::LevelIntersectionIterator LevelIntersectionIterator
 A type that is a model of Dune::IntersectionIterator which is an iterator that allows to examine, but not to modify, the intersections of codimension 1 of an element (entity of codimension 0) with other elements on the same level.
 
typedef GridFamily::Traits::HierarchicIterator HierarchicIterator
 A type that is a model of Dune::HierarchicIterator A type of iterator that allows to examine, but not to modify, entities of codimension 0 that result from refinement of an entity of codimension 0.
 

Public Member Functions

 AlbertaGrid ()
 create an empty grid
 
 AlbertaGrid (const Alberta::MacroData< dimension > &macroData, const std::shared_ptr< DuneBoundaryProjection< dimensionworld > > &projection=std::shared_ptr< DuneBoundaryProjection< dimensionworld > >())
 create a grid from an ALBERTA macro data structure More...
 
 AlbertaGrid (const std::string &macroGridFileName)
 create a grid from an ALBERTA macro grid file More...
 
 ~AlbertaGrid ()
 desctructor
 
int maxLevel () const
 
template<int cd, PartitionIteratorType pitype>
Traits::template Codim< cd >::template Partition< pitype >::LevelIterator lbegin (int level) const
 Iterator to first entity of given codim on level.
 
template<int cd, PartitionIteratorType pitype>
Traits::template Codim< cd >::template Partition< pitype >::LevelIterator lend (int level) const
 one past the end on this level
 
template<int codim>
Traits::template Codim< codim >::LevelIterator lbegin (int level) const
 Iterator to first entity of given codim on level.
 
template<int codim>
Traits::template Codim< codim >::LevelIterator lend (int level) const
 one past the end on this level
 
template<int codim, PartitionIteratorType pitype>
Traits::template Codim< codim >::template Partition< pitype >::LeafIterator leafbegin () const
 return LeafIterator which points to first leaf entity
 
template<int codim, PartitionIteratorType pitype>
Traits::template Codim< codim >::template Partition< pitype >::LeafIterator leafend () const
 return LeafIterator which points behind last leaf entity
 
template<int codim>
Traits::template Codim< codim >::LeafIterator leafbegin () const
 return LeafIterator which points to first leaf entity
 
template<int codim>
Traits::template Codim< codim >::LeafIterator leafend () const
 return LeafIterator which points behind last leaf entity
 
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.
 
int size (int level, GeometryType type) const
 number of entities per level and geometry type in this process
 
int size (int codim) const
 number of leaf entities per codim in this process
 
int size (GeometryType type) const
 number of leaf entities per geometry type in this process
 
std::size_t numBoundarySegments () const
 number of boundary segments within the macro grid
 
Traits::LevelGridView levelGridView (int level) const
 View for a grid level for All_Partition.
 
Traits::LeafGridView leafGridView () const
 View for the leaf grid for All_Partition.
 
int getMark (const typename Traits::template Codim< 0 >::Entity &e) const
 returns adaptation mark for given entity More...
 
bool mark (int refCount, const typename Traits::template Codim< 0 >::Entity &e)
 Marks an entity to be refined/coarsened in a subsequent adapt. More...
 
void globalRefine (int refCount)
 uses the interface, mark on entity and refineLocal
 
bool adapt ()
 Refine all positive marked leaf entities, coarsen all negative marked entities if possible. More...
 
template<class DataHandle >
bool adapt (AdaptDataHandleInterface< This, DataHandle > &handle)
 callback adapt method with AdaptDataHandleInterface
 
bool preAdapt ()
 returns true, if a least one element is marked for coarsening
 
void postAdapt ()
 clean up some markers
 
const CollectiveCommunicationcomm () const
 return reference to collective communication, if MPI found this is specialisation for MPI
 
template<class EntitySeed >
Traits::template Codim< EntitySeed::codimension >::Entity entity (const EntitySeed &seed) const
 obtain Entity from EntitySeed.
 
bool writeGrid (const std::string &filename, ctype time) const
 write Grid to file in Xdr
 
bool readGrid (const std::string &filename, ctype &time)
 read Grid from file filename and store time of mesh in time
 
const Traits::LevelIndexSetlevelIndexSet (int level) const
 return level index set for given level
 
const Traits::LeafIndexSetleafIndexSet () const
 return leaf index set
 
const GlobalIdSetglobalIdSet () const
 return global IdSet
 
const LocalIdSetlocalIdSet () const
 return local IdSet
 
bool readGridXdr (const std::string &filename, ctype &time)
 reads ALBERTA mesh file
 
bool mark (int refCount, const typename Traits ::template Codim< 0 >::Entity &e)
 Marks an entity to be refined/coarsened in a subsequent adapt. More...
 
int ghostSize (int level, int codim) const
 ghostSize is zero by default
 
int ghostSize (int codim) const
 ghostSize is zero by default
 
int overlapSize (int level, int codim) const
 overlapSize is zero by default
 
int overlapSize (int codim) const
 overlapSize is zero by default
 
void communicate (CommDataHandleIF< DataHandleImp, DataTypeImp > &data, InterfaceType iftype, CommunicationDirection dir, int level) const
 
void communicate (CommDataHandleIF< DataHandleImp, DataTypeImp > &data, InterfaceType iftype, CommunicationDirection dir) const
 
bool loadBalance ()
 default implementation of load balance does nothing and returns false
 
bool loadBalance (DataHandle &data)
 default implementation of load balance does nothing and returns false
 
Adaptivity and grid refinement
bool mark (int refCount, const typename Codim< 0 >::Entity &e)
 Marks an entity to be refined/coarsened in a subsequent adapt. More...
 
int getMark (const typename Codim< 0 >::Entity &e) const
 returns adaptation mark for given entity More...
 

Protected Member Functions

Parallel data distribution and communication
GridImp & asImp ()
 Barton-Nackman trick.
 
const GridImp & asImp () const
 Barton-Nackman trick.
 

Static Protected Member Functions

static std::conditional< std::is_reference< InterfaceType >::value, typenamestd::add_lvalue_reference< typenameReturnImplementationType< typenamestd::remove_reference< InterfaceType >::type >::ImplementationType >::type, typenamestd::remove_const< typenameReturnImplementationType< typenamestd::remove_reference< InterfaceType >::type >::ImplementationType >::type >::type getRealImplementation (InterfaceType &&i)
 return real implementation of interface class
 

Detailed Description

template<int dim, int dimworld = Alberta::dimWorld>
class Dune::AlbertaGrid< dim, dimworld >

[ provides Dune::Grid ]

simplicial grid imlementation from the ALBERTA finite element toolbox

AlbertaGrid provides access to the grid from the ALBERTA finite element toolbox through the Dune interface.

ALBERTA is a finite element toolbox written by Alfred Schmidt and Kunibert G. Siebert (see http://www.alberta-fem.de). It contains a simplicial mesh in 1, 2 and 3 space dimensions that can be dynamically adapted by a bisection algorithm.

Supported ALBERTA versions include 2.0 or higher. It can be downloaded from the ALBERTA website (www.alberta-fem.de). After installing ALBERTA, just configure DUNE with the –with-alberta option and provide the path to ALBERTA.

Each program linking to ALBERTA only supports a fixed dimension of world. This is obtained from the ALBERTA_DIM preprocessor variable, which defaults to WORLDDIM.

Further installation instructions can be found here: http://www.dune-project.org/external_libraries/install_alberta.html

If you use automake and want to compile a program maude, the following Makefile.am snippet might help:

bin_PROGRAMS = maude
ALBERTA_DIM = 2
maude_SOURCES = maude.cc
maude_CPPFLAGS = $(AM_CPPFLAGS) $(ALBERTA_CPPFLAGS)
maude_LDFLAGS = $(AM_LDFLAGS) $(ALBERTA_LDFLAGS) $(DUNE_LDFLAGS)
maude_LDADD = $(ALBERTA_LIBS) $(DUNE_LIBS)

This will compile and link your program with the world dimension specified by WORLDDIM. If you want to use different world dimensions per program, you can use the following snippet in your Makefile.am:

bin_PROGRAMS = maude2d maude3d
maude2d_SOURCES = maude.cc
maude2d_CPPFLAGS = $(AM_CPPFLAGS) $(ALBERTA2D_CPPFLAGS)
maude2d_LDFLAGS = $(AM_LDFLAGS) $(ALBERTA2D_LDFLAGS) $(DUNE_LDFLAGS)
maude2d_LDADD = $(ALBERTA2D_LIBS) $(DUNE_LIBS)
maude3d_SOURCES = maude.cc
maude3d_CPPFLAGS = $(AM_CPPFLAGS) $(ALBERTA3D_CPPFLAGS)
maude3d_LDFLAGS = $(AM_LDFLAGS) $(ALBERTA3D_LDFLAGS) $(DUNE_LDFLAGS)
maude3d_LDADD = $(ALBERTA3D_LIBS) $(DUNE_LIBS)

In either case the preprocessor variables HAVE_ALBERTA, which tells you whether ALBERTA was found by configure, and ALBERTA_DIM which tells you the dimension of world for this program.

For further details look into the alberta.m4 autoconf snippet.

Constructor & Destructor Documentation

◆ AlbertaGrid() [1/2]

template<int dim, int dimworld>
Dune::AlbertaGrid< dim, dimworld >::AlbertaGrid ( const Alberta::MacroData< dimension > &  macroData,
const std::shared_ptr< DuneBoundaryProjection< dimensionworld > > &  projection = std::shared_ptr< DuneBoundaryProjection< dimensionworld > >() 
)
inline

create a grid from an ALBERTA macro data structure

Parameters
[in]macroDatamacro data to create grid from
[in]projectionshared pointer to a global boundary projection (defaults to 0)

References DUNE_THROW.

◆ AlbertaGrid() [2/2]

template<int dim, int dimworld>
Dune::AlbertaGrid< dim, dimworld >::AlbertaGrid ( const std::string &  macroGridFileName)
inline

create a grid from an ALBERTA macro grid file

Parameters
[in]macroGridFileNamename of the macro grid file

References DUNE_THROW.

Member Function Documentation

◆ adapt()

template<int dim, int dimworld>
bool Dune::AlbertaGrid< dim, dimworld >::adapt
inline

Refine all positive marked leaf entities, coarsen all negative marked entities if possible.

\return true if a least one entity was refined

The complete adaptation process works as follows:

- mark entities with the mark() method
- call preAdapt()
- if preAdapt() returned true: possibly save current solution
- call adapt()
- if adapt() returned true: possibly interpolate the (saved) solution
- call postAdapt()

◆ communicate() [1/2]

void Dune::GridDefaultImplementation< dim, dimworld, Alberta::Real , AlbertaGridFamily< dim, Alberta::dimWorld > >::communicate ( CommDataHandleIF< DataHandleImp, DataTypeImp > &  data,
InterfaceType  iftype,
CommunicationDirection  dir 
) const
inlineinherited

dummy communicate, doing nothing

◆ communicate() [2/2]

void Dune::GridDefaultImplementation< dim, dimworld, Alberta::Real , AlbertaGridFamily< dim, Alberta::dimWorld > >::communicate ( CommDataHandleIF< DataHandleImp, DataTypeImp > &  data,
InterfaceType  iftype,
CommunicationDirection  dir,
int  level 
) const
inlineinherited

dummy communicate, doing nothing

◆ getMark() [1/2]

int Dune::Grid< dim, dimworld, Alberta::Real , AlbertaGridFamily< dim, Alberta::dimWorld > >::getMark ( const typename Codim< 0 >::Entity &  e) const
inlineinherited

returns adaptation mark for given entity

Parameters
[in]eEntity for which adaptation mark should be determined
Returns
int adaptation mark currently set for given Entity e

◆ getMark() [2/2]

template<int dim, int dimworld>
int Dune::AlbertaGrid< dim, dimworld >::getMark ( const typename Traits::template Codim< 0 >::Entity &  e) const
inline

returns adaptation mark for given entity

Parameters
[in]eEntity for which adaptation mark should be determined
Returns
int adaptation mark currently set for given Entity e

References Dune::AlbertaGrid< dim, dimworld >::getMark().

Referenced by Dune::AlbertaGrid< dim, dimworld >::getMark().

◆ mark() [1/3]

bool Dune::Grid< dim, dimworld, Alberta::Real , AlbertaGridFamily< dim, Alberta::dimWorld > >::mark ( int  refCount,
const typename Codim< 0 >::Entity &  e 
)
inlineinherited

Marks an entity to be refined/coarsened in a subsequent adapt.

Parameters
[in]refCountNumber of subdivisions that should be applied. Negative value means coarsening.
[in]eEntity that should be marked
Returns
true if Entity was marked, false otherwise.

◆ mark() [2/3]

bool Dune::GridDefaultImplementation< dim, dimworld, Alberta::Real , AlbertaGridFamily< dim, Alberta::dimWorld > >::mark ( int  refCount,
const typename Traits ::template Codim< 0 >::Entity &  e 
)
inlineinherited

Marks an entity to be refined/coarsened in a subsequent adapt.

Parameters
[in]refCountNumber of subdivisions that should be applied. Negative value means coarsening.
[in]eEntity to Entity that should be refined
Returns
true if Entity was marked, false otherwise.
Note
  • default implementation is: return false; for grids with no adaptation.
  • for the grid programmer: this method is implemented as a template method, because the Entity type is not defined when the class is instantiated You won't need this trick in the implementation. In your implementation you should use it as
    bool mark( int refCount,
    typename Traits::template Codim<0>::Entity & e ).
    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
    Static tag representing a codimension.
    Definition: dimension.hh:22
    This template method will vanish due to the inheritance rules.

◆ mark() [3/3]

template<int dim, int dimworld>
bool Dune::AlbertaGrid< dim, dimworld >::mark ( int  refCount,
const typename Traits::template Codim< 0 >::Entity &  e 
)
inline

Marks an entity to be refined/coarsened in a subsequent adapt.

Parameters
[in]refCountNumber of subdivisions that should be applied. Negative value means coarsening.
[in]eEntity that should be marked
Returns
true if Entity was marked, false otherwise.

References Dune::AlbertaGrid< dim, dimworld >::mark().

Referenced by Dune::AlbertaGrid< dim, dimworld >::mark().

◆ maxLevel()

template<int dim, int dimworld>
int Dune::AlbertaGrid< dim, dimworld >::maxLevel
inline

Return maximum level defined in this grid. Levels are numbered 0 ... maxLevel with 0 the coarsest level.


The documentation for this class was generated from the following files:
  • dune/grid/albertagrid/agrid.hh
  • dune/grid/albertagrid/albertagrid.cc
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 23, 23:29, 2024)