From 0f67dc6f7f3c76f6b38f0f3a0b02c28aff4223df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= Date: Tue, 26 Jan 2016 07:32:10 +0100 Subject: [PATCH] [cleanup] Remove entity pointers --- adaptiveintegration.cc | 4 ++-- evolve.hh | 10 +++++----- finitevolumeadapt.hh | 13 ++++--------- parevolve.hh | 12 ++++++------ 4 files changed, 17 insertions(+), 22 deletions(-) diff --git a/adaptiveintegration.cc b/adaptiveintegration.cc index 6abc2f6..f4e6212 100644 --- a/adaptiveintegration.cc +++ b/adaptiveintegration.cc @@ -78,8 +78,8 @@ void adaptiveintegration (Grid& grid, const Functor& f) maxerror = std::max(maxerror,error); // error on father entity - double fatherlowresult=integrateEntity(*(it->father()),f,loworder); - double fatherhighresult=integrateEntity(*(it->father()),f,highorder); + double fatherlowresult=integrateEntity(it->father(),f,loworder); + double fatherhighresult=integrateEntity(it->father(),f,highorder); double fathererror = std::abs(fatherlowresult-fatherhighresult); // local extrapolation diff --git a/evolve.hh b/evolve.hh index 07586d4..3ffb271 100644 --- a/evolve.hh +++ b/evolve.hh @@ -29,8 +29,8 @@ void evolve (const G& grid, const M& mapper, V& c, double t, double& dt) // intersection geometry typedef typename IntersectionIterator::Intersection::Geometry IntersectionGeometry; - // entity pointer type - typedef typename G::template Codim<0>::EntityPointer EntityPointer; + // entity type + typedef typename G::template Codim<0>::Entity Entity; // get grid view on leaf part GridView gridView = grid.leafGridView(); @@ -87,14 +87,14 @@ void evolve (const G& grid, const M& mapper, V& c, double t, double& dt) if (is->neighbor()) // "correct" version /*@\label{evh:neighbor}@*/ { // access neighbor - EntityPointer outside = is->outside(); - int indexj = mapper.index(*outside); + Entity outside = is->outside(); + int indexj = mapper.index(outside); // compute flux from one side only if (indexigeometry(); + const LeafGeometry nbgeo = outside.geometry(); double nbvolume = nbgeo.volume(); double nbfactor = velocity*integrationOuterNormal/nbvolume; diff --git a/finitevolumeadapt.hh b/finitevolumeadapt.hh index f62e8be..c17597f 100644 --- a/finitevolumeadapt.hh +++ b/finitevolumeadapt.hh @@ -34,7 +34,6 @@ bool finitevolumeadapt (G& grid, M& mapper, V& c, int lmin, int lmax, int k) // entity and entity pointer typedef typename G::template Codim<0>::Entity Entity; - typedef typename G::template Codim<0>::EntityPointer EntityPointer; // intersection iterator type typedef typename LeafGridView::IntersectionIterator LeafIntersectionIterator; @@ -64,8 +63,7 @@ bool finitevolumeadapt (G& grid, M& mapper, V& c, int lmin, int lmax, int k) continue; // access neighbor - const EntityPointer pOutside = intersection.outside(); - const Entity &outside = *pOutside; + const Entity &outside = intersection.outside(); int indexj = mapper.index(outside); // handle face from one side only @@ -98,8 +96,7 @@ bool finitevolumeadapt (G& grid, M& mapper, V& c, int lmin, int lmax, int k) if( !intersection.neighbor() ) continue; - const EntityPointer pOutside = intersection.outside(); - const Entity &outside = *pOutside; + const Entity &outside = intersection.outside(); if( (outside.level() < lmax) || !outside.isRegular() ) grid.mark( 1, outside ); } @@ -138,8 +135,7 @@ bool finitevolumeadapt (G& grid, M& mapper, V& c, int lmin, int lmax, int k) // average in father if (it->level() > 0) { - EntityPointer ep = it->father(); - RestrictedValue& rvf = restrictionmap[*ep]; + RestrictedValue& rvf = restrictionmap[it->father()]; rvf.value += rv.value/rv.count; rvf.count += 1; } @@ -176,8 +172,7 @@ bool finitevolumeadapt (G& grid, M& mapper, V& c, int lmin, int lmax, int k) { // value is not in map, interpolate from father element assert (it->level() > 0); - EntityPointer ep = it->father(); - RestrictedValue& rvf = restrictionmap[*ep]; + RestrictedValue& rvf = restrictionmap[it->father()]; if (it->isLeaf()) { int indexi = mapper.index(*it); diff --git a/parevolve.hh b/parevolve.hh index ab4ca9e..124386e 100644 --- a/parevolve.hh +++ b/parevolve.hh @@ -40,8 +40,8 @@ void parevolve (const G& grid, const M& mapper, V& c, double t, double& dt) // intersection geometry typedef typename Intersection::Geometry IntersectionGeometry; - // entity pointer type - typedef typename G::template Codim<0>::EntityPointer EntityPointer; + // entity type + typedef typename G::template Codim<0>::Entity Entity; // allocate a temporary vector for the update V update(c.size()); @@ -100,18 +100,18 @@ void parevolve (const G& grid, const M& mapper, V& c, double t, double& dt) if( intersection.neighbor() ) { // access neighbor - EntityPointer outside = intersection.outside(); - int indexj = mapper.index(*outside); + Entity outside = intersection.outside(); + int indexj = mapper.index(outside); const int insideLevel = it->level(); - const int outsideLevel = outside->level(); + const int outsideLevel = outside.level(); // handle face from one side if( (insideLevel > outsideLevel) || ((insideLevel == outsideLevel) && (indexi < indexj)) ) { // compute factor in neighbor - const LeafGeometry nbgeo = outside->geometry(); + const LeafGeometry nbgeo = outside.geometry(); double nbvolume = nbgeo.volume(); double nbfactor = velocity*integrationOuterNormal/nbvolume;