Skip to content
Snippets Groups Projects
Commit 3d3efc30 authored by Christian Engwer's avatar Christian Engwer
Browse files

gridIndexType was GlobalIndex but GlobalIndex needs global_size which

is not part of the grid interface. Change the default, so that the
default runs on all grids.

[[Imported from SVN: r1162]]
parent c2bc8b65
No related branches found
No related tags found
No related merge requests found
......@@ -15,7 +15,7 @@ namespace Dune {
// forward declaration
template <class GridType,
class IndexSetImp = DefaultGridIndexSet<GridType> >
class IndexSetImp>
class DofManager;
// forward declaration
......@@ -337,7 +337,7 @@ namespace Dune {
created. The default value for the IndexSet is the DefaultIndexSet class
which is mostly a wrapper for the grid indices.
*/
template <class GridType, class IndexSetImp >
template <class GridType, class IndexSetImp = DefaultGridIndexSet<GridType> >
class DofManager
{
public:
......
......@@ -135,31 +135,51 @@ namespace Dune {
};
//! Default is the Identity
template <class GridType, GridIndexType GridIndex = GlobalIndex>
template <class GridType, GridIndexType GridIndex = LevelIndex>
class DefaultGridIndexSet : public DefaultGridIndexSetBase <GridType>
{
// my type, to be revised
enum { myType = 0 };
enum { myType = 1 };
//! return global number of sub entity with local number 'num'
//! and codim of the sub entity = codim
//! the enCodim is needed because the method index and subIndex have
//! different names, ;)
//! the wrapper classes allow partial specialisation,
//! which is not allowed, but needed badly, :) the bob-trick
//
//! default implementation returns index of given entity
template <class EntityType,int enCodim, int codim>
struct IndexWrapper
{
static inline int index (EntityType & en , int num )
{
return en.global_index();
return en.index();
}
};
// if codim and enCodim are equal, then return index
template <class EntityType, int codim>
struct IndexWrapper<EntityType,codim,codim>
{
static inline int index (EntityType & en , int num )
{
return en.global_index();
return en.index();
}
};
//! if codim > codim of entity use subIndex
// return number of vertex num
template <class EntityType>
struct IndexWrapper<EntityType,0,3>
{
static inline int index (EntityType & en , int num )
{
return en.template subIndex<3> (num);
}
};
// return number of vertex num for dim == 2
// return number of edge num for dim == 3
template <class EntityType>
struct IndexWrapper<EntityType,0,2>
{
......@@ -169,12 +189,15 @@ namespace Dune {
}
};
// return number of vertex for dim == 1
// return number of edge num for dim == 2
// return number of face num for dim == 3
template <class EntityType>
struct IndexWrapper<EntityType,0,3>
struct IndexWrapper<EntityType,0,1>
{
static inline int index (EntityType & en , int num )
{
return en.template subIndex<3> (num);
return en.template subIndex<1> (num);
}
};
......@@ -182,11 +205,15 @@ namespace Dune {
enum { ncodim = GridType::dimension + 1 };
DefaultGridIndexSet ( GridType & grid ) : DefaultGridIndexSetBase <GridType> (grid) {}
//! return size of grid entities per level and codim
int size ( int level , int codim ) const
{
return this->grid_.global_size(codim);
return this->grid_.size(level,codim);
}
//! return index of entity with codim codim belonging to entity en which
//! could have a bigger codim (for example return num of vertex num of an
//! element en
template <int codim, class EntityType>
int index (EntityType & en, int num) const
{
......@@ -195,51 +222,31 @@ namespace Dune {
};
template <class GridType>
class DefaultGridIndexSet<GridType,LevelIndex>
class DefaultGridIndexSet<GridType,GlobalIndex>
: public DefaultGridIndexSetBase <GridType>
{
// my type, to be revised
enum { myType = 1 };
enum { myType = 0 };
//! return global number of sub entity with local number 'num'
//! and codim of the sub entity = codim
//! the enCodim is needed because the method index and subIndex have
//! different names, ;)
//! the wrapper classes allow partial specialisation,
//! which is not allowed, but needed badly, :) the bob-trick
//
//! default implementation returns index of given entity
template <class EntityType,int enCodim, int codim>
struct IndexWrapper
{
static inline int index (EntityType & en , int num )
{
return en.index();
return en.global_index();
}
};
// if codim and enCodim are equal, then return index
template <class EntityType, int codim>
struct IndexWrapper<EntityType,codim,codim>
{
static inline int index (EntityType & en , int num )
{
return en.index();
}
};
// return number of vertex num
template <class EntityType>
struct IndexWrapper<EntityType,0,3>
{
static inline int index (EntityType & en , int num )
{
return en.template subIndex<3> (num);
return en.global_index();
}
};
// return number of vertex num for dim == 2
// return number of edge num for dim == 3
//! if codim > codim of entity use subIndex
template <class EntityType>
struct IndexWrapper<EntityType,0,2>
{
......@@ -249,15 +256,12 @@ namespace Dune {
}
};
// return number of vertex for dim == 1
// return number of edge num for dim == 2
// return number of face num for dim == 3
template <class EntityType>
struct IndexWrapper<EntityType,0,1>
struct IndexWrapper<EntityType,0,3>
{
static inline int index (EntityType & en , int num )
{
return en.template subIndex<1> (num);
return en.template subIndex<3> (num);
}
};
......@@ -265,15 +269,11 @@ namespace Dune {
enum { ncodim = GridType::dimension + 1 };
DefaultGridIndexSet ( GridType & grid ) : DefaultGridIndexSetBase <GridType> (grid) {}
//! return size of grid entities per level and codim
int size ( int level , int codim ) const
{
return this->grid_.size(level,codim);
return this->grid_.global_size(codim);
}
//! return index of entity with codim codim belonging to entity en which
//! could have a bigger codim (for example return num of vertex num of an
//! element en
template <int codim, class EntityType>
int index (EntityType & en, int num) const
{
......
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