From d6d843fbc485239677ddbf6102be56a4b54476e4 Mon Sep 17 00:00:00 2001
From: Martin Bauer <martin.bauer@fau.de>
Date: Fri, 20 Jan 2017 16:04:22 +0100
Subject: [PATCH] Bugfix in equationcollection

---
 equationcollection/equationcollection.py | 6 ++++--
 field.py                                 | 3 +++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/equationcollection/equationcollection.py b/equationcollection/equationcollection.py
index 2ea0c2b6f..f6cd8be31 100644
--- a/equationcollection/equationcollection.py
+++ b/equationcollection/equationcollection.py
@@ -171,13 +171,15 @@ class EquationCollection:
                     continue  # exact the same subexpression equation exists already
                 else:
                     # different definition - a new name has to be introduced
-                    newLhs = self.subexpressionSymbolNameGenerator()
+                    newLhs = next(self.subexpressionSymbolNameGenerator)
                     newEq = sp.Eq(newLhs, fastSubs(otherSubexpressionEq.rhs, substitutionDict))
                     processedOtherSubexpressionEquations.append(newEq)
                     substitutionDict[otherSubexpressionEq.lhs] = newLhs
             else:
                 processedOtherSubexpressionEquations.append(fastSubs(otherSubexpressionEq, substitutionDict))
-        return self.copy(self.mainEquations + other.mainEquations,
+
+        processedOtherMainEquations = [fastSubs(eq, substitutionDict) for eq in other.mainEquations]
+        return self.copy(self.mainEquations + processedOtherMainEquations,
                          self.subexpressions + processedOtherSubexpressionEquations)
 
     def getDependentSymbols(self, symbolSequence):
diff --git a/field.py b/field.py
index eb0dc0c3f..ee906e9d9 100644
--- a/field.py
+++ b/field.py
@@ -236,6 +236,9 @@ class Field:
                                  "Got %d, expected %d" % (len(idx), self.field.indexDimensions))
             return Field.Access(self.field, self._offsets, idx)
 
+        def __getitem__(self, *idx):
+            return self.__call__(*idx)
+
         @property
         def field(self):
             return self._field
-- 
GitLab