attempt to fix parallel writing on MacOS

should resolve TypeError: cannot pickle
'vtkmodules.vtkIOXML.vtkXMLRectilinearGridWriter' object error
This commit is contained in:
Martin Diehl 2020-08-03 18:19:38 +02:00 committed by Philip Eisenlohr
parent e40ac13cad
commit ae20f5ffe6
1 changed files with 6 additions and 2 deletions

View File

@ -190,9 +190,13 @@ class VTK:
writer.SetCompressorTypeToZLib()
writer.SetDataModeToBinary()
writer.SetInputData(self.geom)
if parallel:
mp_writer = mp.Process(target=self._write,args=(writer,))
mp_writer.start()
try:
mp_writer = mp.Process(target=self._write,args=(writer,))
mp_writer.start()
except TypeError:
writer.Write()
else:
writer.Write()