예제 #1
0
 def test_compress(self, tmp_path):
     points = np.random.rand(102, 3)
     v = VTK.from_poly_data(points)
     fname_c = tmp_path / 'compressed.vtp'
     fname_p = tmp_path / 'plain.vtp'
     v.save(fname_c, parallel=False, compress=False)
     v.save(fname_p, parallel=False, compress=True)
     assert (VTK.load(fname_c).__repr__() == VTK.load(fname_p).__repr__())
예제 #2
0
 def test_polyData(self, tmp_path):
     points = np.random.rand(100, 3)
     v = VTK.from_poly_data(points)
     string = v.__repr__()
     v.save(tmp_path / 'polyData', False)
     vtp = VTK.load(tmp_path / 'polyData.vtp')
     with open(tmp_path / 'polyData.vtk', 'w') as f:
         f.write(string)
     vtk = VTK.load(tmp_path / 'polyData.vtk', 'polyData')
     assert (string == vtp.__repr__() == vtk.__repr__())
예제 #3
0
 def test_compare_reference_polyData(self, update, ref_path, tmp_path):
     points = np.dstack((np.linspace(0., 1., 10), np.linspace(0., 2., 10),
                         np.linspace(-1., 1., 10))).squeeze()
     polyData = VTK.from_poly_data(points)
     polyData.add(points, 'coordinates')
     if update:
         polyData.save(ref_path / 'polyData')
     else:
         reference = VTK.load(ref_path / 'polyData.vtp')
         assert polyData.__repr__() == reference.__repr__() and \
                np.allclose(polyData.get('coordinates'),points)
예제 #4
0
 def test_parallel_out(self, tmp_path):
     points = np.random.rand(102, 3)
     v = VTK.from_poly_data(points)
     fname_s = tmp_path / 'single.vtp'
     fname_p = tmp_path / 'parallel.vtp'
     v.save(fname_s, False)
     v.save(fname_p, True)
     for i in range(10):
         if os.path.isfile(fname_p) and filecmp.cmp(fname_s, fname_p):
             assert (True)
             return
         time.sleep(.5)
     assert (False)
예제 #5
0
 def test_filename_variations(self, tmp_path, fname):
     points = np.random.rand(102, 3)
     v = VTK.from_poly_data(points)
     v.save(tmp_path / fname)