Skip to content
This repository was archived by the owner on Jan 29, 2021. It is now read-only.

Commit

Permalink
[cleanup] Remove entity pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Grüninger committed Jan 26, 2016
1 parent 37bc369 commit 0f67dc6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 22 deletions.
4 changes: 2 additions & 2 deletions adaptiveintegration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions evolve.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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 (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;

Expand Down
13 changes: 4 additions & 9 deletions finitevolumeadapt.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 );
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions parevolve.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 0f67dc6

Please sign in to comment.