diff --git a/python/dune/codegen/sumfact/quadrature.py b/python/dune/codegen/sumfact/quadrature.py index 3453d94cdeb1b52be343bad736b8a139cffe9183..eedd85da732c60fbe3729451ddbe87ee6319f39c 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):