Skip to content
Snippets Groups Projects
Commit 51a050a5 authored by Robert Klöfkorn's avatar Robert Klöfkorn
Browse files

now levelIndexSet is used to prived the Level Index of the AlbertaGrid.

Furthermore a const version of the getRealEntity method added.

[[Imported from SVN: r1608]]
parent 8c8b9cf2
No related branches found
No related tags found
No related merge requests found
......@@ -320,10 +320,6 @@ namespace Dune
friend class AlbertaGridEntity<codim, dim, GridImp>;
public:
//AlbertaGridMakeableEntity(const GridImp & grid, int level,
// ALBERTA TRAVERSE_STACK * travStack) :
// EntityType (AlbertaGridEntity<codim, dim, GridImp>(grid,level,travStack)) {}
AlbertaGridMakeableEntity(const GridImp & grid, int level) :
GridImp::template codim<codim>::Entity (AlbertaGridEntity<codim, dim, GridImp>(grid,level)) {}
......@@ -357,7 +353,6 @@ namespace Dune
{
return 0;
}
};
//**********************************************************************
......@@ -382,7 +377,6 @@ namespace Dune
//friend class AlbertaGridLevelIterator < dim, dim, dimworld>;
friend class AlbertaGridMakeableEntity<codim,dim,GridImp>;
public:
typedef typename GridImp::template codim<codim>::Entity Entity;
typedef typename GridImp::template codim<codim>::Geometry Geometry;
typedef AlbertaGridMakeableGeometry<codim,dimworld,GridImp> GeometryImp;
......@@ -422,6 +416,7 @@ namespace Dune
// private Methods
void makeDescription();
// the grid this entity belong to
const GridImp &grid_;
// private Members
......@@ -486,6 +481,7 @@ namespace Dune
{
typedef typename GridImp::template codim<cd>::EntityPointer EntityPointer;
};
typedef AlbertaGridMakeableEntity<0,GridImp::dimension,GridImp> EntityImp;
typedef typename GridImp::template codim<0>::Entity Entity;
typedef typename GridImp::template codim<0>::Geometry Geometry;
......@@ -1066,12 +1062,11 @@ namespace Dune
class AlbertaGrid
: public GridDefault <dim,dimworld,albertCtype, AlbertaGrid<dim,dimworld> >
{
friend class AlbertaGridEntity <0,dim,AlbertaGrid<dim,dimworld> >;
friend class AlbertaGridEntity <0,dim,const AlbertaGrid<dim,dimworld> >;
//friend class AlbertaGridEntity <1,dim,dimworld>;
//friend class AlbertaGridEntity <1 << dim-1 ,dim,dimworld>;
friend class AlbertaGridEntity <dim,dim,AlbertaGrid<dim,dimworld> >;
friend class AlbertaGridEntity <dim,dim,const AlbertaGrid<dim,dimworld> >;
friend class AlbertaMarkerVector;
// friends because of fillElInfo
friend class AlbertaGridLevelIterator<0,All_Partition,AlbertaGrid<dim,dimworld> >;
......@@ -1087,6 +1082,8 @@ namespace Dune
//CompileTimeChecker<dimworld != 1> Do_not_use_AlbertaGrid_for_1d_Grids;
typedef AlbertaGrid<dim,dimworld> MyType;
friend class AlbertaMarkerVector;
//**********************************************************
// The Interface Methods
//**********************************************************
......@@ -1099,7 +1096,7 @@ namespace Dune
typedef AlbertaGridReferenceGeometry<dim,AlbertaGrid<dim,dimworld> > ReferenceGeometry;
typedef AlbertaGridHierarchicIndexSet<dim,dimworld> HierarchicIndexSetType;
typedef DefaultLevelIndexSet< AlbertaGrid<dim,dimworld> > LevelIndexSetType;
typedef DefaultLevelIndexSet<AlbertaGrid<dim,dimworld> > LevelIndexSetType;
typedef ObjectStream ObjectStreamType;
......@@ -1229,38 +1226,22 @@ namespace Dune
return *levelIndexSet_;
}
//private:
//! access to mesh pointer, needed by some methods
ALBERTA MESH* getMesh () const { return mesh_; };
template<int cd>
AlbertaGridEntity<cd,dim,const AlbertaGrid<dim,dimworld> >&
getRealEntity(typename Traits::template codim<cd>::Entity& e )
{
return e.realEntity;
}
template<int cd>
const AlbertaGridEntity<cd,dim,const AlbertaGrid<dim,dimworld> >&
getRealEntity(const typename Traits::template codim<cd>::Entity& e )
{
return e.realEntity;
}
template<int codim>
AlbertaGridEntity<codim,dim,const AlbertaGrid<dim,dimworld> >&
getRealEntity(AlbertaGridEntity<codim,dim,const AlbertaGrid<dim,dimworld> > & e )
template <int cd>
AlbertaGridEntity<cd,dim,const AlbertaGrid<dim,dimworld> >& getRealEntity(typename Traits::template codim<cd>::Entity& entity)
{
return e;
return entity.realEntity;
}
template<int codim>
const AlbertaGridEntity<codim,dim,const AlbertaGrid<dim,dimworld> >&
getRealEntity(const AlbertaGridEntity<codim,dim,const AlbertaGrid<dim,dimworld> > & e ) const
template <int cd>
const AlbertaGridEntity<cd,dim,const AlbertaGrid<dim,dimworld> >& getRealEntity(const typename Traits::template codim<cd>::Entity& entity) const
{
return e;
return entity.realEntity;
}
private:
//! number of grid entities per level and codim, size is cached
template <int codim> int calcLevelSize (int level);
int calcLevelCodimSize (int level, int codim);
......@@ -1309,6 +1290,7 @@ namespace Dune
// help vector for setNewCoords
mutable Array<int> macroVertices_;
public:
// this method is new fill_elinfo from ALBERTA but here the neighbor
// relations are calced diffrent, on ervery level there are neighbor
// realtions ( in ALBERTA only on leaf level ), so we needed a new
......@@ -1331,19 +1313,15 @@ namespace Dune
// needed for VertexIterator, mark on which element a vertex is treated
AlbertaMarkerVector * vertexMarker_;
private:
//*********************************************************
// Methods for mapping the global Index to local on Level
// contains the index on level for each unique el->index of Albert
enum { AG_MAXLEVELS = 100 };
Array<int> levelIndex_[dim+1][AG_MAXLEVELS];
void makeNewSize(Array<int> &a, int newNumberOfEntries);
void markNew();
//! map the global index from the Albert Mesh to the local index on Level
template <int codim>
int indexOnLevel(int globalIndex, int level ) const ;
// pointer to the real number of elements or vertices
// i.e. points to mesh->n_hier_elements or mesh->n_vertices
int numberOfEntitys_[dim+1];
......@@ -1361,6 +1339,7 @@ namespace Dune
typedef AlbertaGridMakeableEntity<0,dim,const MyType> EntityImp;
typedef AlbertaGridMakeableGeometry<dim-1,dimworld,const MyType> GeometryImp;
public:
typedef MemoryProvider< EntityImp > EntityProvider;
typedef MemoryProvider< GeometryImp > IntersectionSelfProvider;
typedef MemoryProvider< GeometryImp > IntersectionNeighProvider;
......@@ -1369,6 +1348,7 @@ namespace Dune
mutable IntersectionSelfProvider interSelfProvider_;
mutable IntersectionNeighProvider interNeighProvider_;
private:
//*********************************************************************
// organisation of the global index
//*********************************************************************
......@@ -1389,6 +1369,7 @@ namespace Dune
// make some shortcuts
void arrangeDofVec();
public:
// return true if el is new
bool checkElNew ( ALBERTA EL * el ) const;
......@@ -1399,10 +1380,6 @@ namespace Dune
// organisation of the parallelisation
//********************************************************************
// pointer to vec with processor number for each element,
// access via setOwner and getOwner
int * ownerVec_;
// set owner of element, for partioning
bool setOwner ( ALBERTA EL * el , int proc );
......@@ -1412,6 +1389,11 @@ namespace Dune
// PartitionType (InteriorEntity , BorderEntity, GhostEntity )
PartitionType partitionType ( ALBERTA EL_INFO * elinfo) const;
private:
// pointer to vec with processor number for each element,
// access via setOwner and getOwner
int * ownerVec_;
// rank of my thread, i.e. number of my processor
const int myProc_;
......@@ -1441,54 +1423,19 @@ namespace Dune
friend class AlbertaGrid<dim,dimworld>;
public:
AlbertaGridHierarchicIndexSet( const GridType & grid , const int (& s)[numCodim])
AlbertaGridHierarchicIndexSet(const GridType & grid , const int (& s)[numCodim])
: grid_( grid ), size_(s) {}
//template <class EntityType>
template <int cd>
int index (const typename Dune::Entity<cd,dim,const GridType,AlbertaGridEntity> & ep) const
{
typedef typename codim<cd>::EntityType EntityType;
enum { cd = EntityType :: codimension };
typedef typename codim<cd> :: RealEntityType REnType;
const REnType & en = grid_.template getRealEntity<cd>(ep);
return getIndex(
en.getElInfo()->el,
en.vx(),
Int2Type<dim-cd>());
}
template <int cd>
int index (typename Dune::Entity<cd,dim,const GridType,AlbertaGridEntity> & ep) const
template <class EntityType>
int index (const EntityType & ep) const
{
typedef typename codim<cd>::EntityType EntityType;
enum { cd = EntityType :: codimension };
typedef typename codim<cd> :: RealEntityType REnType;
const REnType & en = grid_.template getRealEntity<cd>(ep);
return getIndex(
en.getElInfo()->el,
en.vx(),
Int2Type<dim-cd>());
return getIndex((grid_.template getRealEntity<cd>(ep)).getElInfo()->el
,0,Int2Type<dim-cd>());
}
/*
template <class EntityType>
int index (const EntityType & ep) const
{
enum { cd = EntityType :: codimension };
typedef typename codim<cd> :: RealEntityType REnType;
REnType & en = grid_.template getRealEntity<cd>(ep);
return getIndex(
en.getElInfo()->el,
en.vx(),
Int2Type<dim-cd>()
);
}
*/
template <int codim>
int subIndex (const EntityCodim0Type & en, int i)
int subIndex (const EntityCodim0Type & en, int i) const
{
return 0;
}
......@@ -1527,17 +1474,14 @@ namespace Dune
// see Albert Doc. , should stay the same
nv_ [cd] = elAdmin_->n0_dof [ALBERTA AlbertHelp::AlbertaDofType<cd>::type];
dof_[cd] = elAdmin_->mesh->node[ALBERTA AlbertHelp::AlbertaDofType<cd>::type];
std::cout << "nv = " << nv_[cd] << " dof = " << dof_[cd] << "\n";
}
// codim = 0 means we get from dim-cd = dim
int getIndex ( const ALBERTA EL * el, int i , Int2Type<dim> fake ) const
{
enum { codim = 0 };
enum { cd = 0 };
assert(el);
int idx = elNumVec_[0][ el->dof[dof_[codim]][nv_[codim]] ];
std::cout << "Returning " << idx << "\n";
int idx = elNumVec_[cd][ el->dof[dof_[cd]][nv_[cd]] ];
return idx;
}
......
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