diff --git a/dumux/implicit/2p/2pmodel.hh b/dumux/implicit/2p/2pmodel.hh index b1e15141b5ba31345160a977a85dbe28545184eb..ac902213f728916de9900a74599c606cb06ac37c 100644 --- a/dumux/implicit/2p/2pmodel.hh +++ b/dumux/implicit/2p/2pmodel.hh @@ -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); diff --git a/dumux/implicit/box/boxassembler.hh b/dumux/implicit/box/boxassembler.hh index 5e79e0376c06aa5ab1c94c07ef1e1436f335ab0a..e4ecf0d16faeb14e3fbca847ab89f29215d5976f 100644 --- a/dumux/implicit/box/boxassembler.hh +++ b/dumux/implicit/box/boxassembler.hh @@ -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) diff --git a/dumux/implicit/box/boxelementvolumevariables.hh b/dumux/implicit/box/boxelementvolumevariables.hh index 6fb3c03ff8da2aafc2e37ca0e5466a00655ee35a..773b5abf3317167bde29346268e3dac918cff0d5 100644 --- a/dumux/implicit/box/boxelementvolumevariables.hh +++ b/dumux/implicit/box/boxelementvolumevariables.hh @@ -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); diff --git a/dumux/implicit/cellcentered/ccassembler.hh b/dumux/implicit/cellcentered/ccassembler.hh index 228b9ca708c1fac0c70a8a6a52679f7e88e042ed..a5938280c12f1d06a29163096bc03235b33d2082 100644 --- a/dumux/implicit/cellcentered/ccassembler.hh +++ b/dumux/implicit/cellcentered/ccassembler.hh @@ -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; diff --git a/dumux/implicit/cellcentered/ccelementvolumevariables.hh b/dumux/implicit/cellcentered/ccelementvolumevariables.hh index 28b485d5762dc158943af7cd5ed41d6b1c8487e2..a5c52fab27ca5041f62e2dd3401575e225e7f622 100644 --- a/dumux/implicit/cellcentered/ccelementvolumevariables.hh +++ b/dumux/implicit/cellcentered/ccelementvolumevariables.hh @@ -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); diff --git a/dumux/implicit/common/implicitassembler.hh b/dumux/implicit/common/implicitassembler.hh index 4748ebe332615aa58bcb0463443bc8b07c765d06..5a00da73e2d47bee20a87f06ea0d7d90f7860a13 100644 --- a/dumux/implicit/common/implicitassembler.hh +++ b/dumux/implicit/common/implicitassembler.hh @@ -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]; } diff --git a/dumux/implicit/common/implicitlocaljacobian.hh b/dumux/implicit/common/implicitlocaljacobian.hh index 4f9c6c395d0dd5e67ed959b4e250737890dd220d..10c495ae903033ab1356fe9bb948b4fb469e691b 100644 --- a/dumux/implicit/common/implicitlocaljacobian.hh +++ b/dumux/implicit/common/implicitlocaljacobian.hh @@ -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]); diff --git a/dumux/implicit/common/implicitvelocityoutput.hh b/dumux/implicit/common/implicitvelocityoutput.hh index 7354736a6f4cd62a16711887189a00949e4bb4fc..5466be50cd78dc4f445da702b8b2926585f23941 100644 --- a/dumux/implicit/common/implicitvelocityoutput.hh +++ b/dumux/implicit/common/implicitvelocityoutput.hh @@ -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; } diff --git a/dumux/implicit/nonisothermal/nimodel.hh b/dumux/implicit/nonisothermal/nimodel.hh index 18b99fa06f872321cee12b8a792d41204cd3d418..4a4bb5472b727d718d50ea65c3e7f6c39bebd959 100644 --- a/dumux/implicit/nonisothermal/nimodel.hh +++ b/dumux/implicit/nonisothermal/nimodel.hh @@ -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(); } }