From c22773d9dee32a4422d694702dbc5127545a4024 Mon Sep 17 00:00:00 2001 From: Dominic Kempf <dominic.kempf@iwr.uni-heidelberg.de> Date: Wed, 20 Jul 2016 11:28:10 +0200 Subject: [PATCH] Use predicates instead of modifying instruction code --- python/dune/perftool/loopy/transformer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/dune/perftool/loopy/transformer.py b/python/dune/perftool/loopy/transformer.py index 8e863694..5af4377c 100644 --- a/python/dune/perftool/loopy/transformer.py +++ b/python/dune/perftool/loopy/transformer.py @@ -206,6 +206,8 @@ class UFL2LoopyVisitor(ModifiedTerminalTracker, UFL2PymbolicMapper, GeometryMapp factor, ) + predicates = frozenset({}) + # Maybe wrap this instruction into a condiditional. This mostly happens with mixed boundary conditions if self.subdomain_id not in ['everywhere', 'otherwise']: # We need to reconstruct the subdomain_data parameter of the measure @@ -237,13 +239,14 @@ class UFL2LoopyVisitor(ModifiedTerminalTracker, UFL2PymbolicMapper, GeometryMapp from dune.perftool.pdelab.parameter import intersection_parameter_function intersection_parameter_function(name, subdomain_data, t='int') - code = "if ({} == {})\n {}".format(name, self.subdomain_id, code) + predicates = predicates.union(['{} == {}'.format(name, self.subdomain_id)]) # Finally, issue the instruction instruction(code=code, read_variables=frozenset({factor, pymbolic_expr.name}), forced_iname_deps=frozenset(self.inames).union(frozenset({quadrature_iname()})), forced_iname_deps_is_final=True, + predicates=predicates ) def argument(self, o): -- GitLab