From 4dd239fbc607cfe207f5b1be9cbadbea6180570d 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, 26 Aug 2016 16:31:53 +0200 Subject: [PATCH] [bugfix] Adjust VectorExpression code --- python/dune/perftool/pdelab/parameter.py | 3 ++- python/dune/perftool/ufl/execution.py | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/python/dune/perftool/pdelab/parameter.py b/python/dune/perftool/pdelab/parameter.py index 1b2fc0f3..c5f20afe 100644 --- a/python/dune/perftool/pdelab/parameter.py +++ b/python/dune/perftool/pdelab/parameter.py @@ -99,7 +99,8 @@ def evaluate_intersectionwise_constant_parameter_function(name): pos = name_quadrature_position() from dune.perftool.generation.loopy import valuearg - define_parameter_funciton(name) + import numpy + define_parameter_function(name) valuearg(name, dtype=numpy.float64) return '{} = {}.{}({}, {});'.format(name, diff --git a/python/dune/perftool/ufl/execution.py b/python/dune/perftool/ufl/execution.py index 6e2a7d8c..fb0aa6b5 100644 --- a/python/dune/perftool/ufl/execution.py +++ b/python/dune/perftool/ufl/execution.py @@ -76,17 +76,20 @@ class Expression(Coefficient): class VectorExpression(Coefficient): - def __init__(self, expr, is_global=True, on_intersection=False, cell_type="triangle"): + def __init__(self, expr, is_global=True, on_intersection=False, cell_type="triangle", cellwise_constant=False): assert isinstance(expr, str) self.c_expr = expr self.is_global = is_global self.on_intersection = on_intersection # Avoid ufl complaining about not matching dimension/cells - _dg0vec = VectorElement("DG", cell_type, 0) + if cellwise_constant: + _dgvec = VectorElement("DG", cell_type, 0) + else: + _dgvec = VectorElement("DG", cell_type, 1) # Initialize a coefficient with a dummy finite element map. - Coefficient.__init__(self, _dg0vec) + Coefficient.__init__(self, _dgvec) # TODO the subdomain_data code needs a uflid, not idea how to get it here # The standard way through class decorator fails here... -- GitLab