Commit 90009a8e authored by Christoph Grueninger's avatar Christoph Grueninger
Browse files

Replace more Mapper::map by Mapper::subIndex/index for Dune 2.4.

The method is deprecated in 2.4.
Reduce deprecation warnings for implicit methods, more
replacements have to follow.
(reviewed by fetzer)


git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@13909 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 9a0b32eb
......@@ -26,6 +26,8 @@
#ifndef DUMUX_TWOP_MODEL_HH
#define DUMUX_TWOP_MODEL_HH
#include <dune/common/version.hh>
#include <dumux/implicit/common/implicitvelocityoutput.hh>
#include "2pproperties.hh"
......@@ -146,7 +148,11 @@ public:
{
if(eIt->partitionType() == Dune::InteriorEntity)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int eIdx = this->elementMapper().index(*eIt);
#else
int eIdx = this->elementMapper().map(*eIt);
#endif
(*rank)[eIdx] = this->gridView_().comm().rank();
FVElementGeometry fvGeometry;
......@@ -160,7 +166,11 @@ public:
for (int scvIdx = 0; scvIdx < fvGeometry.numScv; ++scvIdx)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int dofIdxGlobal = this->dofMapper().subIndex(*eIt, scvIdx, dofCodim);
#else
int dofIdxGlobal = this->dofMapper().map(*eIt, scvIdx, dofCodim);
#endif
(*pw)[dofIdxGlobal] = elemVolVars[scvIdx].pressure(wPhaseIdx);
(*pn)[dofIdxGlobal] = elemVolVars[scvIdx].pressure(nPhaseIdx);
......
......@@ -110,7 +110,11 @@ private:
int numVertices = eIt->template count<dim>();
#endif
for (int i=0; i < numVertices; ++i) {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int globalI = this->vertexMapper_().subIndex(*eIt, i, dim);
#else
int globalI = this->vertexMapper_().map(*eIt, i, dim);
#endif
if (this->vertexColor_[globalI] == ParentType::Red) {
isRed = true;
break;
......@@ -119,7 +123,11 @@ private:
// if yes, the element color is also red, else it is not
// red, i.e. green for the mean time
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int eIdxGlobal = this->elementMapper_().index(*eIt);
#else
int eIdxGlobal = this->elementMapper_().map(*eIt);
#endif
if (isRed)
this->elementColor_[eIdxGlobal] = ParentType::Red;
else
......@@ -129,7 +137,11 @@ private:
// Mark yellow vertices (as orange for the mean time)
eIt = this->gridView_().template begin<0>();
for (; eIt != eEndIt; ++eIt) {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int eIdx = this->elementMapper_().index(*eIt);
#else
int eIdx = this->elementMapper_().map(*eIt);
#endif
if (this->elementColor_[eIdx] != ParentType::Red)
continue; // non-red elements do not tint vertices
// yellow!
......@@ -140,7 +152,11 @@ private:
int numVertices = eIt->template count<dim>();
#endif
for (int i = 0; i < numVertices; ++i) {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int globalI = this->vertexMapper_().subIndex(*eIt, i, dim);
#else
int globalI = this->vertexMapper_().map(*eIt, i, dim);
#endif
// if a vertex is already red, don't recolor it to
// yellow!
if (this->vertexColor_[globalI] != ParentType::Red) {
......@@ -162,7 +178,11 @@ private:
// Mark yellow elements
eIt = this->gridView_().template begin<0>();
for (; eIt != eEndIt; ++eIt) {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int eIdx = this->elementMapper_().index(*eIt);
#else
int eIdx = this->elementMapper_().map(*eIt);
#endif
if (this->elementColor_[eIdx] == ParentType::Red) {
continue; // element is red already!
}
......@@ -176,7 +196,11 @@ private:
int numVertices = eIt->template count<dim>();
#endif
for (int i = 0; i < numVertices; ++i) {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int globalI = this->vertexMapper_().subIndex(*eIt, i, dim);
#else
int globalI = this->vertexMapper_().map(*eIt, i, dim);
#endif
if (this->vertexColor_[globalI] == ParentType::Orange) {
isYellow = true;
break;
......@@ -191,7 +215,11 @@ private:
// one green element as a neighbor.
eIt = this->gridView_().template begin<0>();
for (; eIt != eEndIt; ++eIt) {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int eIdx = this->elementMapper_().index(*eIt);
#else
int eIdx = this->elementMapper_().map(*eIt);
#endif
if (this->elementColor_[eIdx] != ParentType::Green)
continue; // yellow and red elements do not make
// orange vertices yellow!
......@@ -202,7 +230,11 @@ private:
int numVertices = eIt->template count<dim>();
#endif
for (int i = 0; i < numVertices; ++i) {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int globalI = this->vertexMapper_().subIndex(*eIt, i, dim);
#else
int globalI = this->vertexMapper_().map(*eIt, i, dim);
#endif
// if a vertex is orange, recolor it to yellow!
if (this->vertexColor_[globalI] == ParentType::Orange)
this->vertexColor_[globalI] = ParentType::Yellow;
......@@ -261,7 +293,11 @@ private:
element.partitionType() != Dune::BorderEntity)
{
for (int i = 0; i < numVerticesLocal; ++i) {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int globalI = this->vertexMapper_().subIndex(*eIt, i, dim);
#else
int globalI = this->vertexMapper_().map(*eIt, i, dim);
#endif
neighbors[globalI].insert(globalI);
}
}
......@@ -269,9 +305,17 @@ private:
{
// loop over all element vertices
for (int i = 0; i < numVerticesLocal - 1; ++i) {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int globalI = this->vertexMapper_().subIndex(*eIt, i, dim);
#else
int globalI = this->vertexMapper_().map(*eIt, i, dim);
#endif
for (int j = i + 1; j < numVerticesLocal; ++j) {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int globalJ = this->vertexMapper_().subIndex(*eIt, j, dim);
#else
int globalJ = this->vertexMapper_().map(*eIt, j, dim);
#endif
// make sure that vertex j is in the neighbor set
// of vertex i and vice-versa
neighbors[globalI].insert(globalJ);
......@@ -309,7 +353,11 @@ private:
void assembleElement_(const Element &element)
{
if (this->enablePartialReassemble_()) {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int eIdxGlobal = this->model_().elementMapper().index(element);
#else
int eIdxGlobal = this->model_().elementMapper().map(element);
#endif
if (this->elementColor_[eIdxGlobal] == ParentType::Green) {
++this->greenElems_;
......@@ -326,7 +374,11 @@ private:
int numVerticesLocal = element.template count<dim>();
#endif
for (int i=0; i < numVerticesLocal; ++ i) {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int globI = this->vertexMapper_().subIndex(element, i, dim);
#else
int globI = this->vertexMapper_().map(element, i, dim);
#endif
// update the right hand side
this->residual_[globI] += this->model_().localJacobian().residual(i);
......@@ -349,7 +401,11 @@ private:
// update the jacobian matrix
for (int j = 0; j < numVerticesLocal; ++ j) {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int globJ = this->vertexMapper_().subIndex(element, j, dim);
#else
int globJ = this->vertexMapper_().map(element, j, dim);
#endif
(*this->matrix_)[globI][globJ] +=
this->model_().localJacobian().mat(i,j);
}
......@@ -369,7 +425,11 @@ private:
int numVerticesLocal = element.template count<dim>();
#endif
for (int i = 0; i < numVerticesLocal; ++ i) {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int globI = this->vertexMapper_().subIndex(element, i, dim);
#else
int globI = this->vertexMapper_().map(element, i, dim);
#endif
// update the right hand side
this->residual_[globI] += this->model_().localResidual().residual(i);
......@@ -397,7 +457,11 @@ private:
}
// set main diagonal entries for the vertex
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int vIdx = this->vertexMapper_().index(*vp);
#else
int vIdx = this->vertexMapper_().map(*vp);
#endif
typedef typename JacobianMatrix::block_type BlockType;
BlockType &J = (*this->matrix_)[vIdx][vIdx];
for (int j = 0; j < BlockType::rows; ++j)
......
......@@ -85,8 +85,13 @@ public:
#endif
this->resize(numVertices);
for (int scvIdx = 0; scvIdx < numVertices; scvIdx++) {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
const PrimaryVariables &priVars
= globalSol[vertexMapper.subIndex(element, scvIdx, dim)];
#else
const PrimaryVariables &priVars
= globalSol[vertexMapper.map(element, scvIdx, dim)];
#endif
// reset evaluation point to zero
(*this)[scvIdx].setEvalPoint(0);
......
......@@ -23,6 +23,8 @@
#ifndef DUMUX_CC_ASSEMBLER_HH
#define DUMUX_CC_ASSEMBLER_HH
#include <dune/common/version.hh>
#include <dumux/implicit/common/implicitassembler.hh>
namespace Dumux {
......@@ -79,7 +81,11 @@ private:
// linearization which actually will get achieved
this->nextReassembleAccuracy_ = 0;
for (; eIt != eEndIt; ++eIt) {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int eIdx = this->elementMapper_().index(*eIt);
#else
int eIdx = this->elementMapper_().map(*eIt);
#endif
if (this->delta_[eIdx] > relTol)
{
// mark element as red if discrepancy is larger than
......@@ -97,7 +103,11 @@ private:
// mark the neighbors also red
eIt = this->gridView_().template begin<0>();
for (; eIt != eEndIt; ++eIt) {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int eIdx = this->elementMapper_().index(*eIt);
#else
int eIdx = this->elementMapper_().map(*eIt);
#endif
if (this->elementColor_[eIdx] == ParentType::Red)
continue; // element is red already!
......@@ -109,7 +119,11 @@ private:
{
if (isIt->neighbor())
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int neighborIdx = this->elementMapper_().index(*isIt->outside());
#else
int neighborIdx = this->elementMapper_().map(*isIt->outside());
#endif
this->elementColor_[neighborIdx] = ParentType::Red;
}
}
......@@ -138,8 +152,12 @@ 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 globalI = this->elementMapper_().index(element);
#else
int globalI = this->elementMapper_().map(element);
#endif
neighbors[globalI].insert(globalI);
// if the element is ghost,
......@@ -154,7 +172,11 @@ private:
{
if (isIt->neighbor())
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int globalJ = this->elementMapper_().index(*(isIt->outside()));
#else
int globalJ = this->elementMapper_().map(*(isIt->outside()));
#endif
neighbors[globalI].insert(globalJ);
}
}
......@@ -182,7 +204,11 @@ private:
void assembleElement_(const Element &element)
{
if (this->enablePartialReassemble_()) {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int eIdxGlobal = this->model_().elementMapper().index(element);
#else
int eIdxGlobal = this->model_().elementMapper().map(element);
#endif
if (this->elementColor_[eIdxGlobal] == ParentType::Green) {
++this->greenElems_;
......@@ -193,7 +219,11 @@ private:
this->model_().localJacobian().assemble(element);
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int globalI = this->elementMapper_().index(element);
#else
int globalI = this->elementMapper_().map(element);
#endif
// update the right hand side
this->residual_[globalI] = this->model_().localJacobian().residual(0);
......@@ -217,7 +247,11 @@ private:
{
if (isIt->neighbor())
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int globalJ = this->elementMapper_().index(*(isIt->outside()));
#else
int globalJ = this->elementMapper_().map(*(isIt->outside()));
#endif
(*this->matrix_)[globalI][globalJ] = this->model_().localJacobian().mat(0,++j);
}
}
......@@ -229,7 +263,11 @@ private:
{
this->model_().localResidual().eval(element);
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int globalI = this->elementMapper_().index(element);
#else
int globalI = this->elementMapper_().map(element);
#endif
// update the right hand side
this->residual_[globalI] += this->model_().localResidual().residual(0);
......@@ -240,7 +278,11 @@ private:
// "assemble" a ghost element
void assembleGhostElement_(const Element &element)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int globalI = this->elementMapper_().index(element);
#else
int globalI = this->elementMapper_().map(element);
#endif
// update the right hand side
this->residual_[globalI] = 0.0;
......
......@@ -80,9 +80,14 @@ public:
for (int i = 0; i < numNeighbors; i++)
{
const Element& neighbor = *(fvGeometry.neighbors[i]);
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
const PrimaryVariables &solI
= globalSol[problem.elementMapper().index(neighbor)];
#else
const PrimaryVariables &solI
= globalSol[problem.elementMapper().map(neighbor)];
#endif
FVElementGeometry neighborFVGeom;
neighborFVGeom.updateInner(neighbor);
......
......@@ -23,6 +23,8 @@
#ifndef DUMUX_IMPLICIT_ASSEMBLER_HH
#define DUMUX_IMPLICIT_ASSEMBLER_HH
#include <dune/common/version.hh>
#include "implicitproperties.hh"
namespace Dumux {
......@@ -333,7 +335,11 @@ public:
if (!enablePartialReassemble_())
return Red; // reassemble unconditionally!
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int vIdxGlobal = vertexMapper_().subIndex(element, vIdx, dim);
#else
int vIdxGlobal = vertexMapper_().map(element, vIdx, dim);
#endif
return vertexColor_[vIdxGlobal];
}
......@@ -359,7 +365,11 @@ public:
if (!enablePartialReassemble_())
return Red; // reassemble unconditionally!
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int eIdxGlobal = elementMapper_().index(element);
#else
int eIdxGlobal = elementMapper_().map(element);
#endif
return elementColor_[eIdxGlobal];
}
......
......@@ -23,7 +23,9 @@
#ifndef DUMUX_IMPLICIT_LOCAL_JACOBIAN_HH
#define DUMUX_IMPLICIT_LOCAL_JACOBIAN_HH
#include <dune/common/version.hh>
#include <dune/istl/matrix.hh>
#include <dumux/common/math.hh>
#include <dumux/common/valgrind.hh>
......@@ -403,13 +405,21 @@ protected:
ElementPointer neighbor(element_());
if (isBox)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
dofIdxGlobal = vertexMapper_().subIndex(element_(), col, dim);
#else
dofIdxGlobal = vertexMapper_().map(element_(), col, dim);
#endif
}
else
{
neighbor = fvElemGeom_.neighbors[col];
neighborFVGeom.updateInner(*neighbor);
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
dofIdxGlobal = problemPtr_->elementMapper().index(*neighbor);
#else
dofIdxGlobal = problemPtr_->elementMapper().map(*neighbor);
#endif
}
PrimaryVariables priVars(model_().curSol()[dofIdxGlobal]);
......
......@@ -26,8 +26,10 @@
#include "implicitproperties.hh"
#include <unordered_map>
#include <dune/istl/bvector.hh>
#include <dune/common/fvector.hh>
#include <dune/common/version.hh>
#include <dune/istl/bvector.hh>
namespace Dumux
{
......@@ -98,7 +100,11 @@ public:
// transform vertex velocities from local to global coordinates
for (int scvIdx = 0; scvIdx < fvGeometry.numScv; ++scvIdx)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int vIdxGlobal = problem_.vertexMapper().subIndex(*eIt, scvIdx, dofCodim);
#else
int vIdxGlobal = problem_.vertexMapper().map(*eIt, scvIdx, dofCodim);
#endif
cellNum_[vIdxGlobal] += 1;
}
......@@ -178,7 +184,11 @@ public:
// transform vertex velocities from local to global coordinates
for (int scvIdx = 0; scvIdx < fvGeometry.numScv; ++scvIdx)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int vIdxGlobal = problem_.vertexMapper().subIndex(element, scvIdx, dofCodim);
#else
int vIdxGlobal = problem_.vertexMapper().map(element, scvIdx, dofCodim);
#endif
// calculate the subcontrolvolume velocity by the Piola transformation
Dune::FieldVector<CoordScalar, dim> scvVelocity(0);
......@@ -234,7 +244,11 @@ public:
scvVelocity /= element.geometry().integrationElement(localPos);
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int eIdxGlobal = problem_.elementMapper().index(element);
#else
int eIdxGlobal = problem_.elementMapper().map(element);
#endif
velocity[eIdxGlobal]= scvVelocity;
}
......
......@@ -24,6 +24,8 @@
#ifndef DUMUX_NI_MODEL_HH
#define DUMUX_NI_MODEL_HH
#include <dune/common/version.hh>
#include "niproperties.hh"
namespace Dumux {
......@@ -113,7 +115,11 @@ public:
for (int scvIdx = 0; scvIdx < fvGeometry.numScv; ++scvIdx)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int dofIdxGlobal = this->dofMapper().subIndex(*eIt, scvIdx, dofCodim);
#else
int dofIdxGlobal = this->dofMapper().map(*eIt, scvIdx, dofCodim);
#endif
temperature[dofIdxGlobal] = elemVolVars[scvIdx].temperature();
}
}
......
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