From a1c3e2b355b4df6ea7064c9191d055cbbc651828 Mon Sep 17 00:00:00 2001 From: Peter Bastian <peter@dune-project.org> Date: Wed, 27 Apr 2005 07:56:19 +0000 Subject: [PATCH] added implementation of index methods [[Imported from SVN: r1955]] --- grid/sgrid/sgrid.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/grid/sgrid/sgrid.cc b/grid/sgrid/sgrid.cc index d60c5e878..20c2c3e0f 100644 --- a/grid/sgrid/sgrid.cc +++ b/grid/sgrid/sgrid.cc @@ -359,6 +359,28 @@ namespace Dune { return SUnitCubeMapper<dim>::mapper.elements(cc); } + // subentity compressed index + template<int dim, class GridImp> template<int cc> + inline int SEntity<0,dim,GridImp>::subCompressedIndex (int i) const + { + int cindex; + if(cc == 100) // the vertex case + { + // find expanded coordinates of entity in reference cube + // has components in {0,1,2} + // the grid hold the memory because its faster + FixedArray<int,dim>& zref = this->grid->zrefStatic; + FixedArray<int,dim>& zentity = this->grid->zentityStatic; + + zref = SUnitCubeMapper<dim>::mapper.z(i,dim); + for (int i=0; i<dim; i++) zentity[i] = this->z[i] + zref[i] - 1; + cindex = this->grid->n(this->l,zentity); + } + else + { + cindex = entity<cc>(i)->index(); + } + } template<int dim, class GridImp> template<int cc> inline typename SEntity<0,dim,GridImp>::template codim<cc>::EntityPointer SEntity<0,dim,GridImp>::entity (int i) const -- GitLab