Exemple #1
0
 def test_polyData(self, tmp_path):
     points = np.random.rand(3, 100)
     v = VTK.from_polyData(points)
     s = v.__repr__()
     v.write(os.path.join(tmp_path, 'polyData'))
     v = VTK.from_file(os.path.join(tmp_path, 'polyData.vtp'))
     assert (s == v.__repr__())
Exemple #2
0
 def test_unstructuredGrid(self, tmp_path, cell_type, n):
     nodes = np.random.rand(n, 3)
     connectivity = np.random.choice(np.arange(n), n, False).reshape(-1, n)
     v = VTK.from_unstructuredGrid(nodes, connectivity, cell_type)
     s = v.__repr__()
     v.write(os.path.join(tmp_path, 'unstructuredGrid'))
     v = VTK.from_file(os.path.join(tmp_path, 'unstructuredGrid.vtu'))
     assert (s == v.__repr__())
Exemple #3
0
 def test_rectilinearGrid(self, tmp_path):
     grid = np.random.randint(5, 10, 3) * 2
     size = np.random.random(3) + 1.0
     origin = np.random.random(3)
     v = VTK.from_rectilinearGrid(grid, size, origin)
     s = v.__repr__()
     v.write(os.path.join(tmp_path, 'rectilinearGrid'))
     v = VTK.from_file(os.path.join(tmp_path, 'rectilinearGrid.vtr'))
     assert (s == v.__repr__())