Skip to content
Snippets Groups Projects
Commit 2b2aaf56 authored by Markus Holzer's avatar Markus Holzer
Browse files

Merge branch 'master' of i10git.cs.fau.de:pycodegen/pystencils into fix_new_filtered

parents 666fa8d6 1f3b1300
No related branches found
No related tags found
1 merge request!288Fix: AssignmentCollection's `new_filtered` now also finds dependencies in main assignments
import graphviz
from graphviz import Digraph, lang
try:
from graphviz import Digraph
import graphviz.quoting as quote
except ImportError:
from graphviz import Digraph
import graphviz.lang as quote
from sympy.printing.printer import Printer
......@@ -12,7 +17,7 @@ class DotPrinter(Printer):
super(DotPrinter, self).__init__()
self._node_to_str_function = node_to_str_function
self.dot = Digraph(**kwargs)
self.dot.quote_edge = lang.quote
self.dot.quote_edge = quote.quote
def _print_KernelFunction(self, func):
self.dot.node(str(id(func)), style='filled', fillcolor='#a056db', label=self._node_to_str_function(func))
......
......@@ -256,7 +256,7 @@ def insert_vector_casts(ast_node, default_float_type='double'):
new_arg = visit_expr(expr.args[0], default_type)
base_type = get_type_of_expression(expr.args[0]).base_type if type(expr.args[0]) is vector_memory_access \
else get_type_of_expression(expr.args[0])
pw = sp.Piecewise((-new_arg, new_arg < base_type.numpy_dtype.type(0)),
pw = sp.Piecewise((-new_arg, new_arg < cast_func(0, base_type.numpy_dtype)),
(new_arg, True))
return visit_expr(pw, default_type)
elif expr.func in handled_functions or isinstance(expr, sp.Rel) or isinstance(expr, BooleanFunction):
......
......@@ -7,7 +7,7 @@
"""
import pytest
from pystencils.session import *
from sympy import poly
......@@ -22,8 +22,14 @@ def test_field_access_poly():
def test_field_access_piecewise():
dh = ps.create_data_handling((20, 20))
ρ = dh.add_array('rho')
pw = sp.Piecewise((0, 1 < sp.Max(-0.5, ρ.center+0.5)), (1, True))
a = sp.simplify(pw)
print(a)
try:
a = sp.Piecewise((0, 1 < sp.Max(-0.5, sp.Symbol("test") + 0.5)), (1, True))
a.simplify()
except Exception as e:
pytest.skip(f"Bug in SymPy 1.10: {e}")
else:
dh = ps.create_data_handling((20, 20))
ρ = dh.add_array('rho')
pw = sp.Piecewise((0, 1 < sp.Max(-0.5, ρ.center+0.5)), (1, True))
a = sp.simplify(pw)
print(a)
......@@ -53,7 +53,7 @@ exclude_lines =
if __name__ == .__main__.:
skip_covered = True
fail_under = 86
fail_under = 85
[html]
directory = coverage_report
......@@ -91,7 +91,7 @@ setuptools.setup(name='pystencils',
author_email='cs10-codegen@fau.de',
url='https://i10git.cs.fau.de/pycodegen/pystencils/',
packages=['pystencils'] + ['pystencils.' + s for s in setuptools.find_packages('pystencils')],
install_requires=['sympy>=1.5.1,<=1.9', 'numpy>=1.8.0', 'appdirs', 'joblib'],
install_requires=['sympy>=1.5.1,<=1.10', 'numpy>=1.8.0', 'appdirs', 'joblib'],
package_data={'pystencils': ['include/*.h',
'backends/cuda_known_functions.txt',
'backends/opencl1.1_known_functions.txt',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment