Commit 65ddbe06 authored by Martin Bauer's avatar Martin Bauer
Browse files

Fixes for printing problem e.g. f_N vs f[0,1]

- if a field access is printed in compass or index notation seems to
  depend on the sympy version
- removed doctests that rely on the printed form
parent e8d3ca73
......@@ -153,11 +153,7 @@ class Field:
>>> from pystencils import Assignment
>>> stencil = np.array([[0,0], [0,1], [0,-1]])
>>> src, dst = fields("src(3), dst(3) : double[2D]")
>>> for i, offset in enumerate(stencil):
... Assignment(dst[0,0](i), src[-offset](i))
Assignment(dst_C^0, src_C^0)
Assignment(dst_C^1, src_S^1)
Assignment(dst_C^2, src_N^2)
>>> assignments = [Assignment(dst[0,0](i), src[-offset](i)) for i, offset in enumerate(stencil)];
"""
@staticmethod
......
......@@ -25,8 +25,8 @@ def kernel(func, **kwargs):
... f, g = ps.fields('f, g: [2D]')
... s.neighbors @= f[0,1] + f[1,0]
... g[0,0] @= s.neighbors + f[0,0] if f[0,0] > 0 else 0
>>> my_kernel
[Assignment(neighbors, f_N + f_E), Assignment(g_C, Piecewise((f_C + neighbors, f_C > 0), (0, True)))]
>>> f, g = ps.fields('f, g: [2D]')
>>> assert my_kernel[0].rhs == f[0,1] + f[1,0]
"""
source = inspect.getsource(func)
source = textwrap.dedent(source)
......
......@@ -90,8 +90,7 @@ def stencil_coefficients(expr):
>>> import pystencils as ps
>>> f = ps.fields("f(3) : double[2D]")
>>> stencil_coefficients(2 * f[0, 1](1) + 3 * f[-1, 0](1))
([(-1, 0), (0, 1)], [3, 2])
>>> coff = stencil_coefficients(2 * f[0, 1](1) + 3 * f[-1, 0](1))
"""
field_center, coefficients, nonlinear_part = stencil_coefficient_dict(expr)
assert nonlinear_part == 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment