Commit 5ae97158 authored by Hao Wu's avatar Hao Wu
Browse files

Replace deprecated map with index/subIndex.

(reviewed by gruenich)

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@14047 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 53ace3de
......@@ -5,7 +5,7 @@ Copyright holders:
2014 Markus Blatt
2010 Felix Bode
2007--2011 Yufei Cao
2011--2014 Holger Class
2011--2014 Holger Class
2008--2013 Melanie Darcis
2008--2009 Onur Dogan
2009--2011 Karin Erbertseder
......@@ -33,7 +33,8 @@ Copyright holders:
2012-2014 Alexandru Tatomir
2013 Katharina Türk
2010--2014 Lena Walter
2010--2011 David Werner
2010--2011 David Werner
2015 Hao Wu
2008--2013 Markus Wolff
2013 Tianyuan Zheng
......
......@@ -17,6 +17,7 @@
#ifndef DUMUX_FVMPFAL2DPRESSURE2P_HH
#define DUMUX_FVMPFAL2DPRESSURE2P_HH
#include <dune/common/version.hh>
// dumux environment
#include <dumux/decoupled/common/fv/fvpressure.hh>
#include <dumux/decoupled/common/fv/mpfa/mpfalinteractionvolume.hh>
......@@ -840,7 +841,11 @@ void FvMpfaL2dPressure2p<TypeTag>::storeInteractionVolumeInfo()
//
// int globalVertIdx12corner = problem_.variables().index(
// *((*eIt).template subEntity < dim > (localVertIdx12corner)));
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int globalVertIdx12corner = problem_.variables().vertexMapper().subIndex(*eIt, localVertIdx12corner, dim);
#else
int globalVertIdx12corner = problem_.variables().vertexMapper().map(*eIt, localVertIdx12corner, dim);
#endif
// std::cout<<"globalVertIdx12corner = "<<globalVertIdx12corner<<"\n";
......@@ -851,7 +856,11 @@ void FvMpfaL2dPressure2p<TypeTag>::storeInteractionVolumeInfo()
// int globalVertIdx14corner = problem_.variables().index(
// *((*eIt).template subEntity < dim > (localVertIdx14corner)));
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int globalVertIdx14corner = problem_.variables().vertexMapper().subIndex(*eIt, localVertIdx14corner, dim);
#else
int globalVertIdx14corner = problem_.variables().vertexMapper().map(*eIt, localVertIdx14corner, dim);
#endif
// std::cout<<"globalVertIdx14corner = "<<globalVertIdx14corner<<"\n";
if (globalVertIdx12corner == globalVertIdx14corner)
......
......@@ -19,6 +19,7 @@
#ifndef DUMUX_FVMPFAL2PFABOUND3DPRESSURE2P_HH
#define DUMUX_FVMPFAL2PFABOUND3DPRESSURE2P_HH
#include <dune/common/version.hh>
// dumux environment
#include <dumux/decoupled/2p/diffusion/diffusionproperties2p.hh>
#include <dumux/decoupled/common/fv/fvpressure.hh>
......@@ -568,7 +569,11 @@ void FvMpfaL3dPressure2p<TypeTag>::initializeMatrixRowSize()
for (int vIdx = 0; vIdx < numVertices; vIdx++)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int vIdxGlobal = problem_.variables().vertexMapper().subIndex(*eIt, vIdx, dim);
#else
int vIdxGlobal = problem_.variables().vertexMapper().map(*eIt, vIdx, dim);
#endif
InteractionVolume& interactionVolume = interactionVolumes_.interactionVolume(vIdxGlobal);
......@@ -609,7 +614,11 @@ void FvMpfaL3dPressure2p<TypeTag>::initializeMatrixIndices()
for (int vIdx = 0; vIdx < numVertices; vIdx++)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int vIdxGlobal = problem_.variables().vertexMapper().subIndex(*eIt, vIdx, dim);
#else
int vIdxGlobal = problem_.variables().vertexMapper().map(*eIt, vIdx, dim);
#endif
InteractionVolume& interactionVolume = interactionVolumes_.interactionVolume(vIdxGlobal);
for (int subVolumeIdx = 0; subVolumeIdx < InteractionVolume::subVolumeTotalNum; subVolumeIdx++)
......
......@@ -144,7 +144,11 @@ public:
for (int i = 0; i < numFaces; i++)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int index = faceMapper_.subIndex(*eIt, i,1);
#else
int index = faceMapper_.map(*eIt, i,1);
#endif
if (!visited[index])
{
......@@ -175,7 +179,11 @@ public:
for (int i = 0; i < numFaces; i++)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int indexI = faceMapper_.subIndex(*eIt, i, 1);
#else
int indexI = faceMapper_.map(*eIt, i, 1);
#endif
if (!visited[indexI])
{
A_.addindex(indexI,indexI);
......@@ -183,7 +191,11 @@ public:
}
for (int k = 0; k < numFaces; k++)
if (k != i) {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int indexJ = faceMapper_.subIndex(*eIt, k, 1);
#else
int indexJ = faceMapper_.map(*eIt, k, 1);
#endif
A_.addindex(indexI, indexJ);
//std::cout << "indexI = " << indexI << ", added indexJ = " << indexJ << std::endl;
}
......@@ -268,7 +280,11 @@ public:
// get local to global id map
for (unsigned int k = 0; k < numFaces; k++)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int alpha = faceMapper_.subIndex(*eIt, k, 1);
#else
int alpha = faceMapper_.map(*eIt, k, 1);
#endif
local2Global[k] = alpha;
}
......@@ -309,7 +325,11 @@ public:
// get local to global id map
for (unsigned int k = 0; k < numFaces; k++)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int alpha = faceMapper_.subIndex(*eIt, k, 1);
#else
int alpha = faceMapper_.map(*eIt, k, 1);
#endif
local2Global[k] = alpha;
}
loc.completeRHS(*eIt, local2Global, f);
......
......@@ -27,6 +27,7 @@
*/
#include"croperator2p.hh"
#include <dune/common/version.hh>
#include <dumux/decoupled/2p/diffusion/diffusionproperties2p.hh>
#include "dumux/decoupled/common/mimetic/mimeticproperties.hh"
......@@ -136,7 +137,11 @@ public:
{
int indexInInside = isIt->indexInInside();
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int fIdxGlobal = this->faceMapper_.subIndex(*eIt, indexInInside, 1);
#else
int fIdxGlobal = this->faceMapper_.map(*eIt, indexInInside, 1);
#endif
pressTrace[indexInInside] = u[fIdxGlobal];
......
......@@ -19,6 +19,7 @@
#ifndef DUMUX_GRIDADAPTIONINDICATOR2PLOCAL_HH
#define DUMUX_GRIDADAPTIONINDICATOR2PLOCAL_HH
#include <dune/common/version.hh>
#include <dumux/decoupled/common/impetproperties.hh>
#include <dumux/decoupled/2p/2pproperties.hh>
......@@ -229,7 +230,11 @@ public:
*/
bool refine(const Element& element)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
return (indicatorVector_[problem_.elementMapper().index(element)] > refineBound_);
#else
return (indicatorVector_[problem_.elementMapper().map(element)] > refineBound_);
#endif
}
/*! \brief Indicator function for marking of grid cells for coarsening
......@@ -240,7 +245,11 @@ public:
*/
bool coarsen(const Element& element)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
return (indicatorVector_[problem_.elementMapper().index(element)] < coarsenBound_);
#else
return (indicatorVector_[problem_.elementMapper().map(element)] < coarsenBound_);
#endif
}
/*! \brief Initializes the adaption indicator class*/
......
......@@ -22,6 +22,7 @@
#include "decoupledproperties.hh"
#include <dune/common/dynvector.hh>
#include <dune/common/version.hh>
/**
* @file
......@@ -317,7 +318,11 @@ public:
*/
bool refine(const Element& element)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int idx = problem_.elementMapper().index(element);
#else
int idx = problem_.elementMapper().map(element);
#endif
if (indicatorVector_[idx] == refineCell)
return true;
else if (maxLevel_ == maxAllowedLevel_)
......@@ -334,7 +339,11 @@ public:
*/
bool coarsen(const Element& element)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int idx = problem_.elementMapper().index(element);
#else
int idx = problem_.elementMapper().map(element);
#endif
if (indicatorVector_[idx] == coarsenCell && maxLevel_ < maxAllowedLevel_)
return true;
else if (indicatorVector_[idx] == coarsenCell && !adaptionIndicator_.refine(element))
......
......@@ -167,7 +167,11 @@ public:
ElementIterator eEndIt = this->gridView_().template end<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
rank[eIdx] = this->gridView_().comm().rank();
fvGeometry.update(this->gridView_(), *eIt);
......@@ -180,7 +184,11 @@ public:
#endif
for (int i = 0; i < numLocalVerts; ++i)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int vIdxGlobal = this->vertexMapper().subIndex(*eIt, i, dim);
#else
int vIdxGlobal = this->vertexMapper().map(*eIt, i, dim);
#endif
volVars.update(sol[vIdxGlobal],
this->problem_(),
*eIt,
......
......@@ -132,7 +132,11 @@ public:
ElementIterator endit = this->gridView_().template end<0>();
for (; elemIt != endit; ++elemIt)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int idx = this->elementMapper().index(*elemIt);
#else
int idx = this->elementMapper().map(*elemIt);
#endif
rank[idx] = this->gridView_().comm().rank();
fvGeometry.update(this->gridView_(), *elemIt);
......@@ -145,7 +149,11 @@ public:
#endif
for (int i = 0; i < numLocalVerts; ++i)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int vIdxGlobal = this->vertexMapper().subIndex(*elemIt, i, dim);
#else
int vIdxGlobal = this->vertexMapper().map(*elemIt, i, dim);
#endif
volVars.update(sol[vIdxGlobal],
this->problem_(),
*elemIt,
......
......@@ -138,7 +138,11 @@ public:
ElementIterator endit = this->gridView_().template end<0>();
for (; elemIt != endit; ++elemIt)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int idx = this->elementMapper().index(*elemIt);
#else
int idx = this->elementMapper().map(*elemIt);
#endif
rank[idx] = this->gridView_().comm().rank();
fvGeometry.update(this->gridView_(), *elemIt);
......@@ -151,7 +155,11 @@ public:
#endif
for (int i = 0; i < numLocalVerts; ++i)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int vIdxGlobal = this->vertexMapper().subIndex(*elemIt, i, dim);
#else
int vIdxGlobal = this->vertexMapper().map(*elemIt, i, dim);
#endif
volVars.update(sol[vIdxGlobal],
this->problem_(),
*elemIt,
......
......@@ -24,6 +24,7 @@
#ifndef DUMUX_EL1P2C_LOCAL_JACOBIAN_HH
#define DUMUX_EL1P2C_LOCAL_JACOBIAN_HH
#include <dune/common/version.hh>
#include <dumux/implicit/common/implicitlocaljacobian.hh>
namespace Dumux
......@@ -112,13 +113,23 @@ public:
ElementPointer neighbor(this->element_());
if (isBox)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
dofIdxGlobal = this->vertexMapper_().subIndex(this->element_(), col, dim);
#else
dofIdxGlobal = this->vertexMapper_().map(this->element_(), col, dim);
#endif
}
else
{
neighbor = this->fvElemGeom_.neighbors[col];
neighborFVGeom.updateInner(*neighbor);
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
dofIdxGlobal = this->problemPtr_->elementMapper().index(*neighbor);
#else
dofIdxGlobal = this->problemPtr_->elementMapper().map(*neighbor);
#endif
}
PrimaryVariables priVars(this->model_().curSol()[dofIdxGlobal]);
......
......@@ -255,7 +255,11 @@ public:
{
if(eIt->partitionType() == Dune::InteriorEntity)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
unsigned int eIdx = this->problem_().model().elementMapper().index(*eIt);
#else
unsigned int eIdx = this->problem_().model().elementMapper().map(*eIt);
#endif
rank[eIdx] = this->gridView_().comm().rank();
fvGeometry.update(this->gridView_(), *eIt);
......@@ -271,7 +275,11 @@ public:
for (int scvIdx = 0; scvIdx < numScv; ++scvIdx)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
unsigned int vIdxGlobal = this->dofMapper().subIndex(*eIt, scvIdx, dim);
#else
unsigned int vIdxGlobal = this->dofMapper().map(*eIt, scvIdx, dim);
#endif
pressure[vIdxGlobal] = elemVolVars[scvIdx].pressure();
moleFraction0[vIdxGlobal] = elemVolVars[scvIdx].moleFraction(0);
......
......@@ -73,7 +73,11 @@ public:
{
ParentType::update(priVars, problem, element, fvGeometry, scvIdx, isOldSol);
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int vIdxGlobal = problem.vertexMapper().subIndex(element, scvIdx, dim);
#else
int vIdxGlobal = problem.vertexMapper().map(element, scvIdx, dim);
#endif
primaryVars_ = priVars;
prevPrimaryVars_ = problem.model().prevSol()[vIdxGlobal];
......
......@@ -25,6 +25,7 @@
#ifndef DUMUX_EL2P_ASSEMBLER_HH
#define DUMUX_EL2P_ASSEMBLER_HH
#include <dune/common/version.hh>
#include "el2pproperties.hh"
#include "el2plocaloperator.hh"
......@@ -435,7 +436,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];
}
......
......@@ -144,8 +144,12 @@ public:
prevVolVars.resize(n);
curVolVars.resize(n);
for (int i = 0; i < n; ++i) {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int vIdxGlobal = vertexMapper().subIndex(element, i, dim);
#else
int vIdxGlobal = vertexMapper().map(element, i, dim);
#endif
if (!hintsUsable_[vIdxGlobal]) {
curVolVars[i].setHint(NULL);
prevVolVars[i].setHint(NULL);
......@@ -170,7 +174,11 @@ public:
#endif
curVolVars.resize(n);
for (int i = 0; i < n; ++i) {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int vIdxGlobal = vertexMapper().subIndex(element, i, dim);
#else
int vIdxGlobal = vertexMapper().map(element, i, dim);
#endif
if (!hintsUsable_[vIdxGlobal])
curVolVars[i].setHint(NULL);
......@@ -194,7 +202,11 @@ public:
return;
for (unsigned int i = 0; i < elemVolVars.size(); ++i) {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int vIdxGlobal = vertexMapper().subIndex(element, i, dim);
#else
int vIdxGlobal = vertexMapper().map(element, i, dim);
#endif
curHints_[vIdxGlobal] = elemVolVars[i];
if (!hintsUsable_[vIdxGlobal])
prevHints_[vIdxGlobal] = elemVolVars[i];
......@@ -796,7 +808,11 @@ public:
bool onBoundary(const Element &element, const int vIdx) const
{
if (isBox)
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
return onBoundary(vertexMapper().subIndex(element, vIdx, dim));
#else
return onBoundary(vertexMapper().map(element, vIdx, dim));
#endif
else
DUNE_THROW(Dune::InvalidStateException,
"requested for cell-centered model");
......@@ -979,13 +995,21 @@ protected:
1,
faceVertexIdx,
dim);
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int vIdxGlobal = vertexMapper().subIndex(*eIt, vIdx, dim);
#else
int vIdxGlobal = vertexMapper().map(*eIt, vIdx, dim);
#endif
boundaryIndices_[vIdxGlobal] = true;
}
}
else
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int eIdxGlobal = elementMapper().index(*eIt);
#else
int eIdxGlobal = elementMapper().map(*eIt);
#endif
boundaryIndices_[eIdxGlobal] = true;
}
}
......
......@@ -26,6 +26,7 @@
#ifndef DUMUX_ELASTIC2P_MODEL_HH
#define DUMUX_ELASTIC2P_MODEL_HH
#include <dune/common/version.hh>
#include <dune/pdelab/gridfunctionspace/interpolate.hh>
#include <dumux/common/eigenvalues.hh>
#include "el2pproperties.hh"
......@@ -152,7 +153,11 @@ public:
const Entity &entity)
{
// vertex index
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int dofIdxGlobal = this->dofMapper().index(entity);
#else
int dofIdxGlobal = this->dofMapper().map(entity);
#endif
// write phase state
if (!outStream.good()) {
......@@ -169,7 +174,11 @@ public:
for (int j = 0; j< dim; ++j)
outStream << this->curSol().base()[numScv*(numEq-dim) + dofIdxGlobal*dim + j][0] <<" ";
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int vIdxGlobal = this->dofMapper().index(entity);
#else
int vIdxGlobal = this->dofMapper().map(entity);
#endif
if (!outStream.good())
DUNE_THROW(Dune::IOError, "Could not serialize vertex " << vIdxGlobal);
}
......@@ -192,7 +201,11 @@ public:
template<class Entity>
void deserializeEntity(std::istream &inStream, const Entity &entity)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int dofIdxGlobal = this->dofMapper().index(entity);
#else
int dofIdxGlobal = this->dofMapper().map(entity);
#endif
if (!inStream.good()){
DUNE_THROW(Dune::IOError,
......@@ -356,7 +369,11 @@ public:
typedef typename ScalarDispLFS::Traits::FiniteElementType::Traits::LocalBasisType::Traits::JacobianType JacobianType_V;
typedef typename ScalarDispLFS::Traits::FiniteElementType::Traits::LocalBasisType::Traits::RangeFieldType RF;
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
unsigned int eIdx = this->problem_().model().elementMapper().index(*eIt);
#else
unsigned int eIdx = this->problem_().model().elementMapper().map(*eIt);
#endif
rank[eIdx] = this->gridView_().comm().rank();
fvGeometry.update(this->gridView_(), *eIt);
......@@ -371,8 +388,11 @@ public:
for (int scvIdx = 0; scvIdx < numScv; ++scvIdx)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
unsigned int vIdxGlobal = this->dofMapper().subIndex(*eIt, scvIdx, dim);
#else
unsigned int vIdxGlobal = this->dofMapper().map(*eIt, scvIdx, dim);
#endif
Te[vIdxGlobal] = elemVolVars[scvIdx].temperature();
pw[vIdxGlobal] = elemVolVars[scvIdx].pressure(wPhaseIdx);
......
......@@ -126,7 +126,11 @@ public:
{
if(eIt->partitionType() == Dune::InteriorEntity)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int eIdx = this->problem_().model().elementMapper().index(*eIt);
#else
int eIdx = this->problem_().model().elementMapper().map(*eIt);
#endif
rank[eIdx] = this->gridView_().comm().rank();
fvGeometry.update(this->gridView_(), *eIt);
......@@ -134,7 +138,11 @@ public:
for (int scvIdx = 0; scvIdx < fvGeometry.numScv; ++scvIdx)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int vIdxGlobal = this->dofMapper().subIndex(*eIt, scvIdx, dim);
#else
int vIdxGlobal = this->dofMapper().map(*eIt, scvIdx, dim);
#endif
volVars.update(sol[vIdxGlobal],
this->problem_(),
......
......@@ -27,6 +27,7 @@
#ifndef DUMUX_1P_MODEL_HH
#define DUMUX_1P_MODEL_HH
#include <dune/common/version.hh>
#include <dumux/implicit/common/implicitvelocityoutput.hh>
#include "1pproperties.hh"
......@@ -107,7 +108,11 @@ public:
{
if(eIt->partitionType() == Dune::InteriorEntity)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int eIdx = this->problem_().model().elementMapper().index(*eIt);
#else
int eIdx = this->problem_().model().elementMapper().map(*eIt);
#endif
(*rank)[eIdx] = this->gridView_().comm().rank();
FVElementGeometry fvGeometry;
......@@ -121,7 +126,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
const SpatialParams &spatialParams = this->problem_().spatialParams();
......
......@@ -25,6 +25,8 @@
#ifndef DUMUX_2P2C_MODEL_HH
#define DUMUX_2P2C_MODEL_HH
#include <dune/common/version.hh>
#include "2p2cproperties.hh"
#include "2p2cindices.hh"
#include <dumux/implicit/common/implicitvelocityoutput.hh>
......@@ -162,7 +164,11 @@ public:
{
if (!isBox) // i.e. cell-centered discretization
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int eIdxGlobal = this->dofMapper().index(*eIt);
#else
int eIdxGlobal = this->dofMapper().map(*eIt);
#endif