From 831e03e12c31dc915feb22b3ed47039b5af98027 Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Fri, 9 Jul 2021 11:40:28 +0100 Subject: [PATCH] Correct shapes for Variables representing Real coefficients --- tsfc/kernel_interface/firedrake.py | 4 ++-- tsfc/kernel_interface/firedrake_loopy.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tsfc/kernel_interface/firedrake.py b/tsfc/kernel_interface/firedrake.py index df27466c..faed2803 100644 --- a/tsfc/kernel_interface/firedrake.py +++ b/tsfc/kernel_interface/firedrake.py @@ -358,8 +358,8 @@ def prepare_coefficient(coefficient, name, scalar_type, interior_facet=False): funarg = coffee.Decl(scalar_type, coffee.Symbol(name), pointers=[("restrict",)], qualifiers=["const"]) - - expression = gem.reshape(gem.Variable(name, (None,)), + value_size = coefficient.ufl_element().value_size() + expression = gem.reshape(gem.Variable(name, (value_size,)), coefficient.ufl_shape) return funarg, expression diff --git a/tsfc/kernel_interface/firedrake_loopy.py b/tsfc/kernel_interface/firedrake_loopy.py index 3c3e63c1..1a7bda9c 100644 --- a/tsfc/kernel_interface/firedrake_loopy.py +++ b/tsfc/kernel_interface/firedrake_loopy.py @@ -339,8 +339,9 @@ def prepare_coefficient(coefficient, name, scalar_type, interior_facet=False): if coefficient.ufl_element().family() == 'Real': # Constant - funarg = lp.GlobalArg(name, dtype=scalar_type, shape=(coefficient.ufl_element().value_size(),)) - expression = gem.reshape(gem.Variable(name, (None,)), + value_size = coefficient.ufl_element().value_size() + funarg = lp.GlobalArg(name, dtype=scalar_type, shape=(value_size,)) + expression = gem.reshape(gem.Variable(name, (value_size,)), coefficient.ufl_shape) return funarg, expression