diff --git a/test/data_for_test.py b/test/data_for_test.py index 84033f7ed188c520042011032c0e4d709a4d71fa..8a8f47429ce1f2a8c1cfaa94d30330f78d082dad 100644 --- a/test/data_for_test.py +++ b/test/data_for_test.py @@ -14,7 +14,7 @@ class FluxDataSingle: ndim = 3 dirs = {"x": 1, "y": 2, "z": 3} - def __init__(self, states_str, direction): + def __init__(self, queue, states_str, direction): self.direction = self.dirs[direction] self.dir_internal = self.direction-1 @@ -48,7 +48,7 @@ class FluxDataSingle: self.lam_pointwise = ref.lambda_pointwise( self.states, self.metrics, self.dir_internal) self.R, self.R_inv, self.lam_roe = ref.roe_eigensystem( - self.state_pair, self.frozen_metrics, self.direction) + queue, self.state_pair, self.frozen_metrics, self.direction) self.wavespeeds = ref.wavespeeds(self.lam_pointwise, self.lam_roe) self.char_fluxes_pos, self.char_fluxes_neg = ref.split_char_fluxes( @@ -170,43 +170,25 @@ class FluxDataVector: # }}} - -single_data = {} - -single_data["Case flat:x"] = FluxDataSingle( - states_str="1 1 1 1 5.5,1 1 1 1 5.5", direction="x") -single_data["Case flat:y"] = FluxDataSingle( - states_str="1 1 1 1 5.5,1 1 1 1 5.5", direction="y") -single_data["Case flat:z"] = FluxDataSingle( - states_str="1 1 1 1 5.5,1 1 1 1 5.5", direction="z") - -single_data["Case a:x"] = FluxDataSingle( - states_str="2 4 4 4 20,1 1 1 1 5.5", direction="x") -single_data["Case a:y"] = FluxDataSingle( - states_str="2 4 4 4 20,1 1 1 1 5.5", direction="y") -single_data["Case a:z"] = FluxDataSingle( - states_str="2 4 4 4 20,1 1 1 1 5.5", direction="z") - -single_data["Case b:x"] = FluxDataSingle( - states_str="1 -1 -1 -1 5.5,2 -4 -4 -4 20", direction="x") -single_data["Case b:y"] = FluxDataSingle( - states_str="1 -1 -1 -1 5.5,2 -4 -4 -4 20", direction="y") -single_data["Case b:z"] = FluxDataSingle( - states_str="1 -1 -1 -1 5.5,2 -4 -4 -4 20", direction="z") - -single_data["Case c:x"] = FluxDataSingle( - states_str="2 4 8 12 64,1 1 2 3 11", direction="x") -single_data["Case c:y"] = FluxDataSingle( - states_str="2 8 12 4 64,1 2 3 1 11", direction="y") -single_data["Case c:z"] = FluxDataSingle( - states_str="2 12 4 8 64,1 3 1 2 11", direction="z") - -single_data["Case d:x"] = FluxDataSingle( - states_str="1 -1 -2 -3 11,2 -4 -8 -12 64", direction="x") -single_data["Case d:y"] = FluxDataSingle( - states_str="1 -2 -3 -1 11,2 -8 -12 -4 64", direction="y") -single_data["Case d:z"] = FluxDataSingle( - states_str="1 -3 -1 -2 11,2 -12 -4 -8 64", direction="z") +@pytest.fixture(scope="session", params=[ + ("1 1 1 1 5.5,1 1 1 1 5.5", "x"), + ("1 1 1 1 5.5,1 1 1 1 5.5", "y"), + ("1 1 1 1 5.5,1 1 1 1 5.5", "z"), + ("2 4 4 4 20,1 1 1 1 5.5", "x"), + ("2 4 4 4 20,1 1 1 1 5.5", "y"), + ("2 4 4 4 20,1 1 1 1 5.5", "z"), + ("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "x"), + ("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "y"), + ("1 -1 -1 -1 5.5,2 -4 -4 -4 20", "z"), + ("2 4 8 12 64,1 1 2 3 11", "x"), + ("2 8 12 4 64,1 2 3 1 11", "y"), + ("2 12 4 8 64,1 3 1 2 11", "z"), + ("1 -1 -2 -3 11,2 -4 -8 -12 64", "x"), + ("1 -2 -3 -1 11,2 -8 -12 -4 64", "y"), + ("1 -3 -1 -2 11,2 -12 -4 -8 64", "z") + ]) +def flux_test_data_fixture(request, queue): + return FluxDataSingle(queue, *request.param) vector_data = {} @@ -238,16 +220,6 @@ vector_data["Case a:z"] = FluxDataVector( direction="z") -@pytest.fixture(scope="session", params=[ - "Case flat:x", "Case flat:y", "Case flat:z", - "Case a:x", "Case a:y", "Case a:z", - "Case b:x", "Case b:y", "Case b:z", - "Case c:x", "Case c:y", "Case c:z", - "Case d:x", "Case d:y", "Case d:z"]) -def flux_test_data_fixture(request): - return single_data[request.param] - - @pytest.fixture(scope="session", params=[ "Case flat:x", "Case flat:y", "Case flat:z"]) def cfd_test_data_fixture(request): diff --git a/test/test_eigensystem.py b/test/test_eigensystem.py index 3c48c713afe2c449c689965333960eacf3c2c570..84d03bdc9bc6ae2689b681b874b9f967bf3f1888 100644 --- a/test/test_eigensystem.py +++ b/test/test_eigensystem.py @@ -13,8 +13,7 @@ import pytest import utilities as u from data_for_test import ( # noqa: F401 - flux_test_data_fixture, - single_data as sd + flux_test_data_fixture ) diff --git a/test/test_weno_flux.py b/test/test_weno_flux.py index f6587c6b52fb4bbddd89ccf18be0bb05b519cb7a..4a4d6822e7e8e7bca05d1466b6c344c408287b1d 100644 --- a/test/test_weno_flux.py +++ b/test/test_weno_flux.py @@ -13,8 +13,7 @@ import pytest import utilities as u from data_for_test import ( # noqa: F401 - flux_test_data_fixture, - single_data as sd + flux_test_data_fixture ) diff --git a/test/weno_reference_implementation.py b/test/weno_reference_implementation.py index 2b18fd70c2fe7f7eef6eecd3a0abb48b5a867a0d..b4cd3d88e965f5d5f26b3fb8bf413a7dcc8e52b5 100644 --- a/test/weno_reference_implementation.py +++ b/test/weno_reference_implementation.py @@ -14,7 +14,7 @@ def pointwise_fluxes(states): return np.array([gas.flux(s) for s in states.T]) -def roe_eigensystem(state_pair, frozen_metrics, direction): +def roe_eigensystem(queue, state_pair, frozen_metrics, direction): # FIXME: startup for test suite is pretty slow due to this routine # -- can we speed this up? @@ -22,7 +22,6 @@ def roe_eigensystem(state_pair, frozen_metrics, direction): ndim = frozen_metrics.shape[0] prg = u.get_weno_program_with_root_kernel("roe_eigensystem") - queue = u.get_queue(cl._csc) R_dev = u.empty_array_on_device(queue, nvars, nvars) R_inv_dev = u.empty_array_on_device(queue, nvars, nvars)