Skip to content
Snippets Groups Projects
Commit d94aab54 authored by Dominic Kempf's avatar Dominic Kempf
Browse files

Allow conditionals choosing between tensors

The indexing information needs to be stored and reset
for visiting of the second branch.
parent 902f641a
No related branches found
No related tags found
No related merge requests found
...@@ -325,7 +325,15 @@ class UFL2LoopyVisitor(ModifiedTerminalTracker): ...@@ -325,7 +325,15 @@ class UFL2LoopyVisitor(ModifiedTerminalTracker):
# #
def conditional(self, o): def conditional(self, o):
return prim.If(*tuple(self.call(op) for op in o.ufl_operands)) condition = self.call(o.ufl_operands[0])
indices = self.indices
op1 = self.call(o.ufl_operands[1])
# Restore indexing information for the second branch
self.indices = indices
op2 = self.call(o.ufl_operands[2])
return prim.If(condition, op1, op2)
def eq(self, o): def eq(self, o):
return prim.Comparison(self.call(o.ufl_operands[0]), return prim.Comparison(self.call(o.ufl_operands[0]),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment