From 340947db891dddeabb24e9f640a15299b10139a3 Mon Sep 17 00:00:00 2001
From: Lisa Julia Nebel <lisa_julia.nebel@tu-dresden.de>
Date: Tue, 14 Jul 2020 09:55:19 +0200
Subject: [PATCH] Add random access operator and -= operator to realtuple

---
 dune/gfe/realtuple.hh | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/dune/gfe/realtuple.hh b/dune/gfe/realtuple.hh
index 5d47b0d1..c1f52db2 100644
--- a/dune/gfe/realtuple.hh
+++ b/dune/gfe/realtuple.hh
@@ -66,6 +66,17 @@ public:
         return *this;
     }
 
+    RealTuple& operator-=(const Dune::FieldVector<T,N>& other) {
+        data_ -= other;
+        return *this;
+    }
+
+    template <class T2>
+    RealTuple& operator-=(const RealTuple<T2,N>& other) {
+        data_ -= other.data_;
+        return *this;
+    }
+
     /** \brief Assigment from RealTuple with different type -- used for automatic differentiation with ADOL-C */
     template <class T2>
     RealTuple& operator <<= (const RealTuple<T2,N>& other) {
@@ -74,6 +85,11 @@ public:
         return *this;
     }
 
+    /** \brief Const random-access operator*/
+    T operator[] (const size_t indexVariable ) const {
+        return data_[indexVariable];
+    }
+
      /** \brief Rebind the RealTuple to another coordinate type */
     template<class U>
     struct rebind
-- 
GitLab