diff --git a/python/damask/_geom.py b/python/damask/_geom.py index 6632eb5ed..4e2764803 100644 --- a/python/damask/_geom.py +++ b/python/damask/_geom.py @@ -513,7 +513,7 @@ class Geom: v.add(self.microstructure.flatten(order='F'),'materialpoint') if fname: - v.write(fname if str(fname).endswith('.vtr') else str(fname)+'.vtr') + v.to_file(fname if str(fname).endswith('.vtr') else str(fname)+'.vtr') else: sys.stdout.write(v.__repr__()) diff --git a/python/damask/_result.py b/python/damask/_result.py index 8e5bb2e8b..b024da43e 100644 --- a/python/damask/_result.py +++ b/python/damask/_result.py @@ -1264,4 +1264,4 @@ class Result: u = self.read_dataset(self.get_dataset_location('u_n' if mode.lower() == 'cell' else 'u_p')) v.add(u,'u') - v.write(f'{self.fname.stem}_inc{inc[3:].zfill(N_digits)}') + v.to_file(f'{self.fname.stem}_inc{inc[3:].zfill(N_digits)}') diff --git a/python/damask/_vtk.py b/python/damask/_vtk.py index 349e158ca..53a674c46 100644 --- a/python/damask/_vtk.py +++ b/python/damask/_vtk.py @@ -165,7 +165,7 @@ class VTK: def _write(writer): """Wrapper for parallel writing.""" writer.Write() - def write(self,fname,parallel=True): + def to_file(self,fname,parallel=True): """ Write to file. diff --git a/python/tests/test_Geom.py b/python/tests/test_Geom.py index 479dd43fc..d260bbacb 100644 --- a/python/tests/test_Geom.py +++ b/python/tests/test_Geom.py @@ -80,7 +80,7 @@ class TestGeom: def test_invalid_vtr(self,tmpdir): v = VTK.from_rectilinearGrid(np.random.randint(5,10,3)*2,np.random.random(3) + 1.0) - v.write(tmpdir/'no_materialpoint.vtr') + v.to_file(tmpdir/'no_materialpoint.vtr') for _ in range(10): time.sleep(.2) if os.path.exists(tmpdir/'no_materialpoint.vtr'): break diff --git a/python/tests/test_VTK.py b/python/tests/test_VTK.py index 91ff4033c..1c98522e4 100644 --- a/python/tests/test_VTK.py +++ b/python/tests/test_VTK.py @@ -21,7 +21,7 @@ class TestVTK: origin = np.random.random(3) v = VTK.from_rectilinearGrid(grid,size,origin) string = v.__repr__() - v.write(tmp_path/'rectilinearGrid',False) + v.to_file(tmp_path/'rectilinearGrid',False) vtr = VTK.from_file(tmp_path/'rectilinearGrid.vtr') with open(tmp_path/'rectilinearGrid.vtk','w') as f: f.write(string) @@ -32,7 +32,7 @@ class TestVTK: points = np.random.rand(100,3) v = VTK.from_polyData(points) string = v.__repr__() - v.write(tmp_path/'polyData',False) + v.to_file(tmp_path/'polyData',False) vtp = VTK.from_file(tmp_path/'polyData.vtp') with open(tmp_path/'polyData.vtk','w') as f: f.write(string) @@ -51,7 +51,7 @@ class TestVTK: connectivity = np.random.choice(np.arange(n),n,False).reshape(-1,n) v = VTK.from_unstructuredGrid(nodes,connectivity,cell_type) string = v.__repr__() - v.write(tmp_path/'unstructuredGrid',False) + v.to_file(tmp_path/'unstructuredGrid',False) vtu = VTK.from_file(tmp_path/'unstructuredGrid.vtu') with open(tmp_path/'unstructuredGrid.vtk','w') as f: f.write(string) @@ -64,8 +64,8 @@ class TestVTK: v = VTK.from_polyData(points) fname_s = tmp_path/'single.vtp' fname_p = tmp_path/'parallel.vtp' - v.write(fname_s,False) - v.write(fname_p,True) + v.to_file(fname_s,False) + v.to_file(fname_p,True) for i in range(10): if os.path.isfile(fname_p) and filecmp.cmp(fname_s,fname_p): assert(True) @@ -105,4 +105,3 @@ class TestVTK: else: reference = VTK.from_file(reference_dir/'rectilinearGrid.vtr') assert rectilinearGrid.__repr__() == reference.__repr__() -