Commit eaf8714e authored by Christoph Grueninger's avatar Christoph Grueninger
Browse files

Use subEntities instead of deprecated count for Dune > 2.3

(reviewed by natalies)


git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@13328 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent bc6df8cd
......@@ -29,6 +29,7 @@
#include<dune/common/fvector.hh>
#include<dune/common/fmatrix.hh>
#include<dune/common/exceptions.hh>
#include<dune/common/version.hh>
#include<dune/geometry/type.hh>
#include<dune/grid/common/grid.hh>
#include<dune/grid/common/mcmgmapper.hh>
......@@ -135,7 +136,11 @@ public:
ElementIterator eEndIt = gridView_.template end<0>();
for (ElementIterator eIt = gridView_.template begin<0>(); eIt != eEndIt; ++eIt)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int numFaces = eIt->subEntities(1);
#else
int numFaces = eIt->template count<1>();
#endif
for (int i = 0; i < numFaces; i++)
{
......@@ -162,7 +167,11 @@ public:
// LOOP 2 : insert the nonzeros
for (ElementIterator eIt = gridView_.template begin<0>(); eIt!=eEndIt; ++eIt)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int numFaces = eIt->subEntities(1);
#else
int numFaces = eIt->template count<1>();
#endif
for (int i = 0; i < numFaces; i++)
{
......@@ -250,7 +259,11 @@ public:
ElementIterator eEndIt = gridView_.template end<0>();
for (ElementIterator eIt = gridView_.template begin<0>(); eIt!=eEndIt; ++eIt)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
unsigned int numFaces = eIt->subEntities(1);
#else
unsigned int numFaces = eIt->template count<1>();
#endif
// get local to global id map
for (unsigned int k = 0; k < numFaces; k++)
......@@ -287,7 +300,11 @@ public:
// run over all leaf elements
for (ElementIterator eIt = gridView_.template begin<0>(); eIt!=eEndIt; ++eIt)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
unsigned int numFaces = eIt->subEntities(1);
#else
unsigned int numFaces = eIt->template count<1>();
#endif
// get local to global id map
for (unsigned int k = 0; k < numFaces; k++)
......
......@@ -34,6 +34,7 @@
#include<sstream>
#include<dune/common/exceptions.hh>
#include<dune/common/version.hh>
#include<dune/grid/common/grid.hh>
#include<dune/geometry/type.hh>
#include<dune/geometry/quadraturerules.hh>
......@@ -181,7 +182,11 @@ public:
*/
void assemble(const Element& element, int k = 1)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
unsigned int numFaces = element.subEntities(1);
#else
unsigned int numFaces = element.template count<1>();
#endif
this->setcurrentsize(numFaces);
// clear assemble data
......@@ -217,7 +222,11 @@ public:
*/
void assembleBoundaryCondition(const Element& element, int k = 1)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
unsigned int numFaces = element.subEntities(1);
#else
unsigned int numFaces = element.template count<1>();
#endif
this->setcurrentsize(numFaces);
// clear assemble data
......@@ -234,7 +243,11 @@ public:
void completeRHS(const Element& element, Dune::FieldVector<int, 2*dim>& local2Global, Vector& f)
{
int globalIdx = problem_.variables().index(element);
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
unsigned int numFaces = element.subEntities(1);
#else
unsigned int numFaces = element.template count<1>();
#endif
Dune::FieldVector<Scalar, 2 * dim> F(0.);
Scalar dInv = 0.;
......@@ -401,7 +414,11 @@ private:
template<class TypeTag>
void MimeticTwoPLocalStiffness<TypeTag>::assembleV(const Element& element, int)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
unsigned int numFaces = element.subEntities(1);
#else
unsigned int numFaces = element.template count<1>();
#endif
this->setcurrentsize(numFaces);
int globalIdx = problem_.variables().index(element);
......@@ -453,7 +470,11 @@ void MimeticTwoPLocalStiffness<TypeTag>::assembleElementMatrices(const Element&
Scalar& dInv,
Scalar& qmean)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
unsigned int numFaces = element.subEntities(1);
#else
unsigned int numFaces = element.template count<1>();
#endif
this->setcurrentsize(numFaces);
// get global coordinate of cell center
......
......@@ -25,6 +25,7 @@
*
* \brief Model for the pressure equation discretized by mimetic FD.
*/
#include <dune/common/version.hh>
// dumux environment
#include "dumux/decoupled/common/mimetic/mimeticproperties.hh"
......@@ -359,7 +360,11 @@ public:
//! Function needed for restart option.
void serializeEntity(std::ostream &outstream, const Element &element)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int numFaces = element.subEntities(1);
#else
int numFaces = element.template count<1>();
#endif
for (int i=0; i < numFaces; i++)
{
int globalIdx = A_.faceMapper().map(element, i, 1);
......@@ -369,7 +374,11 @@ public:
void deserializeEntity(std::istream &instream, const Element &element)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int numFaces = element.subEntities(1);
#else
int numFaces = element.template count<1>();
#endif
for (int i=0; i < numFaces; i++)
{
int globalIdx = A_.faceMapper().map(element, i, 1);
......
......@@ -25,11 +25,12 @@
*
* \brief Model for the pressure equation discretized by mimetic FD.
*/
#include <dune/common/version.hh>
// dumux environment
#include "dumux/decoupled/common/mimetic/mimeticproperties.hh"
#include "dumux/decoupled/2p/diffusion/mimetic/mimeticoperator2padaptive.hh"
#include "dumux/decoupled/2p/diffusion/mimetic/mimetic2padaptive.hh"
#include <dumux/decoupled/common/mimetic/mimeticproperties.hh>
#include <dumux/decoupled/2p/diffusion/mimetic/mimeticoperator2padaptive.hh>
#include <dumux/decoupled/2p/diffusion/mimetic/mimetic2padaptive.hh>
namespace Dumux
{
......@@ -371,7 +372,11 @@ public:
//! Function needed for restart option.
void serializeEntity(std::ostream &outstream, const Element &element)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int numFaces = element.subEntities(1);
#else
int numFaces = element.template count<1>();
#endif
for (int i=0; i < numFaces; i++)
{
int globalIdx = A_.intersectionMapper().map(element, i);
......@@ -381,7 +386,11 @@ public:
void deserializeEntity(std::istream &instream, const Element &element)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int numFaces = element.subEntities(1);
#else
int numFaces = element.template count<1>();
#endif
for (int i=0; i < numFaces; i++)
{
int globalIdx = A_.intersectionMapper().map(element, i);
......
......@@ -20,6 +20,7 @@
#define DUMUX_FV3DPRESSURE2P2C_ADAPTIVE_HH
// dune environent:
#include <dune/common/version.hh>
#include <dune/istl/bvector.hh>
#include <dune/istl/operators.hh>
#include <dune/istl/solvers.hh>
......@@ -275,12 +276,20 @@ private:
/******* get corner of interest ************/
// search through corners of large cell with isIt
int localIdxLarge = 0;
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
for(localIdxLarge = 0; localIdxLarge < is.inside()->subEntities(dim); ++localIdxLarge)
#else
for(localIdxLarge = 0; localIdxLarge<is.inside()->template count<dim>(); ++localIdxLarge)
#endif
{
const VertexPointer vPtrLarge = is.inside()->template subEntity<dim>(localIdxLarge);
// search through corners of small cell with isIt
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
for(int verticeSmall = 0; verticeSmall<is.outside()->subEntities(dim); ++verticeSmall)
#else
for(int verticeSmall = 0; verticeSmall<is.outside()->template count<dim>(); ++verticeSmall)
#endif
{
const VertexPointer vPtrSmall = is.outside()->template subEntity<dim>(verticeSmall);
......@@ -1717,7 +1726,11 @@ int FV3dPressure2P2CAdaptive<TypeTag>::computeTransmissibilities(const Intersect
{
// loop through remaining 2 points
std::vector<int> diagonal;
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
for(int verticeSmall = 0; verticeSmall < isIt->outside()->subEntities(dim); ++verticeSmall)
#else
for(int verticeSmall = 0; verticeSmall<isIt->outside()->template count<dim>(); ++verticeSmall)
#endif
{
const VertexPointer vPtrSmall = isIt->outside()->template subEntity<dim>(verticeSmall);
......
......@@ -24,6 +24,8 @@
* \brief Base class for all models which use the Stokes box model.
*/
#include <dune/common/version.hh>
#include <dumux/implicit/common/implicitmodel.hh>
#include "stokeslocalresidual.hh"
......@@ -171,7 +173,11 @@ public:
fvGeometry.update(this->gridView_(), *eIt);
elemBcTypes.update(this->problem_(), *eIt);
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int numLocalVerts = eIt->subEntities(dim);
#else
int numLocalVerts = eIt->template count<dim>();
#endif
for (int i = 0; i < numLocalVerts; ++i)
{
int globalIdx = this->vertexMapper().map(*eIt, i, dim);
......
......@@ -24,6 +24,8 @@
#ifndef DUMUX_STOKESNC_MODEL_HH
#define DUMUX_STOKESNC_MODEL_HH
#include <dune/common/version.hh>
#include <dumux/freeflow/stokes/stokesmodel.hh>
#include "stokesnclocalresidual.hh"
......@@ -136,7 +138,11 @@ public:
fvGeometry.update(this->gridView_(), *elemIt);
elemBcTypes.update(this->problem_(), *elemIt, fvGeometry);
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int numLocalVerts = elemIt->subEntities(dim);
#else
int numLocalVerts = elemIt->template count<dim>();
#endif
for (int i = 0; i < numLocalVerts; ++i)
{
int globalIdx = this->vertexMapper().map(*elemIt, i, dim);
......
......@@ -25,6 +25,8 @@
#ifndef DUMUX_STOKESNCNI_MODEL_HH
#define DUMUX_STOKESNCNI_MODEL_HH
#include <dune/common/version.hh>
#include <dumux/freeflow/stokesnc/stokesncmodel.hh>
#include "stokesncnilocalresidual.hh"
......@@ -140,8 +142,12 @@ public:
fvGeometry.update(this->gridView_(), *elemIt);
elemBcTypes.update(this->problem_(), *elemIt, fvGeometry);
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int numLocalVerts = elemIt->subEntities(dim);
#else
int numLocalVerts = elemIt->template count<dim>();
#endif
for (int i = 0; i < numLocalVerts; ++i)
{
int globalIdx = this->vertexMapper().map(*elemIt, i, dim);
......
......@@ -25,6 +25,8 @@
#ifndef DUMUX_ELASTIC1P2C_MODEL_HH
#define DUMUX_ELASTIC1P2C_MODEL_HH
#include <dune/common/version.hh>
#include "el1p2cproperties.hh"
#include <dumux/common/eigenvalues.hh>
......@@ -259,7 +261,11 @@ public:
elemVolVars.update(this->problem_(), *eIt, fvGeometry, false);
// loop over all local vertices of the cell
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int numScv = eIt->subEntities(dim);
#else
int numScv = eIt->template count<dim>();
#endif
for (int scvIdx = 0; scvIdx < numScv; ++scvIdx)
{
......
......@@ -361,7 +361,11 @@ public:
elemVolVars.update(this->problem_(), *eIt, fvGeometry, false);
// loop over all local vertices of the cell
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int numScv = eIt->subEntities(dim);
#else
int numScv = eIt->template count<dim>();
#endif
for (int scvIdx = 0; scvIdx < numScv; ++scvIdx)
{
......
......@@ -23,6 +23,8 @@
#ifndef DUMUX_BOX_ASSEMBLER_HH
#define DUMUX_BOX_ASSEMBLER_HH
#include <dune/common/version.hh>
#include <dumux/common/exceptions.hh>
#include <dumux/implicit/common/implicitassembler.hh>
#include <dumux/parallel/vertexhandles.hh>
......@@ -101,7 +103,12 @@ private:
// find out whether the current element features a red
// vertex
bool isRed = false;
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int numVertices = eIt->subEntities(dim);
#else
int numVertices = eIt->template count<dim>();
#endif
for (int i=0; i < numVertices; ++i) {
int globalI = this->vertexMapper_().map(*eIt, i, dim);
if (this->vertexColor_[globalI] == ParentType::Red) {
......@@ -127,7 +134,11 @@ private:
continue; // non-red elements do not tint vertices
// yellow!
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int numVertices = eIt->subEntities(dim);
#else
int numVertices = eIt->template count<dim>();
#endif
for (int i = 0; i < numVertices; ++i) {
int globalI = this->vertexMapper_().map(*eIt, i, dim);
// if a vertex is already red, don't recolor it to
......@@ -159,7 +170,11 @@ private:
// check whether the element features a yellow
// (resp. orange at this point) vertex
bool isYellow = false;
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int numVertices = eIt->subEntities(dim);
#else
int numVertices = eIt->template count<dim>();
#endif
for (int i = 0; i < numVertices; ++i) {
int globalI = this->vertexMapper_().map(*eIt, i, dim);
if (this->vertexColor_[globalI] == ParentType::Orange) {
......@@ -181,7 +196,11 @@ private:
continue; // yellow and red elements do not make
// orange vertices yellow!
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int numVertices = eIt->subEntities(dim);
#else
int numVertices = eIt->template count<dim>();
#endif
for (int i = 0; i < numVertices; ++i) {
int globalI = this->vertexMapper_().map(*eIt, i, dim);
// if a vertex is orange, recolor it to yellow!
......@@ -230,7 +249,11 @@ private:
const ElementIterator eEndIt = this->gridView_().template end<0>();
for (; eIt != eEndIt; ++eIt) {
const Element &element = *eIt;
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int numVerticesLocal = element.subEntities(dim);
#else
int numVerticesLocal = element.template count<dim>();
#endif
// if the element is not in the interior or the process
// border, all dofs just contain main-diagonal entries
......@@ -297,7 +320,11 @@ private:
this->model_().localJacobian().assemble(element);
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int numVerticesLocal = element.subEntities(dim);
#else
int numVerticesLocal = element.template count<dim>();
#endif
for (int i=0; i < numVerticesLocal; ++ i) {
int globI = this->vertexMapper_().map(element, i, dim);
......@@ -336,7 +363,11 @@ private:
{
this->model_().localResidual().eval(element);
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int numVerticesLocal = element.subEntities(dim);
#else
int numVerticesLocal = element.template count<dim>();
#endif
for (int i = 0; i < numVerticesLocal; ++ i) {
int globI = this->vertexMapper_().map(element, i, dim);
......@@ -350,7 +381,11 @@ private:
// "assemble" a ghost element
void assembleGhostElement_(const Element &element)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int numVerticesLocal = element.subEntities(dim);
#else
int numVerticesLocal = element.template count<dim>();
#endif
for (int i=0; i < numVerticesLocal; ++i) {
const VertexPointer vp = element.template subEntity<dim>(i);
......
......@@ -23,6 +23,8 @@
#ifndef DUMUX_BOX_ELEMENT_BOUNDARY_TYPES_HH
#define DUMUX_BOX_ELEMENT_BOUNDARY_TYPES_HH
#include <dune/common/version.hh>
#include "boxproperties.hh"
#include <dumux/common/valgrind.hh>
......@@ -80,7 +82,12 @@ public:
void update(const Problem &problem,
const Element &element)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int numVertices = element.subEntities(dim);
#else
int numVertices = element.template count<dim>();
#endif
this->resize(numVertices);
hasDirichlet_ = false;
......
......@@ -23,6 +23,8 @@
#ifndef DUMUX_BOX_ELEMENT_VOLUME_VARIABLES_HH
#define DUMUX_BOX_ELEMENT_VOLUME_VARIABLES_HH
#include <dune/common/version.hh>
#include "boxproperties.hh"
......@@ -76,7 +78,11 @@ public:
const VertexMapper &vertexMapper = problem.vertexMapper();
// we assert that the i-th shape function is
// associated to the i-th vertex of the element.
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int numVertices = element.subEntities(dim);
#else
int numVertices = element.template count<dim>();
#endif
this->resize(numVertices);
for (int scvIdx = 0; scvIdx < numVertices; scvIdx++) {
const PrimaryVariables &priVars
......@@ -113,7 +119,11 @@ public:
const FVElementGeometry &fvGeometry,
const ElementSolutionVector& elementSolVector)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int numVertices = element.subEntities(dim);
#else
int numVertices = element.template count<dim>();
#endif
this->resize(numVertices);
for (int scvIdx = 0; scvIdx < numVertices; scvIdx++)
{
......
......@@ -23,6 +23,7 @@
#ifndef DUMUX_IMPLICIT_MODEL_HH
#define DUMUX_IMPLICIT_MODEL_HH
#include <dune/common/version.hh>
#include <dune/geometry/type.hh>
#include <dune/istl/bvector.hh>
......@@ -135,7 +136,11 @@ public:
if (!isBox || !enableHints_)
return;
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int n = element.subEntities(dim);
#else
int n = element.template count<dim>();
#endif
prevVolVars.resize(n);
curVolVars.resize(n);
for (int i = 0; i < n; ++i) {
......@@ -158,7 +163,11 @@ public:
if (!isBox || !enableHints_)
return;
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int n = element.subEntities(dim);
#else
int n = element.template count<dim>();
#endif
curVolVars.resize(n);
for (int i = 0; i < n; ++i) {
int globalIdx = vertexMapper().map(element, i, dim);
......@@ -228,7 +237,11 @@ public:
if (isBox)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
for (int i = 0; i < eIt->subEntities(dim); ++i) {
#else
for (int i = 0; i < eIt->template count<dim>(); ++i) {
#endif
int globalI = vertexMapper().map(*eIt, i, dim);
residual[globalI] += localResidual().residual(i);
}
......@@ -277,8 +290,14 @@ public:
if (isBox)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
for (int i = 0; i < eIt->subEntities(dim); ++i)
#else
for (int i = 0; i < eIt->template count<dim>(); ++i)
#endif
{
storage += localResidual().storageTerm()[i];
}
}
else
{
......
......@@ -27,6 +27,7 @@
#include <string>
#include <dune/common/fvector.hh>
#include <dune/common/version.hh>
#include <dune/istl/bvector.hh>
#include <dune/grid/io/file/vtk/function.hh>
......@@ -82,7 +83,11 @@ public:
double min=1e100;
int imin=-1;
Dune::GeometryType geomType = element.type();
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int n = element.subEntities(dim);
#else
int n = element.template count<dim>();
#endif
for (int i=0; i < n; ++i)
{
Dune::FieldVector<ctype,dim> local =
......
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