From 679e9741762d98e97fc7db7a4e84653814ea545a Mon Sep 17 00:00:00 2001 From: Stephan Seitz <stephan.seitz@fau.de> Date: Fri, 31 Jan 2020 18:38:18 +0100 Subject: [PATCH] Add test for spatial information --- tests/test_walberla.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/test_walberla.py b/tests/test_walberla.py index a8ccf91..6dcbabe 100644 --- a/tests/test_walberla.py +++ b/tests/test_walberla.py @@ -93,6 +93,29 @@ def test_wald_wiesen_lbm(): file.write(v) +def test_global_idx(): + sys.path.append(dirname(__file__)) + with ManualCodeGenerationContext() as ctx: + from pystencils_walberla.special_symbols import current_global_idx, aabb_min_x + + dh = GraphDataHandling((20, 30)) + my_array = dh.add_array('my_array') + + ast = pystencils.create_kernel([pystencils.Assignment(my_array.center, sum(current_global_idx))]).compile() + dh.run_kernel(ast, simulate_only=True) + ast = pystencils.create_kernel([pystencils.Assignment(my_array.center, aabb_min_x)]).compile() + dh.run_kernel(ast, simulate_only=True) + + sim = Simulation(dh, ctx) + sim.write_files() + + dir = '/localhome/seitz_local/projects/walberla/apps/foo/' + os.makedirs(dir, exist_ok=True) + for k, v in ctx.files.items(): + with open(join(dir, k), 'w') as file: + file.write(v) + + def test_resolve_parameters(): sym = TypedSymbol('s', create_type('double')) sym2 = TypedSymbol('t', create_type('double')) -- GitLab