Skip to content
Snippets Groups Projects
Commit d945ba1f authored by Frederik Hennig's avatar Frederik Hennig
Browse files

Fixed index list tests

parent 235979c0
No related branches found
No related tags found
1 merge request!41Fix: Boundary Index List Tests now also check `single_link=True`
...@@ -3,8 +3,10 @@ import numpy as np ...@@ -3,8 +3,10 @@ import numpy as np
import pystencils.boundaries.createindexlist as cil import pystencils.boundaries.createindexlist as cil
from lbmpy.stencils import get_stencil from lbmpy.stencils import get_stencil
import pytest
def test_equivalence_cython_python_version(): @pytest.mark.parametrize('single_link', [False, True])
def test_equivalence_cython_python_version(single_link):
if not cil.cython_funcs_available: if not cil.cython_funcs_available:
return return
...@@ -26,21 +28,21 @@ def test_equivalence_cython_python_version(): ...@@ -26,21 +28,21 @@ def test_equivalence_cython_python_version():
flag_field_3d[7, 7, 7] = mask flag_field_3d[7, 7, 7] = mask
result_python_2d = cil._create_boundary_neighbor_index_list_python(flag_field_2d, 1, mask, fluid_mask, result_python_2d = cil._create_boundary_neighbor_index_list_python(flag_field_2d, 1, mask, fluid_mask,
stencil_2d, False) stencil_2d, single_link)
result_python_3d = cil._create_boundary_neighbor_index_list_python(flag_field_3d, 1, mask, fluid_mask, result_python_3d = cil._create_boundary_neighbor_index_list_python(flag_field_3d, 1, mask, fluid_mask,
stencil_3d, False) stencil_3d, single_link)
result_cython_2d = cil.create_boundary_index_list(flag_field_2d, stencil_2d, mask, result_cython_2d = cil.create_boundary_index_list(flag_field_2d, stencil_2d, mask,
fluid_mask, 1, True, False) fluid_mask, 1, True, single_link)
result_cython_3d = cil.create_boundary_index_list(flag_field_3d, stencil_3d, mask, result_cython_3d = cil.create_boundary_index_list(flag_field_3d, stencil_3d, mask,
fluid_mask, 1, True, False) fluid_mask, 1, True, single_link)
np.testing.assert_equal(result_python_2d, result_cython_2d) np.testing.assert_equal(result_python_2d, result_cython_2d)
np.testing.assert_equal(result_python_3d, result_cython_3d) np.testing.assert_equal(result_python_3d, result_cython_3d)
@pytest.mark.parametrize('single_link', [False, True])
def test_equivalence_cell_idx_list_cython_python_version(): def test_equivalence_cell_idx_list_cython_python_version(single_link):
if not cil.cython_funcs_available: if not cil.cython_funcs_available:
return return
...@@ -62,15 +64,15 @@ def test_equivalence_cell_idx_list_cython_python_version(): ...@@ -62,15 +64,15 @@ def test_equivalence_cell_idx_list_cython_python_version():
flag_field_3d[7, 7, 7] = mask flag_field_3d[7, 7, 7] = mask
result_python_2d = cil._create_boundary_cell_index_list_python(flag_field_2d, mask, fluid_mask, result_python_2d = cil._create_boundary_cell_index_list_python(flag_field_2d, mask, fluid_mask,
stencil_2d, False) stencil_2d, single_link)
result_python_3d = cil._create_boundary_cell_index_list_python(flag_field_3d, mask, fluid_mask, result_python_3d = cil._create_boundary_cell_index_list_python(flag_field_3d, mask, fluid_mask,
stencil_3d, False) stencil_3d, single_link)
result_cython_2d = cil.create_boundary_index_list(flag_field_2d, stencil_2d, mask, fluid_mask, None, result_cython_2d = cil.create_boundary_index_list(flag_field_2d, stencil_2d, mask, fluid_mask, None,
False, False) False, single_link)
result_cython_3d = cil.create_boundary_index_list(flag_field_3d, stencil_3d, mask, fluid_mask, None, result_cython_3d = cil.create_boundary_index_list(flag_field_3d, stencil_3d, mask, fluid_mask, None,
False, False) False, single_link)
np.testing.assert_equal(result_python_2d, result_cython_2d) np.testing.assert_equal(result_python_2d, result_cython_2d)
np.testing.assert_equal(result_python_3d, result_cython_3d) np.testing.assert_equal(result_python_3d, result_cython_3d)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment