Skip to content
Snippets Groups Projects
Commit 3b6335a8 authored by Oliver Sander's avatar Oliver Sander
Browse files

Merge branch 'remove-albertagridentitypointer' into 'master'

Remove AlbertaGridEntityPointer

Closes #57

See merge request !168
parents 648ded4c 6beb7611
No related branches found
No related tags found
1 merge request!168Remove AlbertaGridEntityPointer
Pipeline #
......@@ -37,7 +37,6 @@ set(HEADERS
undefine-3.0.hh
entity.hh
entity.cc
entitypointer.hh
entityseed.hh
hierarchiciterator.hh
algebra.hh
......
......@@ -50,7 +50,6 @@
#include "indexsets.hh"
#include "geometry.hh"
#include "entity.hh"
#include "entitypointer.hh"
#include "hierarchiciterator.hh"
#include "treeiterator.hh"
#include "leveliterator.hh"
......@@ -144,9 +143,9 @@ namespace Dune
Base;
template< int, int, class > friend class AlbertaGridEntity;
template< int, class > friend class AlbertaGridEntityPointer;
template< class > friend class AlbertaLevelGridView;
template< class > friend class AlbertaLeafGridView;
template< int, class, bool > friend class AlbertaGridTreeIterator;
friend class GridFactory< This >;
friend struct DGFGridFactory< This >;
......@@ -288,11 +287,10 @@ namespace Dune
typedef Alberta::HierarchyDofNumbering< dimension > DofNumbering;
typedef AlbertaGridLevelProvider< dimension > LevelProvider;
// forbid copying and assignment
AlbertaGrid ( const This & );
This &operator= ( const This & );
public:
AlbertaGrid ( const This & ) = delete;
This &operator= ( const This & ) = delete;
/** \brief create an empty grid */
AlbertaGrid ();
......@@ -537,9 +535,9 @@ namespace Dune
DUNE_DEPRECATED_MSG("Deprecated in Dune 3.0, use readGrid instead.")
readGridXdr ( const std::string &filename, ctype &time );
private:
using Base::getRealImplementation;
private:
typedef std::vector<int> ArrayType;
void setup ();
......
......@@ -17,9 +17,6 @@ namespace Dune
// Forward Declarations
// --------------------
template< int codim, class Grid >
class AlbertaGridEntityPointer;
template< int codim, class Grid, bool leafIterator >
class AlbertaGridTreeIterator;
......@@ -51,8 +48,8 @@ namespace Dune
friend class AlbertaGrid< dim, dimworld >;
friend class AlbertaGridEntity< 0, dim, Grid >;
friend class AlbertaGridHierarchicIterator< Grid >;
template< int, class, bool > friend class AlbertaGridTreeIterator;
friend class AlbertaGridEntityPointer< codim, Grid >;
public:
static const int dimension = dim;
......@@ -192,7 +189,6 @@ namespace Dune
friend class AlbertaGridLeafIntersection< Grid >;
friend class AlbertaGridHierarchicIterator< Grid >;
template< int, class, bool > friend class AlbertaGridTreeIterator;
friend class AlbertaGridEntityPointer< 0, Grid >;
public:
static const int dimension = dim;
......
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_ALBERTA_ENTITYPOINTER_HH
#define DUNE_ALBERTA_ENTITYPOINTER_HH
#include <dune/grid/albertagrid/elementinfo.hh>
#if HAVE_ALBERTA
namespace Dune
{
// External Forward Declarations
// -----------------------------
template< int dim, int dimworld >
class AlbertaGrid;
/** \class AlbertaGridEntityPointer
* \ingroup AlbertaGrid
* \brief EntityPointer implementation for AlbertaGrid
*/
template< int codim, class GridImp >
class AlbertaGridEntityPointer
{
typedef AlbertaGridEntityPointer< codim, GridImp > This;
friend class AlbertaGrid< GridImp::dimension, GridImp::dimensionworld >;
public:
static const int dimension = GridImp::dimension;
static const int codimension = codim;
static const int mydimension = dimension - codimension;
static const int dimensionworld = GridImp::dimensionworld;
typedef typename GridImp::template Codim< codimension >::Entity Entity;
protected:
typedef MakeableInterfaceObject< Entity > EntityObject;
typedef typename EntityObject::ImplementationType EntityImp;
public:
typedef AlbertaGridEntityPointer< codimension, GridImp > EntityPointerImp;
typedef typename EntityImp::ElementInfo ElementInfo;
AlbertaGridEntityPointer ();
//! make an EntityPointer that points to an element
AlbertaGridEntityPointer ( const GridImp &grid,
const ElementInfo &elementInfo,
int subEntity );
//! constructor for invalid EntityPointer
AlbertaGridEntityPointer ( const GridImp &grid );
//! make entity pointer from entity
AlbertaGridEntityPointer ( const EntityImp &entity );
#if 0
//! Destructor
~AlbertaGridEntityPointer();
#endif
//! equality
bool equals ( const This &other ) const;
//! dereferencing
Entity &dereference () const;
//! ask for level of entities
int level () const;
protected:
//! obtain reference to internal entity implementation
EntityImp &entityImp ();
//! obtain const reference to internal entity implementation
const EntityImp &entityImp () const;
//! obtain a reference to the grid
const GridImp &grid () const;
private:
mutable Entity entity_;
};
template< int codim, class GridImp >
inline AlbertaGridEntityPointer< codim, GridImp >
::AlbertaGridEntityPointer ()
{}
template< int codim, class GridImp >
inline AlbertaGridEntityPointer< codim, GridImp >
::AlbertaGridEntityPointer ( const GridImp &grid,
const ElementInfo &elementInfo,
int subEntity )
: entity_( EntityImp( grid, elementInfo, subEntity ) )
{}
template<int codim, class GridImp >
inline AlbertaGridEntityPointer< codim, GridImp >
::AlbertaGridEntityPointer ( const GridImp &grid )
: entity_( EntityImp( grid ) )
{}
template< int codim, class GridImp >
inline AlbertaGridEntityPointer< codim, GridImp >
::AlbertaGridEntityPointer ( const EntityImp &entity )
: entity_( entity )
{}
#if 0
template<int codim, class GridImp >
inline AlbertaGridEntityPointer< codim, GridImp >::~AlbertaGridEntityPointer ()
{}
#endif
template<int codim, class GridImp >
inline bool
AlbertaGridEntityPointer< codim, GridImp >::equals ( const This &other ) const
{
return entityImp().equals( other.entityImp() );
}
template<int codim, class GridImp >
inline typename AlbertaGridEntityPointer< codim, GridImp >::Entity &
AlbertaGridEntityPointer< codim, GridImp >::dereference () const
{
return entity_;
}
template< int codim, class GridImp >
inline int AlbertaGridEntityPointer< codim, GridImp >::level () const
{
return entityImp().level();
}
template< int codim, class GridImp >
inline typename AlbertaGridEntityPointer< codim, GridImp >::EntityImp &
AlbertaGridEntityPointer< codim, GridImp >::entityImp ()
{
return GridImp::getRealImplementation( entity_ );
}
template< int codim, class GridImp >
inline const typename AlbertaGridEntityPointer< codim, GridImp >::EntityImp &
AlbertaGridEntityPointer< codim, GridImp >::entityImp () const
{
return GridImp::getRealImplementation( entity_ );
}
template< int codim, class GridImp >
inline const GridImp &AlbertaGridEntityPointer< codim, GridImp >::grid () const
{
return entityImp().grid();
}
}
#endif // #if HAVE_ALBERTA
#endif // #ifndef DUNE_ALBERTA_ENTITYPOINTER_HH
......@@ -3,10 +3,9 @@
#ifndef DUNE_ALBERTA_HIERARCHICITERATOR_HH
#define DUNE_ALBERTA_HIERARCHICITERATOR_HH
#include <dune/grid/albertagrid/elementinfo.hh>
#include <dune/grid/common/entityiterator.hh>
#include <dune/grid/albertagrid/entitypointer.hh>
#if HAVE_ALBERTA
namespace Dune
......@@ -25,10 +24,8 @@ namespace Dune
*/
template< class GridImp >
class AlbertaGridHierarchicIterator
: public AlbertaGridEntityPointer< 0, GridImp >
{
typedef AlbertaGridHierarchicIterator< GridImp > This;
typedef AlbertaGridEntityPointer< 0, GridImp > Base;
public:
typedef typename GridImp::template Codim<0>::Entity Entity;
......@@ -37,7 +34,7 @@ namespace Dune
typedef MakeableInterfaceObject< Entity > EntityObject;
typedef typename EntityObject::ImplementationType EntityImp;
typedef typename Base::ElementInfo ElementInfo;
typedef typename EntityImp::ElementInfo ElementInfo;
AlbertaGridHierarchicIterator ()
{}
......@@ -59,14 +56,48 @@ namespace Dune
//! increment
void increment();
using Base::level;
//! equality
bool equals ( const This &other ) const
{
return entityImp().equals( other.entityImp() );
}
//! dereferencing
Entity &dereference () const
{
return entity_;
}
//! ask for level of entities
int level () const
{
return entityImp().level();
}
protected:
using Base::entityImp;
//! obtain reference to internal entity implementation
EntityImp &entityImp ()
{
return GridImp::getRealImplementation( entity_ );
}
//! obtain const reference to internal entity implementation
const EntityImp &entityImp () const
{
return GridImp::getRealImplementation( entity_ );
}
//! obtain a reference to the grid
const GridImp &grid () const
{
return entityImp().grid();
}
private:
void increment ( ElementInfo elementInfo );
mutable Entity entity_;
// level on which the iterator was started
int startLevel_;
......@@ -78,7 +109,7 @@ namespace Dune
template< class GridImp >
inline AlbertaGridHierarchicIterator< GridImp >
::AlbertaGridHierarchicIterator( const GridImp &grid, int actLevel, int maxLevel )
: Base( grid ),
: entity_( EntityImp( grid ) ),
startLevel_( actLevel ),
maxlevel_( maxLevel )
{}
......@@ -89,7 +120,7 @@ namespace Dune
::AlbertaGridHierarchicIterator ( const GridImp &grid,
const ElementInfo &elementInfo,
int maxLevel )
: Base( grid ),
: entity_( EntityImp( grid ) ),
startLevel_( elementInfo.level() ),
maxlevel_( maxLevel )
{
......@@ -100,7 +131,7 @@ namespace Dune
template< class GridImp >
inline AlbertaGridHierarchicIterator< GridImp >
::AlbertaGridHierarchicIterator( const This &other )
: Base( other ),
: entity_( other.entity_ ),
startLevel_( other.startLevel_ ),
maxlevel_( other.maxlevel_ )
{}
......@@ -110,8 +141,7 @@ namespace Dune
inline typename AlbertaGridHierarchicIterator< GridImp >::This &
AlbertaGridHierarchicIterator< GridImp >::operator= ( const This &other )
{
Base::operator=( other );
entity_ = other.entity_;
startLevel_ = other.startLevel_;
maxlevel_ = other.maxlevel_;
return *this;
......
......@@ -8,8 +8,8 @@
#include <dune/common/std/utility.hh>
#include <dune/common/typetraits.hh>
#include <dune/grid/albertagrid/elementinfo.hh>
#include <dune/grid/albertagrid/meshpointer.hh>
#include <dune/grid/albertagrid/entitypointer.hh>
#if HAVE_ALBERTA
......@@ -181,10 +181,8 @@ namespace Dune
*/
template< int codim, class GridImp, bool leafIterator >
class AlbertaGridTreeIterator
: public AlbertaGridEntityPointer< codim, GridImp >
{
typedef AlbertaGridTreeIterator< codim, GridImp, leafIterator > This;
typedef AlbertaGridEntityPointer< codim, GridImp > Base;
public:
static const int dimension = GridImp::dimension;
......@@ -198,13 +196,13 @@ namespace Dune
= Alberta::NumSubEntities< dimension, codimension >::value;
public:
typedef typename Base::ElementInfo ElementInfo;
typedef Alberta::MeshPointer< dimension > MeshPointer;
typedef typename MeshPointer::MacroIterator MacroIterator;
typedef typename GridImp::template Codim< codim >::Entity Entity;
typedef MakeableInterfaceObject< Entity > EntityObject;
typedef typename EntityObject::ImplementationType EntityImp;
typedef typename EntityImp::ElementInfo ElementInfo;
typedef AlbertaMarkerVector< dimension, dimensionworld > MarkerVector;
......@@ -224,12 +222,45 @@ namespace Dune
const MarkerVector *marker,
int travLevel );
//! equality
bool equals ( const This &other ) const
{
return entityImp().equals( other.entityImp() );
}
//! dereferencing
Entity &dereference () const
{
return entity_;
}
//! ask for level of entities
int level () const
{
return entityImp().level();
}
//! increment
void increment();
protected:
using Base::entityImp;
using Base::grid;
//! obtain reference to internal entity implementation
EntityImp &entityImp ()
{
return GridImp::getRealImplementation( entity_ );
}
//! obtain const reference to internal entity implementation
const EntityImp &entityImp () const
{
return GridImp::getRealImplementation( entity_ );
}
//! obtain a reference to the grid
const GridImp &grid () const
{
return entityImp().grid();
}
private:
void nextElement ( ElementInfo &elementInfo );
......@@ -245,6 +276,8 @@ namespace Dune
void goNext ( const std::integral_constant< int, cd > cdVariable,
ElementInfo &elementInfo );
mutable Entity entity_;
//! current level
int level_;
......@@ -314,7 +347,7 @@ namespace Dune
template< int codim, class GridImp, bool leafIterator >
inline AlbertaGridTreeIterator< codim, GridImp, leafIterator >
::AlbertaGridTreeIterator ()
: Base(),
: entity_(),
level_( -1 ),
subEntity_( -1 ),
macroIterator_(),
......@@ -326,7 +359,7 @@ namespace Dune
::AlbertaGridTreeIterator ( const GridImp &grid,
const MarkerVector *marker,
int travLevel )
: Base( grid ),
: entity_( EntityImp( grid ) ),
level_( travLevel ),
subEntity_( (codim == 0 ? 0 : -1) ),
macroIterator_( grid.meshPointer().begin() ),
......@@ -346,7 +379,7 @@ namespace Dune
inline AlbertaGridTreeIterator< codim, GridImp, leafIterator >
::AlbertaGridTreeIterator ( const GridImp &grid,
int travLevel )
: Base( grid ),
: entity_( EntityImp( grid ) ),
level_( travLevel ),
subEntity_( -1 ),
macroIterator_( grid.meshPointer().end() ),
......@@ -358,7 +391,7 @@ namespace Dune
template< int codim, class GridImp, bool leafIterator >
inline AlbertaGridTreeIterator< codim, GridImp, leafIterator >
::AlbertaGridTreeIterator( const This &other )
: Base( other ),
: entity_( other.entity_ ),
level_( other.level_ ),
subEntity_( other.subEntity_ ),
macroIterator_( other.macroIterator_ ),
......@@ -371,8 +404,7 @@ namespace Dune
inline typename AlbertaGridTreeIterator< codim, GridImp, leafIterator >::This &
AlbertaGridTreeIterator< codim, GridImp, leafIterator >::operator= ( const This &other )
{
Base::operator=( other );
entity_ = other.entity_;
level_ = other.level_;
subEntity_ = other.subEntity_;
macroIterator_ = other.macroIterator_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment