diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dinteractionvolumecontainer.hh b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dinteractionvolumecontainer.hh index 2dc3b727cf5023669c9674bb3b4b5f7686249d39..2ae6eb6297d01d175b15a3d1c130527fb59dd88c 100644 --- a/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dinteractionvolumecontainer.hh +++ b/dumux/decoupled/2p/diffusion/fvmpfa/lmethod/fvmpfal3dinteractionvolumecontainer.hh @@ -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]; diff --git a/dumux/decoupled/2p/impes/gridadaptionindicator2p.hh b/dumux/decoupled/2p/impes/gridadaptionindicator2p.hh index 22e9dd7b401edd6ce570114473994b99b3908249..c6065a179471ef79f5d116d12301d0dc013e7e79 100644 --- a/dumux/decoupled/2p/impes/gridadaptionindicator2p.hh +++ b/dumux/decoupled/2p/impes/gridadaptionindicator2p.hh @@ -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*/ diff --git a/dumux/decoupled/common/variableclass.hh b/dumux/decoupled/common/variableclass.hh index 75894b1e72d12c6dfe9d998447847223e169e958..c9f5930a71c16059cf3a8099767e8923e0e4d0fa 100644 --- a/dumux/decoupled/common/variableclass.hh +++ b/dumux/decoupled/common/variableclass.hh @@ -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 diff --git a/dumux/implicit/common/implicitmodel.hh b/dumux/implicit/common/implicitmodel.hh index ff720d9d087c79a58336a42373910d57bfb300df..39bd935d718dad79ecb175ecd3e2f3caeb749315 100644 --- a/dumux/implicit/common/implicitmodel.hh +++ b/dumux/implicit/common/implicitmodel.hh @@ -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; } } diff --git a/dumux/io/vtknestedfunction.hh b/dumux/io/vtknestedfunction.hh index 3daff286f66628fb9290f0e9af2274fdf3994a40..bc316e2f90296f7acedd0d3992659e2da300d4de 100644 --- a/dumux/io/vtknestedfunction.hh +++ b/dumux/io/vtknestedfunction.hh @@ -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, diff --git a/dumux/linear/vectorexchange.hh b/dumux/linear/vectorexchange.hh index 84331c06624ac95e883fc03a1abb03762b7c7aef..53955a005357ac957596d26461a4a0dfb8b80828 100644 --- a/dumux/linear/vectorexchange.hh +++ b/dumux/linear/vectorexchange.hh @@ -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