Skip to content
Snippets Groups Projects
Commit 2f4313fd authored by Martin Bauer's avatar Martin Bauer
Browse files

Merge branch 'function-call-printing' into 'master'

Add own implementation for printing an unknown function

See merge request !96
parents c4e92d45 5e7d3c9c
No related branches found
No related tags found
1 merge request!96Add own implementation for printing an unknown function
Pipeline #20145 passed with warnings
...@@ -385,7 +385,8 @@ class CustomSympyPrinter(CCodePrinter): ...@@ -385,7 +385,8 @@ class CustomSympyPrinter(CCodePrinter):
elif expr.func == int_div: elif expr.func == int_div:
return "((%s) / (%s))" % (self._print(expr.args[0]), self._print(expr.args[1])) return "((%s) / (%s))" % (self._print(expr.args[0]), self._print(expr.args[1]))
else: else:
return super(CustomSympyPrinter, self)._print_Function(expr) arg_str = ', '.join(self._print(a) for a in expr.args)
return f'{expr.name}({arg_str})'
def _typed_number(self, number, dtype): def _typed_number(self, number, dtype):
res = self._print(number) res = self._print(number)
......
...@@ -32,8 +32,7 @@ def test_cuda_but_not_c(): ...@@ -32,8 +32,7 @@ def test_cuda_but_not_c():
}) })
ast = pystencils.create_kernel(assignments, 'cpu') ast = pystencils.create_kernel(assignments, 'cpu')
code = str(pystencils.show_code(ast)) print(pystencils.show_code(ast))
assert "Not supported" in code
def test_cuda_unknown(): def test_cuda_unknown():
...@@ -46,4 +45,3 @@ def test_cuda_unknown(): ...@@ -46,4 +45,3 @@ def test_cuda_unknown():
ast = pystencils.create_kernel(assignments, 'gpu') ast = pystencils.create_kernel(assignments, 'gpu')
code = str(pystencils.show_code(ast)) code = str(pystencils.show_code(ast))
print(code) print(code)
assert "Not supported in CUDA" in code
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment