From 5aabe01fdc7e6461b1c7248901653dba87080dc2 Mon Sep 17 00:00:00 2001 From: "Timothy A. Smith" Date: Mon, 22 Jul 2019 21:49:36 -0500 Subject: [PATCH] rewrite weno flux test for new fixture --- test.py | 53 ++++++++--------------------------------------------- 1 file changed, 8 insertions(+), 45 deletions(-) diff --git a/test.py b/test.py index ae58e9c..0c1f86f 100644 --- a/test.py +++ b/test.py @@ -18,58 +18,21 @@ import utilities as u from input import data -@pytest.mark.parametrize(("gen_fluxes_str,char_fluxes_pos_str,char_fluxes_neg_str," - "R_str,flux_expected_str"), [ - ("4 11.2 8 8 46.4,1 2.6 1 1 7.1", - ("1.09071563 1.23015152 1.23015152 7.52305259 0.232956271," - "0.467376796 -0.6627417 -0.6627417 1.47953026 0.312527304"), - ("-0.168354897 -0.0585786438 -0.0585786438 -0.727493464 -0.306026299," - "-0.0672231577 0.248528137 0.248528137 -0.107250611 -0.374562227"), - ("1 0 0 0.45781246 0.45781246," - "1.58578644 0 0 1.43309957 0.0188860081," - "1.58578644 1.41421356 0 0.725992789 0.725992789," - "1.58578644 0 1.41421356 0.725992789 0.725992789," - "3.77207794 2.24264069 2.24264069 5.57860029 3.3359596"), - "4.35371022 12.2479485 8.99522344 8.99522344 51.3903927"), - ("-1 2.6 1 1 -7.1,-4 11.2 8 8 -46.4", - ("0.0672231577 0.248528137 0.248528137 0.374562227 0.107250611," - "0.168354897 -0.0585786438 -0.0585786438 0.306026299 0.727493464"), - ("-0.467376796 -0.6627417 -0.6627417 -0.312527304 -1.47953026," - "-1.09071563 1.23015152 1.23015152 -0.232956271 -7.52305259"), - ("1 0 0 0.45781246 0.45781246," - "-1.58578644 0 0 -0.0188860081 -1.43309957," - "-1.58578644 1.41421356 0 -0.725992789 -0.725992789," - "-1.58578644 0 1.41421356 -0.725992789 -0.725992789," - "3.77207794 -2.24264069 -2.24264069 3.3359596 5.57860029"), - "-4.35371022 12.2479485 8.99522344 8.99522344 -51.3903927") - ]) -def test_weno_flux_uniform_grid( - ctx_factory, gen_fluxes_str, char_fluxes_pos_str, char_fluxes_neg_str, - R_str, flux_expected_str): +def test_weno_flux_uniform_grid(ctx_factory, data): prg = u.get_weno_program_with_root_kernel("weno_flux") queue = u.get_queue(ctx_factory) - nvars = 5 + flux_dev = u.empty_array_on_device(queue, data.nvars) - gen_fluxes = u.expand_to_6( - u.transposed_array_from_string(gen_fluxes_str)) - char_fluxes_pos = u.expand_to_6( - u.transposed_array_from_string(char_fluxes_pos_str)) - char_fluxes_neg = u.expand_to_6( - u.transposed_array_from_string(char_fluxes_neg_str)) - R = u.array_from_string(R_str) - flux_dev = u.empty_array_on_device(queue, nvars) - - prg(queue, nvars=nvars, - generalized_fluxes=gen_fluxes, - characteristic_fluxes_pos=char_fluxes_pos, - characteristic_fluxes_neg=char_fluxes_neg, + prg(queue, nvars=data.nvars, + generalized_fluxes=data.fluxes, + characteristic_fluxes_pos=data.char_fluxes_pos, + characteristic_fluxes_neg=data.char_fluxes_neg, combined_frozen_metrics=1.0, - R=R, + R=data.R, flux=flux_dev) - flux_expected = u.array_from_string(flux_expected_str) - u.compare_arrays(flux_dev.get(), flux_expected) + u.compare_arrays(flux_dev.get(), data.weno_flux) def test_consistent_part_uniform_grid(ctx_factory, data): -- GitLab