From 9b0bebdd3b6e36c7662e635c7842c027d9799d3d Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Tue, 16 Jun 2020 13:38:38 +0200 Subject: [PATCH] Deal with new VTK unstructuredgrid memory storage --- src/MEDCoupling_Swig/vtk2medcoupling.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/MEDCoupling_Swig/vtk2medcoupling.py b/src/MEDCoupling_Swig/vtk2medcoupling.py index 5b1069d23..1e3bb97f0 100644 --- a/src/MEDCoupling_Swig/vtk2medcoupling.py +++ b/src/MEDCoupling_Swig/vtk2medcoupling.py @@ -11,6 +11,8 @@ def mesh_convertor(fileName): return mesh_convertor_mem(ug),ug def mesh_convertor_mem(ug): + from distutils.version import LooseVersion + # pts = numpy_support.vtk_to_numpy(ug.GetPoints().GetData()) # cla = numpy_support.vtk_to_numpy(ug.GetCellLocationsArray()) @@ -20,6 +22,10 @@ def mesh_convertor_mem(ug): ct=mc.DataArrayInt(np.array(ctvtk,dtype=np.int32))[:] c=mc.DataArrayInt(conn)[:] ci=mc.DataArrayInt(cla)[:] + # for pv580 + if LooseVersion(vtk.VTK_VERSION) >= LooseVersion("8.90.0"): + ci = ci.deltaShiftIndex()+1 + ci.computeOffsetsFull() # vtk2med = mc.DataArrayInt(mc.vtk2med_cell_types()) # -- 2.39.2