From 23cc59b2129ed340e801260b67bb15b63b689dbd Mon Sep 17 00:00:00 2001
From: Sina Ackermann <sina.ackermann@iws.uni-stuttgart.de>
Date: Wed, 31 May 2017 12:02:22 +0200
Subject: [PATCH] [cc] Replace index() by dofIndex()

---
 .../cellcentered/globalvolumevariables.hh          |  2 +-
 .../cellcentered/mpfa/elementvolumevariables.hh    |  8 ++++----
 .../cellcentered/mpfa/globalvolumevariables.hh     |  2 +-
 .../cellcentered/subcontrolvolume.hh               |  8 +-------
 .../cellcentered/tpfa/elementvolumevariables.hh    | 14 +++++++-------
 .../staggered/elementvolumevariables.hh            |  8 ++++----
 .../staggered/globalvolumevariables.hh             |  2 +-
 dumux/implicit/cellcentered/localjacobian.hh       |  2 +-
 dumux/implicit/staggered/localjacobian.hh          |  2 +-
 .../cellcentered/tpfa/test_tpfafvgeometry.cc       |  2 +-
 test/discretization/staggered/test_staggered.cc    |  2 +-
 11 files changed, 23 insertions(+), 29 deletions(-)

diff --git a/dumux/discretization/cellcentered/globalvolumevariables.hh b/dumux/discretization/cellcentered/globalvolumevariables.hh
index 8a0a4ef294..8f0b1603a7 100644
--- a/dumux/discretization/cellcentered/globalvolumevariables.hh
+++ b/dumux/discretization/cellcentered/globalvolumevariables.hh
@@ -76,7 +76,7 @@ public:
             fvGeometry.bindElement(element);
 
             for (auto&& scv : scvs(fvGeometry))
-                volumeVariables_[scv.index()].update(problem.model().elementSolution(element, sol),
+                volumeVariables_[scv.dofIndex()].update(problem.model().elementSolution(element, sol),
                                                      problem,
                                                      element,
                                                      scv);
diff --git a/dumux/discretization/cellcentered/mpfa/elementvolumevariables.hh b/dumux/discretization/cellcentered/mpfa/elementvolumevariables.hh
index e0470acfc4..7c7adbe759 100644
--- a/dumux/discretization/cellcentered/mpfa/elementvolumevariables.hh
+++ b/dumux/discretization/cellcentered/mpfa/elementvolumevariables.hh
@@ -59,7 +59,7 @@ public:
     : globalVolVarsPtr_(&globalVolVars) {}
 
     const VolumeVariables& operator [](const SubControlVolume& scv) const
-    { return globalVolVars().volVars(scv.index()); }
+    { return globalVolVars().volVars(scv.dofIndex()); }
 
     // operator for the access with an index
     // needed for cc methods for the access to the boundary volume variables
@@ -271,14 +271,14 @@ public:
                                    globalVolVars().problem_(),
                                    element,
                                    scv);
-        volVarIndices_[0] = scv.index();
+        volVarIndices_[0] = scv.dofIndex();
     }
 
     const VolumeVariables& operator [](const SubControlVolume& scv) const
-    { return volumeVariables_[getLocalIdx_(scv.index())]; }
+    { return volumeVariables_[getLocalIdx_(scv.dofIndex())]; }
 
     VolumeVariables& operator [](const SubControlVolume& scv)
-    { return volumeVariables_[getLocalIdx_(scv.index())]; }
+    { return volumeVariables_[getLocalIdx_(scv.dofIndex())]; }
 
     const VolumeVariables& operator [](IndexType scvIdx) const
     { return volumeVariables_[getLocalIdx_(scvIdx)]; }
diff --git a/dumux/discretization/cellcentered/mpfa/globalvolumevariables.hh b/dumux/discretization/cellcentered/mpfa/globalvolumevariables.hh
index 54ce225e4d..617301cb09 100644
--- a/dumux/discretization/cellcentered/mpfa/globalvolumevariables.hh
+++ b/dumux/discretization/cellcentered/mpfa/globalvolumevariables.hh
@@ -77,7 +77,7 @@ public:
             fvGeometry.bindElement(element);
 
             for (auto&& scv : scvs(fvGeometry))
-                volumeVariables_[scv.index()].update(problem.model().elementSolution(element, sol),
+                volumeVariables_[scv.dofIndex()].update(problem.model().elementSolution(element, sol),
                                                      problem, element, scv);
 
             // handle the boundary volume variables
diff --git a/dumux/discretization/cellcentered/subcontrolvolume.hh b/dumux/discretization/cellcentered/subcontrolvolume.hh
index 01957c3483..711075fd72 100644
--- a/dumux/discretization/cellcentered/subcontrolvolume.hh
+++ b/dumux/discretization/cellcentered/subcontrolvolume.hh
@@ -99,13 +99,7 @@ public:
         return geometry_.value();
     }
 
-    //! The global index of this scv
-    IndexType index() const
-    {
-        return elementIndex();
-    }
-
-    //! The index of the dof this scv is embedded in
+    //! The index of the dof this scv is embedded in (the global index of this scv)
     IndexType dofIndex() const
     {
         return elementIndex();
diff --git a/dumux/discretization/cellcentered/tpfa/elementvolumevariables.hh b/dumux/discretization/cellcentered/tpfa/elementvolumevariables.hh
index 8a6c442dc8..87819ed645 100644
--- a/dumux/discretization/cellcentered/tpfa/elementvolumevariables.hh
+++ b/dumux/discretization/cellcentered/tpfa/elementvolumevariables.hh
@@ -59,7 +59,7 @@ public:
     : globalVolVarsPtr_(&globalVolVars) {}
 
     const VolumeVariables& operator [](const SubControlVolume& scv) const
-    { return globalVolVars().volVars(scv.index()); }
+    { return globalVolVars().volVars(scv.dofIndex()); }
 
     // operator for the access with an index
     // needed for cc methods for the access to the boundary volume variables
@@ -135,7 +135,7 @@ public:
                                           problem,
                                           element,
                                           scvI);
-        volVarIndices_[localIdx] = scvI.index();
+        volVarIndices_[localIdx] = scvI.dofIndex();
         ++localIdx;
 
         // Update the volume variables of the neighboring elements
@@ -147,7 +147,7 @@ public:
                                               problem,
                                               elementJ,
                                               scvJ);
-            volVarIndices_[localIdx] = scvJ.index();
+            volVarIndices_[localIdx] = scvJ.dofIndex();
             ++localIdx;
         }
 
@@ -191,7 +191,7 @@ public:
                                                   problem,
                                                   elementJ,
                                                   scvJ);
-                volVarIndices_[localIdx] = scvJ.index();
+                volVarIndices_[localIdx] = scvJ.dofIndex();
                 ++localIdx;
             }
         }
@@ -215,14 +215,14 @@ public:
                                    globalVolVars().problem_(),
                                    element,
                                    scv);
-        volVarIndices_[0] = scv.index();
+        volVarIndices_[0] = scv.dofIndex();
     }
 
     const VolumeVariables& operator [](const SubControlVolume& scv) const
-    { return volumeVariables_[getLocalIdx_(scv.index())]; }
+    { return volumeVariables_[getLocalIdx_(scv.dofIndex())]; }
 
     VolumeVariables& operator [](const SubControlVolume& scv)
-    { return volumeVariables_[getLocalIdx_(scv.index())]; }
+    { return volumeVariables_[getLocalIdx_(scv.dofIndex())]; }
 
     const VolumeVariables& operator [](IndexType scvIdx) const
     { return volumeVariables_[getLocalIdx_(scvIdx)]; }
diff --git a/dumux/discretization/staggered/elementvolumevariables.hh b/dumux/discretization/staggered/elementvolumevariables.hh
index 0e8e873997..48bd0e8c9b 100644
--- a/dumux/discretization/staggered/elementvolumevariables.hh
+++ b/dumux/discretization/staggered/elementvolumevariables.hh
@@ -58,7 +58,7 @@ public:
     : globalVolVarsPtr_(&globalVolVars) {}
 
     const VolumeVariables& operator [](const SubControlVolume& scv) const
-    { return globalVolVars().volVars(scv.index()); }
+    { return globalVolVars().volVars(scv.dofIndex()); }
 
     // operator for the access with an index
     // needed for Staggered methods for the access to the boundary volume variables
@@ -177,14 +177,14 @@ public:
         // update the volume variables of the element
         auto&& scv = fvGeometry.scv(eIdx);
         volumeVariables_[0].update(sol[eIdx], globalVolVars().problem_(), element, scv);
-        volVarIndices_[0] = scv.index();
+        volVarIndices_[0] = scv.dofIndex();
     }
 
     const VolumeVariables& operator [](const SubControlVolume& scv) const
-    { return volumeVariables_[getLocalIdx_(scv.index())]; }
+    { return volumeVariables_[getLocalIdx_(scv.dofIndex())]; }
 
     VolumeVariables& operator [](const SubControlVolume& scv)
-    { return volumeVariables_[getLocalIdx_(scv.index())]; }
+    { return volumeVariables_[getLocalIdx_(scv.dofIndex())]; }
 
     const VolumeVariables& operator [](IndexType scvIdx) const
     { return volumeVariables_[getLocalIdx_(scvIdx)]; }
diff --git a/dumux/discretization/staggered/globalvolumevariables.hh b/dumux/discretization/staggered/globalvolumevariables.hh
index 1510817e64..55b206bc46 100644
--- a/dumux/discretization/staggered/globalvolumevariables.hh
+++ b/dumux/discretization/staggered/globalvolumevariables.hh
@@ -89,7 +89,7 @@ public:
                 PrimaryVariables priVars(0.0);
                 priVars[cellCenterIdx] = sol[cellCenterIdx][scv.dofIndex()];
                 ElementSolutionVector elemSol{std::move(priVars)};
-                volumeVariables_[scv.index()].update(elemSol, problem, element, scv);
+                volumeVariables_[scv.dofIndex()].update(elemSol, problem, element, scv);
             }
 
             // handle the boundary volume variables
diff --git a/dumux/implicit/cellcentered/localjacobian.hh b/dumux/implicit/cellcentered/localjacobian.hh
index da7b6dd878..414fc98d67 100644
--- a/dumux/implicit/cellcentered/localjacobian.hh
+++ b/dumux/implicit/cellcentered/localjacobian.hh
@@ -481,7 +481,7 @@ protected:
     template<class T = TypeTag>
     typename std::enable_if<GET_PROP_VALUE(T, EnableGlobalVolumeVariablesCache), VolumeVariables>::type&
     getCurVolVars(ElementVolumeVariables& elemVolVars, const SubControlVolume& scv)
-    { return this->model_().nonConstCurGlobalVolVars().volVars(scv.index()); }
+    { return this->model_().nonConstCurGlobalVolVars().volVars(scv.dofIndex()); }
 
     //! When global volume variables caching is disabled, return the local volvar object
     template<class T = TypeTag>
diff --git a/dumux/implicit/staggered/localjacobian.hh b/dumux/implicit/staggered/localjacobian.hh
index dc53aa06c7..cf04d2e551 100644
--- a/dumux/implicit/staggered/localjacobian.hh
+++ b/dumux/implicit/staggered/localjacobian.hh
@@ -554,7 +554,7 @@ protected:
     template<class T = TypeTag>
     typename std::enable_if<GET_PROP_VALUE(T, EnableGlobalVolumeVariablesCache), VolumeVariables>::type&
     getCurVolVars(ElementVolumeVariables& elemVolVars, const SubControlVolume& scv)
-    { return this->model_().nonConstCurGlobalVolVars().volVars(scv.index()); }
+    { return this->model_().nonConstCurGlobalVolVars().volVars(scv()); }
 
     //! When global volume variables caching is disabled, return the local volvar object
     template<class T = TypeTag>
diff --git a/test/discretization/cellcentered/tpfa/test_tpfafvgeometry.cc b/test/discretization/cellcentered/tpfa/test_tpfafvgeometry.cc
index c3ab1a1a1c..e6f5a1fa7b 100644
--- a/test/discretization/cellcentered/tpfa/test_tpfafvgeometry.cc
+++ b/test/discretization/cellcentered/tpfa/test_tpfafvgeometry.cc
@@ -124,7 +124,7 @@ int main (int argc, char *argv[]) try
 
         for (auto&& scv : scvs(fvGeometry))
         {
-            std::cout << "-- scv " << scv.index() << " center at: " << scv.center() << std::endl;
+            std::cout << "-- scv " << scv.dofIndex() << " center at: " << scv.center() << std::endl;
         }
 
         auto range2 = scvfs(fvGeometry);
diff --git a/test/discretization/staggered/test_staggered.cc b/test/discretization/staggered/test_staggered.cc
index d07d35e55d..6e26dcd3cb 100644
--- a/test/discretization/staggered/test_staggered.cc
+++ b/test/discretization/staggered/test_staggered.cc
@@ -132,7 +132,7 @@ int main (int argc, char *argv[]) try
 
         for (auto&& scv : scvs(fvGeometry))
         {
-            std::cout << "-- scv " << scv.index() << " center at: " << scv.center() << std::endl;
+            std::cout << "-- scv " << scv.dofIndex() << " center at: " << scv.center() << std::endl;
         }
 
         auto range2 = scvfs(fvGeometry);
-- 
GitLab