Skip to content
Snippets Groups Projects
Commit 05ab27d3 authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

Print specialized CSEs so they can be distinguished.

parent a39c61f4
No related branches found
No related tags found
No related merge requests found
...@@ -263,7 +263,7 @@ class IdentityMapperBase(object): ...@@ -263,7 +263,7 @@ class IdentityMapperBase(object):
if is_zero(result): if is_zero(result):
return 0 return 0
return expr.__class__( return type(expr)(
result, result,
expr.prefix, expr.prefix,
**expr.get_extra_properties()) **expr.get_extra_properties())
......
...@@ -186,7 +186,14 @@ class StringifyMapper(pymbolic.mapper.RecursiveMapper): ...@@ -186,7 +186,14 @@ class StringifyMapper(pymbolic.mapper.RecursiveMapper):
return "array(\n%s)" % "".join(lines) return "array(\n%s)" % "".join(lines)
def map_common_subexpression(self, expr, enclosing_prec): def map_common_subexpression(self, expr, enclosing_prec):
return self.format("CSE(%s)", self.rec(expr.child, PREC_NONE)) from pymbolic.primitives import CommonSubexpression
if type(expr) is CommonSubexpression:
type_name = "CSE"
else:
type_name = type(expr).__name__
return self.format("%s(%s)",
type_name, self.rec(expr.child, PREC_NONE))
def map_if_positive(self, expr, enclosing_prec): def map_if_positive(self, expr, enclosing_prec):
return "If(%s > 0, %s, %s)" % ( return "If(%s > 0, %s, %s)" % (
......
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