diff --git a/python/dune/perftool/loopy/transformer.py b/python/dune/perftool/loopy/transformer.py index 5ec24a16a869cee50a31168a3929c2366641eb19..245882b8c62587e2ae0252880be9175ec1f7b0fb 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 97e1f7e15d3c65f6c1d3e9182e00b3068a863bc1..d44424bb7e13fc4b1d5acf0ec1bc243e6c361148 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 c783d88229a995eafe741d9c1d0443c822dd08dc..d1c18d9923acee26db1df858b60458acacacf019 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),