From: Anthony Geay Date: Fri, 15 Nov 2024 11:58:22 +0000 (+0100) Subject: [EDF31315] : Fix mix of cell types including polyhedra. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;ds=inline;p=tools%2Fmedcoupling.git [EDF31315] : Fix mix of cell types including polyhedra. --- 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)