From 6b465802ef7d7552faf4fd053380007aa49ce8ba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ren=C3=A9=20He=C3=9F?= <rene.hess@iwr.uni-heidelberg.de>
Date: Fri, 7 Oct 2016 14:39:19 +0200
Subject: [PATCH] UFL patch for function view degree estimation

---
 patches/ufl/ufl.patch | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 patches/ufl/ufl.patch

diff --git a/patches/ufl/ufl.patch b/patches/ufl/ufl.patch
new file mode 100644
index 00000000..9680ee42
--- /dev/null
+++ b/patches/ufl/ufl.patch
@@ -0,0 +1,30 @@
+From 7f4831b0b8220365ca4427922fcbeba07e934b5f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ren=C3=A9=20He=C3=9F?= <rene.hess@iwr.uni-heidelberg.de>
+Date: Fri, 7 Oct 2016 14:34:38 +0200
+Subject: [PATCH] Function view degree estimation for ReferenceValue
+
+---
+ ufl/algorithms/estimate_degrees.py | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/ufl/algorithms/estimate_degrees.py b/ufl/algorithms/estimate_degrees.py
+index caa9f19..d2d4e69 100644
+--- a/ufl/algorithms/estimate_degrees.py
++++ b/ufl/algorithms/estimate_degrees.py
+@@ -76,7 +76,12 @@ class SumDegreeEstimator(MultiFunction):
+     def function_view(self, v, a, i):
+         # TODO How would the element_replace_map interfere with the function_view class?
+         from ufl.functionview import select_subelement
+-        return select_subelement(v.ufl_operands[0].ufl_element(), v.ufl_operands[1]).degree()
++        from ufl.referencevalue import ReferenceValue
++        if isinstance(v.ufl_operands[0], ReferenceValue):
++            return select_subelement(v.ufl_operands[0].ufl_operands[0].ufl_element(), v.ufl_operands[1]).degree()
++        else:
++            return select_subelement(v.ufl_operands[0].ufl_element(), v.ufl_operands[1]).degree()
++
+ 
+     def _reduce_degree(self, v, f):
+         """Reduces the estimated degree by one; used when derivatives
+-- 
+2.9.3
+
-- 
GitLab