From e3f9eaa399cb88a0da8643c065fc781d34fd18c5 Mon Sep 17 00:00:00 2001 From: Dominic Kempf <dominic.kempf@iwr.uni-heidelberg.de> Date: Mon, 26 Nov 2018 13:26:40 +0100 Subject: [PATCH] Correctly use base weight in the fastdg case --- python/dune/codegen/sumfact/quadrature.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/python/dune/codegen/sumfact/quadrature.py b/python/dune/codegen/sumfact/quadrature.py index 3453d94c..eedd85da 100644 --- a/python/dune/codegen/sumfact/quadrature.py +++ b/python/dune/codegen/sumfact/quadrature.py @@ -50,6 +50,9 @@ class BaseWeight(FunctionIdentifier): def name(self): return '{}.weight'.format(self.accumobj) + def operations(self): + return 0 + @function_mangler def base_weight_function_mangler(target, func, dtypes): @@ -61,9 +64,11 @@ def pymbolic_base_weight(): """ This is the base weight that should be multiplied to the quadrature weight. With the fast DG assembler this will handle the weighting of the time discretization scheme. - TODO: Introduce backend switch that uses above BaseWeight function """ - return 1.0 + if get_form_option("fastdg"): + return prim.Call(BaseWeight(name_accumulation_variable()), ()) + else: + return 1.0 def default_quadrature_inames(visitor): @@ -172,8 +177,11 @@ def quadrature_weight(visitor): element = None else: element = info.element - return prim.Subscript(lp.symbolic.TaggedVariable(name, "operator_precomputed"), - tuple(prim.Variable(i) for i in quadrature_inames(element))) + + ret = prim.Subscript(lp.symbolic.TaggedVariable(name, "operator_precomputed"), + tuple(prim.Variable(i) for i in quadrature_inames(element))) + + return prim.Product((pymbolic_base_weight(), ret)) def define_quadrature_position(name, local_index): -- GitLab