import legacy_reader import legacy_writer vtk = pytest.importorskip("vtk") test_set_full = [ helpers.tri_mesh, helpers.triangle6_mesh, helpers.quad_mesh, helpers.quad8_mesh, helpers.tri_quad_mesh, helpers.tet_mesh, helpers.tet10_mesh, helpers.hex_mesh, helpers.hex20_mesh, helpers.add_point_data(helpers.tri_mesh, 1), helpers.add_cell_data(helpers.tri_mesh, 1), ] test_set_reduced = [ helpers.tri_mesh, helpers.quad_mesh, helpers.tri_quad_mesh, helpers.tet_mesh, helpers.hex_mesh, helpers.add_point_data(helpers.tri_mesh, 1), helpers.add_cell_data(helpers.tri_mesh, 1), ] @pytest.mark.parametrize("mesh", test_set_full)
import legacy_reader import legacy_writer vtk = pytest.importorskip("vtk") test_set = [ helpers.tri_mesh, helpers.triangle6_mesh, helpers.quad_mesh, helpers.quad8_mesh, helpers.tri_quad_mesh, helpers.tet_mesh, helpers.tet10_mesh, helpers.hex_mesh, helpers.hex20_mesh, helpers.add_point_data(helpers.tri_mesh, 1), helpers.add_point_data(helpers.tri_mesh, 2), helpers.add_point_data(helpers.tri_mesh, 3), helpers.add_cell_data(helpers.tri_mesh, 1), helpers.add_cell_data(helpers.tri_mesh, 2), helpers.add_cell_data(helpers.tri_mesh, 3), helpers.add_cell_data(helpers.add_point_data(helpers.tri_mesh_2d, 2), 2), ] @pytest.mark.parametrize("mesh", test_set) @pytest.mark.parametrize("write_binary", [True, False]) def test(mesh, write_binary): def writer(*args, **kwargs): return meshio.vtk_io.write(*args, write_binary=write_binary, **kwargs)
@pytest.mark.parametrize( "mesh", [ helpers.empty_mesh, helpers.line_mesh, helpers.tri_mesh_2d, helpers.tri_mesh, helpers.triangle6_mesh, helpers.quad_mesh, helpers.quad8_mesh, helpers.quad_tri_mesh, helpers.tet_mesh, helpers.tet10_mesh, helpers.hex_mesh, helpers.hex20_mesh, helpers.add_point_data(helpers.tri_mesh, 1), helpers.add_point_data(helpers.tri_mesh, 2), helpers.add_point_data(helpers.tri_mesh, 3), helpers.add_point_data(helpers.hex_mesh, 3), helpers.add_cell_data(helpers.tri_mesh, [("a", (), np.float64)]), helpers.add_cell_data(helpers.tri_mesh, [("a", (2, ), np.float64)]), helpers.add_cell_data(helpers.tri_mesh, [("a", (3, ), np.float64)]), ], ) def test_io(mesh): helpers.write_read(meshio.med.write, meshio.med.read, mesh, 1.0e-15) def test_generic_io(): helpers.generic_io("test.med") # With additional, insignificant suffix:
import helpers import numpy as np import pytest import meshio @pytest.mark.parametrize( "mesh", [ # helpers.empty_mesh, helpers.tri_mesh, helpers.quad_mesh, helpers.tri_quad_mesh, helpers.add_point_data(helpers.tri_mesh, 1, dtype=int), helpers.add_point_data(helpers.tri_mesh, 1, dtype=float), helpers.line_mesh, # helpers.add_cell_data(helpers.tri_mesh, [("a", (), np.float64)]), # helpers.add_cell_data(helpers.tri_mesh, [("a", (2,), np.float64)]), # helpers.add_cell_data(helpers.tri_mesh, [("a", (3,), np.float64)]), ], ) @pytest.mark.parametrize("binary", [False, True]) def test_ply(mesh, binary): def writer(*args, **kwargs): return meshio.ply.write(*args, binary=binary, **kwargs) for k, c in enumerate(mesh.cells): mesh.cells[k] = meshio.CellBlock(c.type, c.data.astype(np.int32))
import numpy @pytest.mark.parametrize( "mesh", [ helpers.tri_mesh_2d, helpers.tri_mesh, helpers.triangle6_mesh, helpers.quad_mesh, helpers.quad8_mesh, helpers.tri_quad_mesh, helpers.tet_mesh, helpers.tet10_mesh, helpers.hex_mesh, helpers.add_point_data(helpers.tri_mesh, 1), helpers.add_point_data(helpers.tri_mesh, 2), helpers.add_point_data(helpers.tri_mesh, 3), helpers.add_point_data(helpers.hex_mesh, 3), helpers.add_cell_data(helpers.tri_mesh, 1), helpers.add_cell_data(helpers.tri_mesh, 2), helpers.add_cell_data(helpers.tri_mesh, 3), ], ) def test_io(mesh): helpers.write_read(meshio.med_io.write, meshio.med_io.read, mesh, 1.0e-15) return def test_generic_io(): helpers.generic_io("test.med")
import numpy import helpers test_set = [ helpers.tri_mesh, helpers.triangle6_mesh, helpers.quad_mesh, helpers.quad8_mesh, helpers.tri_quad_mesh, helpers.tet_mesh, helpers.tet10_mesh, helpers.hex_mesh, helpers.hex20_mesh, helpers.polygon_mesh, helpers.add_point_data(helpers.tri_mesh, 1), helpers.add_point_data(helpers.tri_mesh, 2), helpers.add_point_data(helpers.tri_mesh, 3), helpers.add_cell_data(helpers.tri_mesh, 1), helpers.add_cell_data(helpers.tri_mesh, 2), helpers.add_cell_data(helpers.tri_mesh, 3), helpers.add_cell_data(helpers.add_point_data(helpers.tri_mesh_2d, 2), 2), ] @pytest.mark.parametrize("mesh", test_set) @pytest.mark.parametrize("write_binary", [True, False]) def test(mesh, write_binary): def writer(*args, **kwargs): return meshio.vtk_io.write(*args, write_binary=write_binary, **kwargs)
helpers.empty_mesh, helpers.line_mesh, helpers.tri_mesh_2d, helpers.tri_mesh, helpers.triangle6_mesh, helpers.quad_mesh, helpers.quad8_mesh, helpers.tri_quad_mesh, helpers.tet_mesh, helpers.tet10_mesh, helpers.hex_mesh, helpers.hex20_mesh, helpers.polygon_mesh, helpers.pyramid_mesh, helpers.wedge_mesh, helpers.add_point_data(helpers.tri_mesh, 1), helpers.add_point_data(helpers.tri_mesh, 2), helpers.add_point_data(helpers.tri_mesh, 3), # VTK files float data is always stored in big endian helpers.add_cell_data(helpers.tri_mesh, [("a", (), ">f8")]), helpers.add_cell_data(helpers.tri_mesh, [("a", (2,), ">f8")]), helpers.add_cell_data(helpers.tri_mesh, [("a", (3,), ">f8")]), helpers.add_cell_data( helpers.add_point_data(helpers.tri_mesh_2d, 2), [("a", (2,), ">f8")] ), ] @pytest.mark.parametrize("mesh", test_set) @pytest.mark.parametrize("binary", [True, False]) def test(mesh, binary):
import helpers lxml = pytest.importorskip("lxml") test_set_full = [ helpers.tri_mesh, helpers.tri_mesh_2d, helpers.triangle6_mesh, helpers.quad_mesh, helpers.quad8_mesh, helpers.tri_quad_mesh, helpers.tet_mesh, helpers.tet10_mesh, helpers.hex_mesh, helpers.hex20_mesh, helpers.add_point_data(helpers.tri_mesh, 1), helpers.add_cell_data(helpers.tri_mesh, 1), ] test_set_reduced = [ helpers.tri_mesh, helpers.tri_mesh_2d, helpers.quad_mesh, helpers.tri_quad_mesh, helpers.tet_mesh, helpers.hex_mesh, helpers.add_point_data(helpers.tri_mesh, 1), helpers.add_cell_data(helpers.tri_mesh, 1), ]