From c87948038688dd9b45727ccfb67553de227e64b0 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Fri, 15 Nov 2024 12:58:22 +0100 Subject: [PATCH] [EDF31315] : Fix mix of cell types including polyhedra. --- src/MEDCoupling_Swig/vtk2medcoupling.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/MEDCoupling_Swig/vtk2medcoupling.py b/src/MEDCoupling_Swig/vtk2medcoupling.py index 022e30105..65debb192 100644 --- a/src/MEDCoupling_Swig/vtk2medcoupling.py +++ b/src/MEDCoupling_Swig/vtk2medcoupling.py @@ -34,7 +34,8 @@ def patchForPolyedra(polyhedCellIds, ug, mesh): :param in-out mesh: mc.MEDCouplingUMesh. 3D Mesh whose polyedra cells connectivity will be modified """ facesLoc = mc.DataArrayInt( numpy_support.vtk_to_numpy( ug.GetFaceLocations() ) ) - faces = mc.DataArrayInt( numpy_support.vtk_to_numpy( ug.GetFaces() ) ) + faces = mc.DataArrayInt( numpy_support.vtk_to_numpy( ug.GetFaces() ) ) + facesLoc = facesLoc[ polyhedCellIds ] facesLoc = mc.DataArrayInt.Aggregate( [ facesLoc, mc.DataArrayInt([ len(faces) ]) ] ) connForPoly, facesLoc = mc.DataArrayInt.FromVTKInternalReprOfPolyedra(faces,facesLoc) meshPoly = mc.MEDCoupling1DGTUMesh(mesh.getName(),mc.NORM_POLYHED) ; meshPoly.setCoords( mesh.getCoords() ) ; meshPoly.setNodalConnectivity(connForPoly,facesLoc) -- 2.39.2