Commit 7ea708ad authored by Dennis Gläser's avatar Dennis Gläser
Browse files

[box][fvgeom] avoid storing element pointer

parent 9f8b4305
......@@ -26,6 +26,7 @@
#ifndef DUMUX_DISCRETIZATION_BOX_FV_ELEMENT_GEOMETRY_HH
#define DUMUX_DISCRETIZATION_BOX_FV_ELEMENT_GEOMETRY_HH
#include <dune/geometry/type.hh>
#include <dune/geometry/referenceelements.hh>
#include <dune/localfunctions/lagrange/pqkfactory.hh>
......@@ -114,7 +115,7 @@ public:
//! Get a local finite element basis
const FeLocalBasis& feLocalBasis() const
{
return fvGridGeometry().feCache().get(elementPtr_->geometry().type()).localBasis();
return fvGridGeometry().feCache().get(elemGeometryType_).localBasis();
}
//! The total number of sub control volumes
......@@ -142,7 +143,7 @@ public:
//! For compatibility reasons with the FVGeometry cache being disabled
void bindElement(const Element& element)
{
elementPtr_ = &element;
elemGeometryType_ = element.geometry().type();
eIdx_ = fvGridGeometry().elementMapper().index(element);
}
......@@ -155,7 +156,7 @@ public:
{ return fvGridGeometry().hasBoundaryScvf(eIdx_); }
private:
const Element* elementPtr_;
Dune::GeometryType elemGeometryType_;
const FVGridGeometry* fvGridGeometryPtr_;
GridIndexType eIdx_;
......@@ -231,7 +232,7 @@ public:
//! Get a local finite element basis
const FeLocalBasis& feLocalBasis() const
{
return fvGridGeometry().feCache().get(elementPtr_->geometry().type()).localBasis();
return fvGridGeometry().feCache().get(elemGeometryType_).localBasis();
}
//! The total number of sub control volumes
......@@ -259,7 +260,6 @@ public:
//! For compatibility reasons with the FVGeometry cache being disabled
void bindElement(const Element& element)
{
elementPtr_ = &element;
eIdx_ = fvGridGeometry().elementMapper().index(element);
makeElementGeometries(element);
}
......@@ -280,7 +280,8 @@ private:
// get the element geometry
auto elementGeometry = element.geometry();
const auto referenceElement = ReferenceElements::general(elementGeometry.type());
elemGeometryType_ = elementGeometry.type();
const auto referenceElement = ReferenceElements::general(elemGeometryType_);
// get the sub control volume geometries of this element
GeometryHelper geometryHelper(elementGeometry);
......@@ -348,7 +349,7 @@ private:
}
//! The bound element
const Element* elementPtr_;
Dune::GeometryType elemGeometryType_;
GridIndexType eIdx_;
//! The global geometry this is a restriction of
......
......@@ -26,6 +26,7 @@
#include <algorithm>
#include <dune/geometry/type.hh>
#include <dune/geometry/referenceelements.hh>
#include <dumux/common/indextraits.hh>
......@@ -110,7 +111,7 @@ public:
//! Get a local finite element basis
const FeLocalBasis& feLocalBasis() const
{ return fvGridGeometry().feCache().get(elementPtr_->geometry().type()).localBasis(); }
{ return fvGridGeometry().feCache().get(elemGeometryType_).localBasis(); }
//! The total number of sub control volumes
std::size_t numScv() const
......@@ -133,7 +134,7 @@ public:
//! For compatibility reasons with the FVGeometry cache being disabled
void bindElement(const Element& element)
{
elementPtr_ = &element;
elemGeometryType_ = element.geometry().type();
eIdx_ = fvGridGeometry().elementMapper().index(element);
}
......@@ -142,7 +143,7 @@ public:
{ return *fvGridGeometryPtr_; }
private:
const Element* elementPtr_;
Dune::GeometryType elemGeometryType_;
const FVGridGeometry* fvGridGeometryPtr_;
GridIndexType eIdx_;
......@@ -216,7 +217,7 @@ public:
//! Get a local finite element basis
const FeLocalBasis& feLocalBasis() const
{ return fvGridGeometry().feCache().get(elementPtr_->geometry().type()).localBasis(); }
{ return fvGridGeometry().feCache().get(elemGeometryType_).localBasis(); }
//! The total number of sub control volumes
std::size_t numScv() const
......@@ -239,7 +240,6 @@ public:
//! For compatibility reasons with the FVGeometry cache being disabled
void bindElement(const Element& element)
{
elementPtr_ = &element;
eIdx_ = fvGridGeometry().elementMapper().index(element);
makeElementGeometries(element);
}
......@@ -256,7 +256,8 @@ private:
// get the element geometry
auto elementGeometry = element.geometry();
const auto referenceElement = ReferenceElements::general(elementGeometry.type());
elemGeometryType_ = elementGeometry.type();
const auto referenceElement = ReferenceElements::general(elemGeometryType_);
// get the sub control volume geometries of this element
GeometryHelper geometryHelper(elementGeometry);
......@@ -339,7 +340,7 @@ private:
}
//! The bound element
const Element* elementPtr_;
Dune::GeometryType elemGeometryType_;
GridIndexType eIdx_;
//! The global geometry this is a restriction of
......
......@@ -30,6 +30,7 @@
#define DUMUX_POROUSMEDIUMFLOW_BOXDFM_FV_ELEMENT_GEOMETRY_HH
#include <dune/common/version.hh>
#include <dune/geometry/type.hh>
#include <dune/geometry/referenceelements.hh>
#include <dune/localfunctions/lagrange/pqkfactory.hh>
......@@ -119,7 +120,7 @@ public:
//! Get a local finite element basis
const FeLocalBasis& feLocalBasis() const
{ return fvGridGeometry().feCache().get(elementPtr_->geometry().type()).localBasis(); }
{ return fvGridGeometry().feCache().get(elemGeometryType_).localBasis(); }
//! The total number of sub control volumes
std::size_t numScv() const
......@@ -144,7 +145,7 @@ public:
*/
void bindElement(const Element& element)
{
elementPtr_ = &element;
elemGeometryType_ = element.geometry().type();
eIdx_ = fvGridGeometry().elementMapper().index(element);
}
......@@ -153,7 +154,7 @@ public:
{ return *fvGridGeometryPtr_; }
private:
const Element* elementPtr_;
Dune::GeometryType elemGeometryType_;
const FVGridGeometry* fvGridGeometryPtr_;
GridIndexType eIdx_;
};
......@@ -232,7 +233,7 @@ public:
//! Get a local finite element basis
const FeLocalBasis& feLocalBasis() const
{ return fvGridGeometry().feCache().get(elementPtr_->geometry().type()).localBasis(); }
{ return fvGridGeometry().feCache().get(elemGeometryType_).localBasis(); }
//! The total number of sub control volumes
std::size_t numScv() const
......@@ -257,7 +258,6 @@ public:
*/
void bindElement(const Element& element)
{
elementPtr_ = &element;
eIdx_ = fvGridGeometry().elementMapper().index(element);
makeElementGeometries(element);
}
......@@ -274,11 +274,8 @@ private:
// get the element geometry
auto elementGeometry = element.geometry();
#if DUNE_VERSION_NEWER(DUNE_COMMON,2,6)
const auto referenceElement = ReferenceElements::general(elementGeometry.type());
#else
const auto& referenceElement = ReferenceElements::general(elementGeometry.type());
#endif
elemGeometryType_ = elementGeometry.type();
const auto referenceElement = ReferenceElements::general(elemGeometryType_);
// get the sub control volume geometries of this element
GeometryHelper geometryHelper(elementGeometry);
......@@ -429,7 +426,7 @@ private:
}
//! The bound element
const Element* elementPtr_;
Dune::GeometryType elemGeometryType_;
GridIndexType eIdx_;
//! The global geometry this is a restriction of
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment