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

Fix in generated jacobi sweep

parent 57787a77
No related branches found
No related tags found
No related merge requests found
......@@ -7,11 +7,11 @@ with CodeGeneration() as ctx:
h = sp.symbols("h")
# ----- Jacobi 2D - created by specifying weights in nested list --------------------------
src, dst = ps.fields("src, src_tmp: [2D]")
stencil = [[0, -1, 0],
[-1, 4, -1],
[0, -1, 0]]
assignments = ps.assignment_from_stencil(stencil, src, dst, normalization_factor=4 * h**2)
src, dst = ps.fields("src, src_tmp: [2D]", layout='fzyx')
stencil = [[0, 1, 0],
[1, 0, 1],
[0, 1, 0]]
assignments = ps.assignment_from_stencil(stencil, src, dst, normalization_factor=1 / (4 * h ** 2))
generate_sweep(ctx, 'JacobiKernel2D', assignments, field_swaps=[(src, dst)])
# ----- Jacobi 3D - created by using kernel_decorator with assignments in '@=' format -----
......@@ -21,6 +21,6 @@ with CodeGeneration() as ctx:
def kernel_func():
dst[0, 0, 0] @= (src[1, 0, 0] + src[-1, 0, 0] +
src[0, 1, 0] + src[0, -1, 0] +
src[0, 0, 1] + src[0, 0, -1]) / (6 * h ** 2)
src[0, 0, 1] + src[0, 0, -1]) / (h ** 2 * 6)
generate_sweep(ctx, 'JacobiKernel3D', kernel_func, field_swaps=[(src, dst)])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment