Commit 83bc14e0 authored by Christoph Grueninger's avatar Christoph Grueninger
Browse files

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

The method is deprecated in 2.4.
More replacements have to follow.
(reviewed by fetzer)


git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@13894 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent ec746164
......@@ -19,6 +19,8 @@
#ifndef DUMUX_FVMPFAL3D_INTERACTIONVOLUMECONTAINER_HH
#define DUMUX_FVMPFAL3D_INTERACTIONVOLUMECONTAINER_HH
#include <dune/common/version.hh>
// dumux environment
#include <dumux/decoupled/common/pressureproperties.hh>
#include <dumux/decoupled/common/fv/mpfa/fvmpfaproperties.hh>
......@@ -319,7 +321,39 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeSubVolumeElements(const
std::vector < std::vector<int> >& elemVertMap)
{
int eIdxGlobal = problem_.variables().index(element);
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int vIdxGlobal = problem_.variables().vertexMapper().subIndex(element, 0, dim);
interactionVolumes_[vIdxGlobal].setSubVolumeElement(element, 7);
elemVertMap[vIdxGlobal][7] = eIdxGlobal;
vIdxGlobal = problem_.variables().vertexMapper().subIndex(element, 1, dim);
interactionVolumes_[vIdxGlobal].setSubVolumeElement(element, 6);
elemVertMap[vIdxGlobal][6] = eIdxGlobal;
vIdxGlobal = problem_.variables().vertexMapper().subIndex(element, 2, dim);
interactionVolumes_[vIdxGlobal].setSubVolumeElement(element, 5);
elemVertMap[vIdxGlobal][5] = eIdxGlobal;
vIdxGlobal = problem_.variables().vertexMapper().subIndex(element, 3, dim);
interactionVolumes_[vIdxGlobal].setSubVolumeElement(element, 4);
elemVertMap[vIdxGlobal][4] = eIdxGlobal;
vIdxGlobal = problem_.variables().vertexMapper().subIndex(element, 4, dim);
interactionVolumes_[vIdxGlobal].setSubVolumeElement(element, 3);
elemVertMap[vIdxGlobal][3] = eIdxGlobal;
vIdxGlobal = problem_.variables().vertexMapper().subIndex(element, 5, dim);
interactionVolumes_[vIdxGlobal].setSubVolumeElement(element, 2);
elemVertMap[vIdxGlobal][2] = eIdxGlobal;
vIdxGlobal = problem_.variables().vertexMapper().subIndex(element, 6, dim);
interactionVolumes_[vIdxGlobal].setSubVolumeElement(element, 1);
elemVertMap[vIdxGlobal][1] = eIdxGlobal;
vIdxGlobal = problem_.variables().vertexMapper().subIndex(element, 7, dim);
interactionVolumes_[vIdxGlobal].setSubVolumeElement(element, 0);
elemVertMap[vIdxGlobal][0] = eIdxGlobal;
#else
int vIdxGlobal = problem_.variables().vertexMapper().map(element, 0, dim);
interactionVolumes_[vIdxGlobal].setSubVolumeElement(element, 7);
elemVertMap[vIdxGlobal][7] = eIdxGlobal;
......@@ -351,6 +385,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeSubVolumeElements(const
vIdxGlobal = problem_.variables().vertexMapper().map(element, 7, dim);
interactionVolumes_[vIdxGlobal].setSubVolumeElement(element, 0);
elemVertMap[vIdxGlobal][0] = eIdxGlobal;
#endif
}
/*! \brief Stores information with respect to DUNE intersections in the interaction volumes
......@@ -418,7 +453,11 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeIntersectionInfo(const E
{
int localVertIdx = referenceElement.subEntity(indexInInside, 1, i, dim);
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int vIdxGlobal = problem_.variables().vertexMapper().subIndex(element, localVertIdx, dim);
#else
int vIdxGlobal = problem_.variables().vertexMapper().map(element, localVertIdx, dim);
#endif
InteractionVolume& interactionVolume = interactionVolumes_[vIdxGlobal];
......
......@@ -19,6 +19,8 @@
#ifndef DUMUX_GRIDADAPTIONINDICATOR2P_HH
#define DUMUX_GRIDADAPTIONINDICATOR2P_HH
#include <dune/common/version.hh>
#include <dumux/decoupled/common/impetproperties.hh>
#include <dumux/decoupled/2p/2pproperties.hh>
#include <dumux/linear/vectorexchange.hh>
......@@ -165,7 +167,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
......@@ -176,7 +182,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*/
......
......@@ -19,6 +19,8 @@
#ifndef DUMUX_VARIABLECLASS_HH
#define DUMUX_VARIABLECLASS_HH
#include <dune/common/version.hh>
#include "decoupledproperties.hh"
// for parallelization
......@@ -137,7 +139,11 @@ public:
*/
int index(const Element& element) const
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
return elementMapper_.index(element);
#else
return elementMapper_.map(element);
#endif
}
//! Get index of vertex (codim dim entity)
......@@ -147,7 +153,11 @@ public:
*/
int index(const Vertex& vertex) const
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
return vertexMapper_.index(vertex);
#else
return vertexMapper_.map(vertex);
#endif
}
//!Return gridView
......
......@@ -143,8 +143,13 @@ public:
#endif
prevVolVars.resize(n);
curVolVars.resize(n);
for (int i = 0; i < n; ++i) {
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);
......@@ -169,8 +174,13 @@ public:
int n = element.template count<dim>();
#endif
curVolVars.resize(n);
for (int i = 0; i < n; ++i) {
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);
......@@ -193,8 +203,13 @@ public:
if (!isBox || !enableHints_)
return;
for (unsigned int i = 0; i < elemVolVars.size(); ++i) {
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];
......@@ -238,17 +253,23 @@ public:
if (isBox)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
for (int i = 0; i < eIt->subEntities(dim); ++i) {
for (int i = 0; i < eIt->subEntities(dim); ++i)
{
int globalI = vertexMapper().subIndex(*eIt, i, dim);
#else
for (int i = 0; i < eIt->template count<dim>(); ++i) {
#endif
int globalI = vertexMapper().map(*eIt, i, dim);
#endif
residual[globalI] += localResidual().residual(i);
}
}
else
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int globalI = elementMapper().index(*eIt);
#else
int globalI = elementMapper().map(*eIt);
#endif
residual[globalI] = localResidual().residual(0);
}
}
......@@ -559,8 +580,12 @@ public:
void serializeEntity(std::ostream &outstream,
const Entity &entity)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int dofIdxGlobal = dofMapper().index(entity);
#else
int dofIdxGlobal = dofMapper().map(entity);
#endif
// write phase state
if (!outstream.good()) {
DUNE_THROW(Dune::IOError,
......@@ -587,7 +612,11 @@ public:
void deserializeEntity(std::istream &instream,
const Entity &entity)
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int dofIdxGlobal = dofMapper().index(entity);
#else
int dofIdxGlobal = dofMapper().map(entity);
#endif
for (int eqIdx = 0; eqIdx < numEq; ++eqIdx) {
if (!instream.good())
......@@ -797,7 +826,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");
......@@ -814,7 +847,12 @@ public:
bool onBoundary(const Element &element) const
{
if (!isBox)
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
return onBoundary(elementMapper().index(element));
#else
return onBoundary(elementMapper().map(element));
#endif
else
DUNE_THROW(Dune::InvalidStateException,
"requested for box model");
......@@ -895,7 +933,11 @@ protected:
for (int scvIdx = 0; scvIdx < fvGeometry.numScv; scvIdx++)
{
// get the global index of the degree of freedom
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int dofIdxGlobal = dofMapper().subIndex(*eIt, scvIdx, dofCodim);
#else
int dofIdxGlobal = dofMapper().map(*eIt, scvIdx, dofCodim);
#endif
// let the problem do the dirty work of nailing down
// the initial solution.
......@@ -977,16 +1019,24 @@ protected:
++faceVertexIdx)
{
int vIdx = refElement.subEntity(fIdx,
1,
faceVertexIdx,
dim);
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;
}
}
......
......@@ -75,7 +75,11 @@ public:
int idx;
if (codim_ == 0) {
// cells. map element to the index
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
idx = mapper_.index(element);
#else
idx = mapper_.map(element);
#endif
}
else if (codim_ == dim) {
// find vertex which is closest to xi in local
......@@ -101,7 +105,11 @@ public:
}
// map vertex to an index
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
idx = mapper_.subIndex(element, imin, codim_);
#else
idx = mapper_.map(element, imin, codim_);
#endif
}
else
DUNE_THROW(Dune::InvalidStateException,
......
......@@ -23,6 +23,7 @@
#ifndef DUMUX_VECTOR_EXCHANGE_HH
#define DUMUX_VECTOR_EXCHANGE_HH
#include <dune/common/version.hh>
#include <dune/grid/common/datahandleif.hh>
namespace Dumux
......@@ -65,7 +66,11 @@ public:
template<class MessageBuffer, class Entity>
void gather (MessageBuffer& buff, const Entity& entity) const
{
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
buff.write(dataVector_[mapper_.index(entity)]);
#else
buff.write(dataVector_[mapper_.map(entity)]);
#endif
}
/*! unpack data from message buffer to user
......@@ -77,7 +82,12 @@ public:
{
DataType x;
buff.read(x);
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
dataVector_[mapper_.index(entity)] = x;
#else
dataVector_[mapper_.map(entity)] = x;
#endif
}
//! constructor
......
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