Skip to content
Snippets Groups Projects

Testing

Merged Markus Holzer requested to merge holzer/pystencils:testing into master
Compare and Show latest version
1 file
+ 9
7
Preferences
Compare changes
@@ -4,7 +4,6 @@ import waLBerla as wlb
@@ -4,7 +4,6 @@ import waLBerla as wlb
import pystencils
import pystencils
from pystencils import make_slice
from pystencils import make_slice
from tempfile import TemporaryDirectory
from pathlib import Path
from pathlib import Path
from pystencils.boundaries import BoundaryHandling, Neumann
from pystencils.boundaries import BoundaryHandling, Neumann
@@ -138,11 +137,14 @@ def test_parallel_datahandling_boundary_conditions():
@@ -138,11 +137,14 @@ def test_parallel_datahandling_boundary_conditions():
default_target=pystencils.Target.GPU)
default_target=pystencils.Target.GPU)
src = dh.add_array('src', values_per_cell=1)
src = dh.add_array('src', values_per_cell=1)
dh.fill("src", 0.0, ghost_layers=True)
dh.fill(src.name, 0.0, ghost_layers=True)
dh.fill("src", 1.0, ghost_layers=False)
dh.fill(src.name, 1.0, ghost_layers=False)
 
 
src2 = dh.add_array('src2', values_per_cell=1)
 
src_cpu = dh.add_array('src_cpu', values_per_cell=1, gpu=False)
src_cpu = dh.add_array('src_cpu', values_per_cell=1, gpu=False)
dh.fill("src_cpu", 0.0, ghost_layers=True)
dh.fill(src_cpu.name, 0.0, ghost_layers=True)
dh.fill("src_cpu", 1.0, ghost_layers=False)
dh.fill(src_cpu.name, 1.0, ghost_layers=False)
boundary_stencil = [(1, 0), (-1, 0), (0, 1), (0, -1)]
boundary_stencil = [(1, 0), (-1, 0), (0, 1), (0, -1)]
boundary_handling_cpu = BoundaryHandling(dh, src_cpu.name, boundary_stencil,
boundary_handling_cpu = BoundaryHandling(dh, src_cpu.name, boundary_stencil,
@@ -165,10 +167,10 @@ def test_parallel_datahandling_boundary_conditions():
@@ -165,10 +167,10 @@ def test_parallel_datahandling_boundary_conditions():
boundary_handling()
boundary_handling()
dh.all_to_cpu()
dh.all_to_cpu()
for block in dh.iterate():
for block in dh.iterate():
np.testing.assert_almost_equal(block["src_cpu"], block["src"])
np.testing.assert_almost_equal(block[src_cpu.name], block[src.name])
assert dh.custom_data_names == ('boundary_handling_cpuIndexArrays', 'boundary_handling_gpuIndexArrays')
assert dh.custom_data_names == ('boundary_handling_cpuIndexArrays', 'boundary_handling_gpuIndexArrays')
dh.swap("src", "src2", gpu=True)
dh.swap(src.name, src2.name, gpu=True)
def test_save_data():
def test_save_data():