diff --git a/field.py b/field.py index e1e4401823454fda3d9b5d72e5f17a3dc25fc711..3e6486e4621da7be05facd420cd2e3f02924d85b 100644 --- a/field.py +++ b/field.py @@ -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 diff --git a/kernel_decorator.py b/kernel_decorator.py index e895ad861454293cdea10cd72757340e4ceec188..0063865b22b5a84839990637f3bdafad18e8d711 100644 --- a/kernel_decorator.py +++ b/kernel_decorator.py @@ -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) diff --git a/stencils.py b/stencils.py index d304cb5ae8a1fff4661b6caa49d27242e8f98612..2cd5f02c7525db4cf9af1857e86420822bfb063d 100644 --- a/stencils.py +++ b/stencils.py @@ -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