From f56916b2ff76d093d8334ec96c4790859cebb7b0 Mon Sep 17 00:00:00 2001
From: Kilian Weishaupt <kilian.weishaupt@iws.uni-stuttgart.de>
Date: Fri, 15 Dec 2017 17:44:49 +0100
Subject: [PATCH] [navierstokes] Adapt indices

* add method to determine the velocity index for a given direction
---
 dumux/freeflow/navierstokes/indices.hh | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/dumux/freeflow/navierstokes/indices.hh b/dumux/freeflow/navierstokes/indices.hh
index 165ec691c4..5a72bc66d8 100644
--- a/dumux/freeflow/navierstokes/indices.hh
+++ b/dumux/freeflow/navierstokes/indices.hh
@@ -55,11 +55,15 @@ struct NavierStokesCommonIndices
     static constexpr int momentumXBalanceIdx = momentumBalanceIdx; //!< Index of the momentum balance equation
     static constexpr int momentumYBalanceIdx = momentumBalanceIdx + 1; //!< Index of the momentum balance equation
     static constexpr int momentumZBalanceIdx = momentumBalanceIdx + 2; //!< Index of the momentum balance equation
-    static constexpr int velocityIdx = momentumBalanceIdx; //!< Index of the velocity in a solution vector
-    static constexpr int velocityXIdx = velocityIdx; //!< Index of the velocity in a solution vector
-    static constexpr int velocityYIdx = velocityIdx + 1; //!< Index of the velocity in a solution vector
-    static constexpr int velocityZIdx = velocityIdx + 2; //!< Index of the velocity in a solution vector
 
+    static constexpr int velocityXIdx = momentumBalanceIdx; //!< Index of the velocity in a solution vector
+    static constexpr int velocityYIdx = momentumBalanceIdx + 1; //!< Index of the velocity in a solution vector
+    static constexpr int velocityZIdx = momentumBalanceIdx + 2; //!< Index of the velocity in a solution vector
+
+    static constexpr int velocity(int dirIdx) //!< Index of the velocity in a solution vector given a certain dimension
+    {
+        return dirIdx + momentumBalanceIdx;
+    }
 };
 
 // \}
-- 
GitLab