Skip to content
Snippets Groups Projects
Commit 83bc14e0 authored by Christoph Grüninger's avatar Christoph Grüninger
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
No related branches found
No related tags found
No related merge requests found
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
#ifndef DUMUX_FVMPFAL3D_INTERACTIONVOLUMECONTAINER_HH #ifndef DUMUX_FVMPFAL3D_INTERACTIONVOLUMECONTAINER_HH
#define DUMUX_FVMPFAL3D_INTERACTIONVOLUMECONTAINER_HH #define DUMUX_FVMPFAL3D_INTERACTIONVOLUMECONTAINER_HH
#include <dune/common/version.hh>
// dumux environment // dumux environment
#include <dumux/decoupled/common/pressureproperties.hh> #include <dumux/decoupled/common/pressureproperties.hh>
#include <dumux/decoupled/common/fv/mpfa/fvmpfaproperties.hh> #include <dumux/decoupled/common/fv/mpfa/fvmpfaproperties.hh>
...@@ -319,7 +321,39 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeSubVolumeElements(const ...@@ -319,7 +321,39 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeSubVolumeElements(const
std::vector < std::vector<int> >& elemVertMap) std::vector < std::vector<int> >& elemVertMap)
{ {
int eIdxGlobal = problem_.variables().index(element); 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); int vIdxGlobal = problem_.variables().vertexMapper().map(element, 0, dim);
interactionVolumes_[vIdxGlobal].setSubVolumeElement(element, 7); interactionVolumes_[vIdxGlobal].setSubVolumeElement(element, 7);
elemVertMap[vIdxGlobal][7] = eIdxGlobal; elemVertMap[vIdxGlobal][7] = eIdxGlobal;
...@@ -351,6 +385,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeSubVolumeElements(const ...@@ -351,6 +385,7 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeSubVolumeElements(const
vIdxGlobal = problem_.variables().vertexMapper().map(element, 7, dim); vIdxGlobal = problem_.variables().vertexMapper().map(element, 7, dim);
interactionVolumes_[vIdxGlobal].setSubVolumeElement(element, 0); interactionVolumes_[vIdxGlobal].setSubVolumeElement(element, 0);
elemVertMap[vIdxGlobal][0] = eIdxGlobal; elemVertMap[vIdxGlobal][0] = eIdxGlobal;
#endif
} }
/*! \brief Stores information with respect to DUNE intersections in the interaction volumes /*! \brief Stores information with respect to DUNE intersections in the interaction volumes
...@@ -418,7 +453,11 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeIntersectionInfo(const E ...@@ -418,7 +453,11 @@ void FvMpfaL3dInteractionVolumeContainer<TypeTag>::storeIntersectionInfo(const E
{ {
int localVertIdx = referenceElement.subEntity(indexInInside, 1, i, dim); 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); int vIdxGlobal = problem_.variables().vertexMapper().map(element, localVertIdx, dim);
#endif
InteractionVolume& interactionVolume = interactionVolumes_[vIdxGlobal]; InteractionVolume& interactionVolume = interactionVolumes_[vIdxGlobal];
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
#ifndef DUMUX_GRIDADAPTIONINDICATOR2P_HH #ifndef DUMUX_GRIDADAPTIONINDICATOR2P_HH
#define DUMUX_GRIDADAPTIONINDICATOR2P_HH #define DUMUX_GRIDADAPTIONINDICATOR2P_HH
#include <dune/common/version.hh>
#include <dumux/decoupled/common/impetproperties.hh> #include <dumux/decoupled/common/impetproperties.hh>
#include <dumux/decoupled/2p/2pproperties.hh> #include <dumux/decoupled/2p/2pproperties.hh>
#include <dumux/linear/vectorexchange.hh> #include <dumux/linear/vectorexchange.hh>
...@@ -165,7 +167,11 @@ public: ...@@ -165,7 +167,11 @@ public:
*/ */
bool refine(const Element& element) 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_); return (indicatorVector_[problem_.elementMapper().map(element)] > refineBound_);
#endif
} }
/*! \brief Indicator function for marking of grid cells for coarsening /*! \brief Indicator function for marking of grid cells for coarsening
...@@ -176,7 +182,11 @@ public: ...@@ -176,7 +182,11 @@ public:
*/ */
bool coarsen(const Element& element) 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_); return (indicatorVector_[problem_.elementMapper().map(element)] < coarsenBound_);
#endif
} }
/*! \brief Initializes the adaption indicator class*/ /*! \brief Initializes the adaption indicator class*/
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
#ifndef DUMUX_VARIABLECLASS_HH #ifndef DUMUX_VARIABLECLASS_HH
#define DUMUX_VARIABLECLASS_HH #define DUMUX_VARIABLECLASS_HH
#include <dune/common/version.hh>
#include "decoupledproperties.hh" #include "decoupledproperties.hh"
// for parallelization // for parallelization
...@@ -137,7 +139,11 @@ public: ...@@ -137,7 +139,11 @@ public:
*/ */
int index(const Element& element) const int index(const Element& element) const
{ {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
return elementMapper_.index(element);
#else
return elementMapper_.map(element); return elementMapper_.map(element);
#endif
} }
//! Get index of vertex (codim dim entity) //! Get index of vertex (codim dim entity)
...@@ -147,7 +153,11 @@ public: ...@@ -147,7 +153,11 @@ public:
*/ */
int index(const Vertex& vertex) const int index(const Vertex& vertex) const
{ {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
return vertexMapper_.index(vertex);
#else
return vertexMapper_.map(vertex); return vertexMapper_.map(vertex);
#endif
} }
//!Return gridView //!Return gridView
......
...@@ -143,8 +143,13 @@ public: ...@@ -143,8 +143,13 @@ public:
#endif #endif
prevVolVars.resize(n); prevVolVars.resize(n);
curVolVars.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); int vIdxGlobal = vertexMapper().map(element, i, dim);
#endif
if (!hintsUsable_[vIdxGlobal]) { if (!hintsUsable_[vIdxGlobal]) {
curVolVars[i].setHint(NULL); curVolVars[i].setHint(NULL);
...@@ -169,8 +174,13 @@ public: ...@@ -169,8 +174,13 @@ public:
int n = element.template count<dim>(); int n = element.template count<dim>();
#endif #endif
curVolVars.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); int vIdxGlobal = vertexMapper().map(element, i, dim);
#endif
if (!hintsUsable_[vIdxGlobal]) if (!hintsUsable_[vIdxGlobal])
curVolVars[i].setHint(NULL); curVolVars[i].setHint(NULL);
...@@ -193,8 +203,13 @@ public: ...@@ -193,8 +203,13 @@ public:
if (!isBox || !enableHints_) if (!isBox || !enableHints_)
return; 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); int vIdxGlobal = vertexMapper().map(element, i, dim);
#endif
curHints_[vIdxGlobal] = elemVolVars[i]; curHints_[vIdxGlobal] = elemVolVars[i];
if (!hintsUsable_[vIdxGlobal]) if (!hintsUsable_[vIdxGlobal])
prevHints_[vIdxGlobal] = elemVolVars[i]; prevHints_[vIdxGlobal] = elemVolVars[i];
...@@ -238,17 +253,23 @@ public: ...@@ -238,17 +253,23 @@ public:
if (isBox) if (isBox)
{ {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4) #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 #else
for (int i = 0; i < eIt->template count<dim>(); ++i) { for (int i = 0; i < eIt->template count<dim>(); ++i) {
#endif
int globalI = vertexMapper().map(*eIt, i, dim); int globalI = vertexMapper().map(*eIt, i, dim);
#endif
residual[globalI] += localResidual().residual(i); residual[globalI] += localResidual().residual(i);
} }
} }
else else
{ {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int globalI = elementMapper().index(*eIt);
#else
int globalI = elementMapper().map(*eIt); int globalI = elementMapper().map(*eIt);
#endif
residual[globalI] = localResidual().residual(0); residual[globalI] = localResidual().residual(0);
} }
} }
...@@ -559,8 +580,12 @@ public: ...@@ -559,8 +580,12 @@ public:
void serializeEntity(std::ostream &outstream, void serializeEntity(std::ostream &outstream,
const Entity &entity) const Entity &entity)
{ {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int dofIdxGlobal = dofMapper().index(entity);
#else
int dofIdxGlobal = dofMapper().map(entity); int dofIdxGlobal = dofMapper().map(entity);
#endif
// write phase state // write phase state
if (!outstream.good()) { if (!outstream.good()) {
DUNE_THROW(Dune::IOError, DUNE_THROW(Dune::IOError,
...@@ -587,7 +612,11 @@ public: ...@@ -587,7 +612,11 @@ public:
void deserializeEntity(std::istream &instream, void deserializeEntity(std::istream &instream,
const Entity &entity) const Entity &entity)
{ {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int dofIdxGlobal = dofMapper().index(entity);
#else
int dofIdxGlobal = dofMapper().map(entity); int dofIdxGlobal = dofMapper().map(entity);
#endif
for (int eqIdx = 0; eqIdx < numEq; ++eqIdx) { for (int eqIdx = 0; eqIdx < numEq; ++eqIdx) {
if (!instream.good()) if (!instream.good())
...@@ -797,7 +826,11 @@ public: ...@@ -797,7 +826,11 @@ public:
bool onBoundary(const Element &element, const int vIdx) const bool onBoundary(const Element &element, const int vIdx) const
{ {
if (isBox) 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)); return onBoundary(vertexMapper().map(element, vIdx, dim));
#endif
else else
DUNE_THROW(Dune::InvalidStateException, DUNE_THROW(Dune::InvalidStateException,
"requested for cell-centered model"); "requested for cell-centered model");
...@@ -814,7 +847,12 @@ public: ...@@ -814,7 +847,12 @@ public:
bool onBoundary(const Element &element) const bool onBoundary(const Element &element) const
{ {
if (!isBox) if (!isBox)
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
return onBoundary(elementMapper().index(element));
#else
return onBoundary(elementMapper().map(element)); return onBoundary(elementMapper().map(element));
#endif
else else
DUNE_THROW(Dune::InvalidStateException, DUNE_THROW(Dune::InvalidStateException,
"requested for box model"); "requested for box model");
...@@ -895,7 +933,11 @@ protected: ...@@ -895,7 +933,11 @@ protected:
for (int scvIdx = 0; scvIdx < fvGeometry.numScv; scvIdx++) for (int scvIdx = 0; scvIdx < fvGeometry.numScv; scvIdx++)
{ {
// get the global index of the degree of freedom // 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); int dofIdxGlobal = dofMapper().map(*eIt, scvIdx, dofCodim);
#endif
// let the problem do the dirty work of nailing down // let the problem do the dirty work of nailing down
// the initial solution. // the initial solution.
...@@ -977,16 +1019,24 @@ protected: ...@@ -977,16 +1019,24 @@ protected:
++faceVertexIdx) ++faceVertexIdx)
{ {
int vIdx = refElement.subEntity(fIdx, int vIdx = refElement.subEntity(fIdx,
1, 1,
faceVertexIdx, faceVertexIdx,
dim); dim);
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int vIdxGlobal = vertexMapper().subIndex(*eIt, vIdx, dim);
#else
int vIdxGlobal = vertexMapper().map(*eIt, vIdx, dim); int vIdxGlobal = vertexMapper().map(*eIt, vIdx, dim);
#endif
boundaryIndices_[vIdxGlobal] = true; boundaryIndices_[vIdxGlobal] = true;
} }
} }
else else
{ {
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
int eIdxGlobal = elementMapper().index(*eIt);
#else
int eIdxGlobal = elementMapper().map(*eIt); int eIdxGlobal = elementMapper().map(*eIt);
#endif
boundaryIndices_[eIdxGlobal] = true; boundaryIndices_[eIdxGlobal] = true;
} }
} }
......
...@@ -75,7 +75,11 @@ public: ...@@ -75,7 +75,11 @@ public:
int idx; int idx;
if (codim_ == 0) { if (codim_ == 0) {
// cells. map element to the index // cells. map element to the index
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
idx = mapper_.index(element);
#else
idx = mapper_.map(element); idx = mapper_.map(element);
#endif
} }
else if (codim_ == dim) { else if (codim_ == dim) {
// find vertex which is closest to xi in local // find vertex which is closest to xi in local
...@@ -101,7 +105,11 @@ public: ...@@ -101,7 +105,11 @@ public:
} }
// map vertex to an index // 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_); idx = mapper_.map(element, imin, codim_);
#endif
} }
else else
DUNE_THROW(Dune::InvalidStateException, DUNE_THROW(Dune::InvalidStateException,
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#ifndef DUMUX_VECTOR_EXCHANGE_HH #ifndef DUMUX_VECTOR_EXCHANGE_HH
#define DUMUX_VECTOR_EXCHANGE_HH #define DUMUX_VECTOR_EXCHANGE_HH
#include <dune/common/version.hh>
#include <dune/grid/common/datahandleif.hh> #include <dune/grid/common/datahandleif.hh>
namespace Dumux namespace Dumux
...@@ -65,7 +66,11 @@ public: ...@@ -65,7 +66,11 @@ public:
template<class MessageBuffer, class Entity> template<class MessageBuffer, class Entity>
void gather (MessageBuffer& buff, const Entity& entity) const 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)]); buff.write(dataVector_[mapper_.map(entity)]);
#endif
} }
/*! unpack data from message buffer to user /*! unpack data from message buffer to user
...@@ -77,7 +82,12 @@ public: ...@@ -77,7 +82,12 @@ public:
{ {
DataType x; DataType x;
buff.read(x); buff.read(x);
#if DUNE_VERSION_NEWER(DUNE_COMMON, 2, 4)
dataVector_[mapper_.index(entity)] = x;
#else
dataVector_[mapper_.map(entity)] = x; dataVector_[mapper_.map(entity)] = x;
#endif
} }
//! constructor //! constructor
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment