From a165dbb1325c325229748c74208de9b058ef3f60 Mon Sep 17 00:00:00 2001
From: Dominic Kempf <dominic.kempf@iwr.uni-heidelberg.de>
Date: Thu, 28 Apr 2016 18:29:33 +0200
Subject: [PATCH] Get rid of all UFL deprecation warnings

---
 python/dune/perftool/loopy/transformer.py             |  4 ++--
 python/dune/perftool/pdelab/localoperator.py          | 11 ++++++++---
 .../ufl/transformations/extract_accumulation_terms.py |  6 +++---
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/python/dune/perftool/loopy/transformer.py b/python/dune/perftool/loopy/transformer.py
index 5ec24a16..245882b8 100644
--- a/python/dune/perftool/loopy/transformer.py
+++ b/python/dune/perftool/loopy/transformer.py
@@ -181,7 +181,7 @@ def transform_accumulation_term(term, measure, subdomain_id):
         from dune.perftool.pdelab.basis import name_lfs
         accumargs.append(name_lfs(arg.argexpr.element()))
 
-        if galerkin and arg.argexpr.count() == 1:
+        if galerkin and arg.argexpr.number() == 1:
             iname = lfs_iname(arg.argexpr.element(), context="arg")
         else:
             iname = lfs_iname(arg.argexpr.element())
@@ -195,7 +195,7 @@ def transform_accumulation_term(term, measure, subdomain_id):
         residual_shape[arg.argexpr.number()] = name_lfs_bound(name_lfs(arg.argexpr.element()))
 
         # Determine the restriction for later
-        arg_restr[arg.argexpr.count()] = arg.restriction
+        arg_restr[arg.argexpr.number()] = arg.restriction
 
     from dune.perftool.pdelab.argument import name_accumulation_variable
     accumvar = name_accumulation_variable(arg_restr)
diff --git a/python/dune/perftool/pdelab/localoperator.py b/python/dune/perftool/pdelab/localoperator.py
index 97e1f7e1..d44424bb 100644
--- a/python/dune/perftool/pdelab/localoperator.py
+++ b/python/dune/perftool/pdelab/localoperator.py
@@ -30,9 +30,14 @@ def lop_template_test_gfs():
 
 
 def lop_template_gfs(ma):
-    if ma.argexpr.count() == 0:
-        return lop_template_test_gfs()
-    if ma.argexpr.count() == 1:
+    from ufl.classes import Argument, Coefficient
+    if isinstance(ma.argexpr, Argument):
+        if ma.argexpr.number() == 0:
+            return lop_template_test_gfs()
+        if ma.argexpr.number() == 1:
+            return lop_template_ansatz_gfs()
+    if isinstance(ma.argexpr, Coefficient):
+        assert ma.argexpr.count() == 0
         return lop_template_ansatz_gfs()
     assert False
 
diff --git a/python/dune/perftool/ufl/transformations/extract_accumulation_terms.py b/python/dune/perftool/ufl/transformations/extract_accumulation_terms.py
index c783d882..d1c18d99 100644
--- a/python/dune/perftool/ufl/transformations/extract_accumulation_terms.py
+++ b/python/dune/perftool/ufl/transformations/extract_accumulation_terms.py
@@ -31,7 +31,7 @@ def split_into_accumulation_terms(expr):
     accumulation_terms = []
 
     # Treat the case of a rank 1 form:
-    if len(filter(lambda ma: ma.argexpr.count() == 1, mod_args)) == 0:
+    if len(filter(lambda ma: ma.argexpr.number() == 1, mod_args)) == 0:
         for arg in mod_args:
             # Do the replacement on the expression
             accumulation_terms.append(replace_expression(expr,
@@ -42,8 +42,8 @@ def split_into_accumulation_terms(expr):
                                       )
     # and now the case of a rank 2 form:
     else:
-        for arg1, arg2 in itertools.product(filter(lambda ma: ma.argexpr.count() == 0, mod_args),
-                                            filter(lambda ma: ma.argexpr.count() == 1, mod_args)
+        for arg1, arg2 in itertools.product(filter(lambda ma: ma.argexpr.number() == 0, mod_args),
+                                            filter(lambda ma: ma.argexpr.number() == 1, mod_args)
                                             ):
             accumulation_terms.append(replace_expression(expr,
                                                          replacemap=_ReplacementDict(good=(arg1.expr, arg2.expr),
-- 
GitLab