Salome HOME
Debug of MEDCouplingUMesh::areCellsIncludedInMe : now duplicated cells in mesh that...
[tools/medcoupling.git] / src / MEDCoupling_Swig / MEDCouplingBasicsTest5.py
index 0bc7f7898f82cf5a15f281a8b978236e504ac16f..1bd4d3afb40d4f7ed7f46d4c93f8659daf2a04dd 100644 (file)
@@ -1,5 +1,5 @@
 #  -*- coding: utf-8 -*-
-# Copyright (C) 2007-2016  CEA/DEN, EDF R&D
+# Copyright (C) 2007-2020  CEA/DEN, EDF R&D
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-from MEDCoupling import *
+import sys
+if sys.platform == "win32":
+    from MEDCouplingCompat import *
+else:
+    from medcoupling import *
+
 import unittest
 from math import pi,e,sqrt,cos,sin
 from datetime import datetime
@@ -601,7 +606,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         m=MEDCoupling1SGTUMesh("m",NORM_QUAD4)
         mem_m=m.getHeapMemorySize()
         m.allocateCells(5)
-        self.assertIn(m.getHeapMemorySize() - mem_m, list(range(5 * 4 * 4, 5 * 4 * 4 + 32)))
+        self.assertIn(m.getHeapMemorySize() - mem_m, list(range(5 * 4 * MEDCouplingSizeOfIDs()//8, 5 * 4 * MEDCouplingSizeOfIDs()//8 + 32)))
         self.assertEqual(m.getNodalConnectivity().getNbOfElemAllocated(),20)
         m.setCoords(um.getCoords())
         m.insertNextCell([1,0,6,7])
@@ -1014,7 +1019,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         self.assertEqual(d.getInfoOnComponents(),["aa","bbb"])
         ref=d.getHeapMemorySize()
         d.desallocate()
-        self.assertEqual(ref-d.getHeapMemorySize(),6*4)
+        self.assertEqual(ref-d.getHeapMemorySize(),6*MEDCouplingSizeOfIDs()//8)
         self.assertTrue(not d.isAllocated())
         self.assertEqual(d.getInfoOnComponents(),["aa","bbb"])
         self.assertRaises(InterpKernelException,d.checkAllocated)
@@ -1462,7 +1467,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         self.assertEqual(f4.getMesh(),None)
         pass
 
-    # test a simple node to cell convertion of a field
+    # test a simple node to cell conversion of a field
     def testSwig2NodeToCellDiscretization1(self):
         f=MEDCouplingFieldDouble(ON_NODES) ; f.setTime(1.1,2,3)
         a1=DataArrayDouble(4) ; a1.iota()
@@ -1891,7 +1896,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         gaussCoords=refCoords[:] ; gaussCoords[14]=0.9999999999999 # change z of point #4 0.999... instead of 1. because with shape function it leads to division by 0. !
         fGauss.setGaussLocalizationOnType(NORM_PYRA13,refCoords,gaussCoords,weights)
         arrOfDisc2=fGauss.getLocalizationOfDiscr()
-        self.assertTrue(arrOfDisc2.isEqual(coo,1e-10)) # be less exigent 1e-10 instead of 1e-12 due to shape function sensitivity arount 0.,0.,1. !
+        self.assertTrue(arrOfDisc2.isEqual(coo,1e-10)) # be less exigent 1e-10 instead of 1e-12 due to shape function sensitivity around 0.,0.,1. !
         pass
 
     def testSwig2Tri7GP1(self):
@@ -2002,6 +2007,26 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         self.assertTrue(m.getNodalConnectivityIndex().isEqual(DataArrayInt([0,7])))
         pass
 
+    def testSwig2ColinearizeKeepingConform2D1(self):
+        eps = 1.0e-6
+        # Just to get a nice coords array ...
+        mm = MEDCouplingCMesh(); arr = DataArrayDouble([0.0, 1.0,2.0])
+        mm.setCoords(arr, arr);  mm = mm.buildUnstructured();   coo = mm.getCoords()
+         
+        mesh = MEDCouplingUMesh("M", 2)
+        mesh.setCoords(coo)
+        c = [NORM_POLYGON, 0,1,4,7,6,3,  NORM_QUAD4, 1,2,5,4,  NORM_QUAD4,4,5,8,7]
+        cI = [0, 7,12,17]
+        mm.setConnectivity(DataArrayInt(c),DataArrayInt(cI))
+        mm.checkConsistencyLight()
+        
+        mm.colinearizeKeepingConform2D(eps)
+        c = mm.getNodalConnectivity().getValues()
+        cI = mm.getNodalConnectivityIndex().getValues()
+        self.assertEqual(c, [NORM_POLYGON, 0, 1, 4, 7, 6, NORM_POLYGON, 1, 2, 5, 4, NORM_POLYGON, 4, 5, 8, 7])
+        self.assertEqual(cI, [0,6,11,16])
+        pass
+
     def testSwig2BoundingBoxForBBTree1(self):
         """ This test appears simple but it checks that bounding box are correctly computed for quadratic polygons. It can help a lot to reduce the amount of intersections !
         """
@@ -2123,7 +2148,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         pass
 
     def testSwig2Colinearize2D3(self):
-        """ colinearize was too agressive, potentially producing cells with one edge """
+        """ colinearize was too aggressive, potentially producing cells with one edge """
         # Flat polygon  with 3 edges - nothing should happen (min number of edges for a linear polyg)
         coo = DataArrayDouble([0.0,0.0,  2.0,0.0,   1.5,0.0,  1.0,0.0,  0.5,0.0], 5,2)
         m = MEDCouplingUMesh("m", 2)
@@ -2171,6 +2196,23 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         self.assertTrue( m.getCoords()[8].isEqual( DataArrayDouble([(1.0,0.0)]), 1.0e-12 ) )
         self.assertEqual([0,5], m.getNodalConnectivityIndex().getValues())
 
+    def testSwig2Colinearize2D4(self):
+        """ From ALAMOS. Colinearize around last seg in the connectivity was buggy. """
+        mesh = MEDCouplingUMesh('C3', 2)
+        coo = DataArrayDouble([(-31.838400909874,21.557335816426),(-34.588400909874,16.794196095611),(-33.298676775512,19.225000000000),(-33.547226066398,19.368500000000),(-32.750140188627,22.083728734445),(-35.500140188627,17.320589013630),
+                               (-35.044270549250,17.057392554621),(-32.619779010901,22.008464673393),(-32.554667298175,21.970872408523),(-32.745177043525,22.080863261284),(-32.747658616076,22.082295997864),(-32.682478027213,22.044663967338)])
+        mesh.setCoords(coo)
+        c = DataArrayInt([32, 0, 1, 5, 4, 9, 7, 2, 6, 3, 10, 11, 8])
+        cI = DataArrayInt([0, 13])
+        mesh.setConnectivity(c, cI)
+        mesh.colinearize2D(1.0e-8)
+        coo = mesh.getCoords()
+        self.assertEqual(coo.getNumberOfTuples(), 13)
+        lstPt = coo[12]
+        self.assertAlmostEqual(lstPt[0,0], -32.29427054925)
+        self.assertAlmostEqual(lstPt[0,1], 21.8205322754351)
+        pass
+
     def testSwig2CheckAndPreparePermutation2(self):
         a=DataArrayInt([10003,9999999,5,67])
         self.assertTrue(DataArrayInt.CheckAndPreparePermutation(a).isEqual(DataArrayInt([2,3,0,1])))
@@ -3843,9 +3885,9 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         m.setCoords(arrX,arrX)
         f=MEDCouplingFieldInt(ON_CELLS)
         f.setMesh(m)
-        arr=DataArrayInt(8) ; arr.iota() ;f.setArray(arr)
+        arr=DataArrayInt32(8) ; arr.iota() ;f.setArray(arr)
         self.assertRaises(InterpKernelException,f.checkConsistencyLight)
-        arr=DataArrayInt(9) ; arr.iota() ;f.setArray(arr)
+        arr=DataArrayInt32(9) ; arr.iota() ;f.setArray(arr)
         f.checkConsistencyLight()
         f.setTimeUnit("ms")
         self.assertEqual(f.getTimeUnit(),"ms")
@@ -3893,41 +3935,41 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         m1=MEDCouplingCMesh() ; m1.setCoords(DataArrayDouble([0,1,2,3]),DataArrayDouble([0,1,2,3,4]))
         m1=m1.buildUnstructured() ; m1.setName("mesh")
         f1=MEDCouplingFieldInt(ON_CELLS) ; f1.setMesh(m1)
-        arr1=DataArrayInt([(0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23)]) ; arr1.setInfoOnComponents(["aa","bbb"])
+        arr1=DataArrayInt32([(0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23)]) ; arr1.setInfoOnComponents(["aa","bbb"])
         f1.setArray(arr1) ; f1.setName("f1") ; f1.setTime(2.,3,4)
         #
         m2=MEDCouplingCMesh() ; m2.setCoords(DataArrayDouble([0,1,2,3]),DataArrayDouble([0,1,2,3,4]))
         m2=m2.buildUnstructured() ; m2.setName("mesh")
         f2=MEDCouplingFieldInt(ON_CELLS) ; f2.setMesh(m2)
-        arr2=DataArrayInt([(0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23)]) ; arr2.setInfoOnComponents(["aa","bbb"])
+        arr2=DataArrayInt32([(0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23)]) ; arr2.setInfoOnComponents(["aa","bbb"])
         f2.setArray(arr2) ; f2.setName("f1") ; f2.setTime(2.,3,4)
         #
-        self.assertTrue(f1.isEqual(f2,1e-12,0.))
+        self.assertTrue(f1.isEqual(f2,1e-12,0))
         f1.getArray()[:]*=2
-        self.assertTrue(not f1.isEqual(f2,1e-12,0.))
-        self.assertTrue(not f1.isEqualWithoutConsideringStr(f2,1e-12,0.))
+        self.assertTrue(not f1.isEqual(f2,1e-12,0))
+        self.assertTrue(not f1.isEqualWithoutConsideringStr(f2,1e-12,0))
         f1.getArray()[:]/=2
-        self.assertTrue(f1.isEqual(f2,1e-12,0.))
+        self.assertTrue(f1.isEqual(f2,1e-12,0))
         #
         f1.setName("F1")
-        self.assertTrue(not f1.isEqual(f2,1e-12,0.))
+        self.assertTrue(not f1.isEqual(f2,1e-12,0))
         f1.setName("f1")
-        self.assertTrue(f1.isEqual(f2,1e-12,0.))
+        self.assertTrue(f1.isEqual(f2,1e-12,0))
         #
         f1.getArray().setInfoOnComponents(["aa","bbbb"])
-        self.assertTrue(not f1.isEqual(f2,1e-12,0.))
-        self.assertTrue(f1.isEqualWithoutConsideringStr(f2,1e-12,0.))
+        self.assertTrue(not f1.isEqual(f2,1e-12,0))
+        self.assertTrue(f1.isEqualWithoutConsideringStr(f2,1e-12,0))
         f1.getArray().setInfoOnComponents(["aa","bbb"])
-        self.assertTrue(f1.isEqual(f2,1e-12,0.))
+        self.assertTrue(f1.isEqual(f2,1e-12,0))
         #
         f3=f2.deepCopy()
-        self.assertTrue(f1.isEqual(f3,1e-12,0.))
+        self.assertTrue(f1.isEqual(f3,1e-12,0))
         #
         for fd,expected in ((ON_NODES,False),(ON_CELLS,True)):
             f4=MEDCouplingFieldInt(fd) ; f4.setMesh(m2) ; f4.setTime(2.,3,4)
-            arr4=DataArrayInt([(0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23)]) ; arr4.setInfoOnComponents(["aa","bbb"])
+            arr4=DataArrayInt32([(0,1),(2,3),(4,5),(6,7),(8,9),(10,11),(12,13),(14,15),(16,17),(18,19),(20,21),(22,23)]) ; arr4.setInfoOnComponents(["aa","bbb"])
             f4.setArray(arr4) ; f4.setName("f1")
-            self.assertEqual(f1.isEqual(f4,1e-12,0.),expected)
+            self.assertEqual(f1.isEqual(f4,1e-12,0),expected)
             pass
         pass
 
@@ -4276,6 +4318,35 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         self.assertEqual(fieldOnCell.getMesh().buildDescendingConnectivity()[0].getNumberOfCells(),2*7+21)
         pass
 
+    def testVoronoi3D_8(self):
+        """More aggressive 3D test. Bug EDF 15094"""
+        mesh = MEDCouplingUMesh("myMeshForAnthony",3)
+        coords = [2.20449946892035, 0.0015302058397972198, -0.014025000000000001, 2.20449522028465, 0.00459061457029268, -0.0109750000232271, 2.20449946892035, 0.0015302058397972198, -0.0125000000116135, 2.20577243296484, 0.00153108944037966, -0.0137555135576553, 2.20517315768831, 0.0045920262990614006, -0.010764118475206199, 2.2054749202977, 0.0015308829283677198, -0.012259816016430801, 2.20449787568164, 0.00306041094231961, -0.0125000000116135, 2.20449787568164, 0.00306041094231961, -0.011737500017420301, 2.20449946892035, 0.0015302058397972198, -0.0132625000058068, 2.20513595094259, 0.0015306476400884401, -0.0138902567788277, 2.20483418898648, 0.0045913204346770395, -0.0108695592492167, 2.20498719460902, 0.00153054438408247, -0.0123799080140222, 2.20547332635401, 0.0030617651191343705, -0.012259816016430801, 2.20532457012796, 0.00306155860717217, -0.0115119672458185, 2.20562367663127, 0.0015309861843736902, -0.013007664787043, 2.20582504233773, 0.0045933837758852306, -0.010139577890770399, 2.20642582267143, 0.004594634833691141, -0.009125379014333041, 2.20612543250458, 0.00459400930478819, -0.00963247845255172, 2.2069524110381, 0.004595731395029229, -0.00776049693994639, 2.20668911685476, 0.004595183114360191, -0.00844293797713971, 2.20832419990944, 0.0076643330146060895, -0.0108392857142857, 2.20832419990944, 0.0076643330146060895, -0.008671428571428571, 2.20704504094678, 0.00765989349423635, -0.008671428571428571, 2.20704504094678, 0.00765989349423635, -0.0108392857142857, 2.2062381754171, 0.00459424407928538, -0.00868052596233734, 2.20832419990944, 0.0076643330146060895, -0.00975535714285714, 2.20768462042811, 0.00766211325442122, -0.008671428571428571, 2.20704504094678, 0.00765989349423635, -0.00975535714285714, 2.20768462042811, 0.00766211325442122, -0.0108392857142857, 2.20737554490036, 0.00612882358882901, -0.009982332364309381, 2.20763883863969, 0.00612955462931014, -0.00821596275568748, 2.2066421405633703, 0.00612678727660696, -0.00867597726688296, 2.20643557437203, 0.006126213741329251, -0.0104894318025281, 2.2065952932276, 0.00459498773715731, -0.00822051145114186, 2.20603160887741, 0.00459381392758531, -0.00941005192655387]
+        da = DataArrayDouble.New(coords,35,3)
+        mesh.setCoords(da)
+        mesh.allocateCells()
+        mesh.insertNextCell(NORM_PENTA15, [0, 2, 1, 3, 5, 4, 8, 7, 6, 14, 13, 12, 9, 11, 10])
+        mesh.insertNextCell(NORM_HEXA20, [20, 23, 22, 21, 16, 15, 24, 18, 28, 27, 26, 25, 17, 34, 33, 19, 29, 32, 31, 30])
+        mesh.zipCoords()
+        f=MEDCouplingFieldDouble(ON_GAUSS_PT)
+        f.setMesh(mesh)
+        f.setName("myFieldForAnthony")
+        f.setGaussLocalizationOnCells([0],[-1, 1, 0, -1, 0, 0, -1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, -1, 0.5, 0, -1, 0, 0.5, -1, 0.5, 0.5, 1, 0.5, 0, 1, 0, 0.5, 1, 0.5, 0.5, 0, 1, 0, 0, 0, 0, 0, 0, 1],[-0.774597, 0.333333, 0.333333, -0.774597, 0.470142, 0.470142, -0.774597, 0.0597159, 0.470142, -0.774597, 0.470142, 0.0597159, -0.774597, 0.101287, 0.101287, -0.774597, 0.797427, 0.101287, -0.774597, 0.101287, 0.797427, 0, 0.333333, 0.333333, 0, 0.470142, 0.470142, 0, 0.0597159, 0.470142, 0, 0.470142, 0.0597159, 0, 0.101287, 0.101287, 0, 0.797427, 0.101287, 0, 0.101287, 0.797427, 0.774597, 0.333333, 0.333333, 0.774597, 0.470142, 0.470142, 0.774597, 0.0597159, 0.470142, 0.774597, 0.470142, 0.0597159, 0.774597, 0.101287, 0.101287, 0.774597, 0.797427, 0.101287, 0.774597, 0.101287, 0.797427],[0.0625, 0.0367762, 0.0367762, 0.0367762, 0.0349831, 0.0349831, 0.0349831, 0.1, 0.0588418, 0.0588418, 0.0588418, 0.055973, 0.055973, 0.055973, 0.0625, 0.0367762, 0.0367762, 0.0367762, 0.0349831, 0.0349831, 0.0349831])
+        f.setGaussLocalizationOnCells([1],[-1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 0, -1, 0, 1, -1, 1, 0, -1, 0, -1, -1, -1, 0, 1, 0, 1, 1, 1, 0, 1, 0, -1, 1, -1, -1, 0, -1, 1, 0, 1, 1, 0, 1, -1, 0],[-0.774597, -0.774597, -0.774597, -0.774597, -0.774597, 0, -0.774597, -0.774597, 0.774597, -0.774597, 0, -0.774597, -0.774597, 0, 0, -0.774597, 0, 0.774597, -0.774597, 0.774597, -0.774597, -0.774597, 0.774597, 0, -0.774597, 0.774597, 0.774597, 0, -0.774597, -0.774597, 0, -0.774597, 0, 0, -0.774597, 0.774597, 0, 0, -0.774597, 0, 0, 0, 0, 0, 0.774597, 0, 0.774597, -0.774597, 0, 0.774597, 0, 0, 0.774597, 0.774597, 0.774597, -0.774597, -0.774597, 0.774597, -0.774597, 0, 0.774597, -0.774597, 0.774597, 0.774597, 0, -0.774597, 0.774597, 0, 0, 0.774597, 0, 0.774597, 0.774597, 0.774597, -0.774597, 0.774597, 0.774597, 0, 0.774597, 0.774597, 0.774597],[0.171468, 0.274348, 0.171468, 0.274348, 0.438957, 0.274348, 0.171468, 0.274348, 0.171468, 0.274348, 0.438957, 0.274348, 0.438957, 0.702332, 0.438957, 0.274348, 0.438957, 0.274348, 0.171468, 0.274348, 0.171468, 0.274348, 0.438957, 0.274348, 0.171468, 0.274348, 0.171468])
+        arr = DataArrayDouble(48, 3)
+        arr[:, 0] = list(range(48))
+        arr[:, 1] = 100 + arr[:, 0]
+        arr[:, 2] = 200 + arr[:, 0]
+        f.setArray(arr)
+        fieldOnCell=f.voronoize(1e-12) # hot point
+        fieldOnCell.checkConsistencyLight()
+        self.assertEqual(fieldOnCell.getMesh().getNumberOfCells(),48)
+        self.assertEqual(fieldOnCell.getMesh().getNumberOfNodes(),127)
+        meaRef=f.getMesh().getMeasureField(True).getArray(); meaRef.rearrange(2); meaRef2 = meaRef.sumPerTuple()
+        mea=fieldOnCell.getMesh().getMeasureField(True).getArray(); mea.rearrange(48); mea2 = mea.sumPerTuple()
+        self.assertTrue(mea2.isEqual(meaRef2,1e-9))
+        pass
+
     def testVoronoi3DSurf_1(self):
         tmp=MEDCouplingCMesh("mesh")
         arr=DataArrayDouble(5) ; arr.iota()
@@ -4445,7 +4516,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         self.assertTrue(f3.getMesh().getMeasureField(False).getArray().isEqual(ref,1e-12))
         self.assertTrue(f3.getArray().isEqual(DataArrayDouble([0,1,2,3]),1e-12))
         pass
-    
+
     def testVoronoi3D_4(self):
         """Idem testVoronoi3D_3 except that here quadratic cells are considered"""
         coo=DataArrayDouble([0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.5,0.0,0.0,0.0,0.5,0.0,0.5,0.5,0.5,0.5,0.0,0.5,0.0,0.0,0.5,0.0,0.5],10,3)
@@ -4462,6 +4533,60 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         self.assertTrue(f3.getArray().isEqual(DataArrayDouble([0,1,2,3]),1e-12))
         pass
 
+    def testVoronoi3D_5(self):
+        """ Cell 0 of Barreau_Elga_V11.rmed and sslv07b.rmed. HEXA8 cut regularly into 8 parts"""
+        coo=DataArrayDouble([(0.024,0.024,1.2),(0.024,0.048,1.2),(0.048,0.024,1.2),(0.048,0.048,1.2),(0.024,0.024,1.6),(0.024,0.048,1.6),(0.048,0.024,1.6),(0.048,0.048,1.6)])
+        m=MEDCouplingUMesh("",3) ; m.setCoords(coo) ; m.allocateCells()
+        m.insertNextCell(NORM_HEXA8,[0,2,6,4,1,3,7,5])
+        f=MEDCouplingFieldDouble(ON_GAUSS_PT) ; f.setMesh(m)
+        f.setGaussLocalizationOnType(NORM_HEXA8,[-1.0, -1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, 1.0],[-0.577350269189626, -0.577350269189626, -0.577350269189626, -0.577350269189626, -0.577350269189626, 0.577350269189626, -0.577350269189626, 0.577350269189626, -0.577350269189626, -0.577350269189626, 0.577350269189626, 0.577350269189626, 0.577350269189626, -0.577350269189626, -0.577350269189626, 0.577350269189626, -0.577350269189626, 0.577350269189626, 0.577350269189626, 0.577350269189626, -0.577350269189626, 0.577350269189626, 0.577350269189626, 0.577350269189626],[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0])
+        arr=DataArrayDouble(8) ; arr.iota() ; f.setArray(arr)
+        f.checkConsistencyLight()
+        #
+        vol=f.getMesh().getMeasureField(False).getIJ(0,0)
+        f2=f.voronoize(1e-12)
+        f2.checkConsistencyLight()
+        self.assertEqual(f2.getNumberOfTuples(),8)
+        volRef=vol/8
+        self.assertTrue(f2.getMesh().getMeasureField(False).getArray().isUniform(volRef,1e-12))
+        pass
+
+    def testVoronoi3D_6(self):
+        """ Cell 0 of brokenshire.med (and pace.med). TETRA10 split into 4 parts"""
+        coo=DataArrayDouble([(50.,-50.,200.0),(50.0,-30.,200.0),(30.,-50.,200.0),(50.,-50.,180.0),(50.,-40.,200.0),(40.,-50.,200.0),(50.,-50.,190.0),(40.,-40.,200.0),(50.,-40.,190.0),(40.,-50.,190.0)])
+        m=MEDCouplingUMesh("",3) ; m.setCoords(coo) ; m.allocateCells()
+        m.insertNextCell(NORM_TETRA10,[2,0,1,3,5,4,7,9,6,8])
+        f=MEDCouplingFieldDouble(ON_GAUSS_PT) ; f.setMesh(m)
+        f.setGaussLocalizationOnType(NORM_TETRA10,[0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0.5, 0.5, 0.5, 0.5, 0, 0.5, 0, 0, 0.5, 0, 0.5],[0.1381966011250105, 0.1381966011250105, 0.1381966011250105, 0.1381966011250105, 0.1381966011250105, 0.5854101966249685, 0.1381966011250105, 0.5854101966249685, 0.1381966011250105, 0.5854101966249685, 0.1381966011250105, 0.1381966011250105],[0.041666666666666664, 0.041666666666666664, 0.041666666666666664, 0.041666666666666664])
+        arr=DataArrayDouble(4) ; arr.iota() ; f.setArray(arr)
+        f.checkConsistencyLight()
+        f2=f.voronoize(1e-12)
+        f2.checkConsistencyLight()
+        self.assertEqual(f2.getNumberOfTuples(),4)
+        arr=f2.getMesh().getMeasureField(False).getArray()
+        self.assertTrue(f2.getMesh().getMeasureField(False).getArray().isEqual(DataArrayDouble([378.0546928833331, 318.42621348333586, 318.4262134833361, 318.4262134833278]),1e-6))
+        pass
+
+    def testVoronoi3D_7(self):
+        """ sslv07a.rmed. HEXA20 split into 27 parts """
+        coo=DataArrayDouble([(-0.5,-0.5,0.0),(-0.25,-0.5,0.0),(0.0,-0.5,0.0),(-0.5,0.0,0.0),(-0.5,-0.25,0.0),(0.0,0.0,0.0),(0.0,-0.25,0.0),(-0.25,0.0,0.0),(-0.5,-0.5,1.0),(-0.25,-0.5,1.0),(0.0,-0.5,1.0),(0.0,-0.25,1.0),(0.0,0.0,1.0),(-0.25,0.0,1.0),(-0.5,0.0,1.0),(-0.5,-0.25,1.0),(-0.5,-0.5,0.5),(0.0,-0.5,0.5),(0.0,0.0,0.5),(-0.5,0.0,0.5)])
+        m=MEDCouplingUMesh("",3) ; m.setCoords(coo) ; m.allocateCells()
+        m.insertNextCell(NORM_HEXA20,[0,3,5,2,8,14,12,10,4,7,6,1,15,13,11,9,16,19,18,17])
+        f=MEDCouplingFieldDouble(ON_GAUSS_PT) ; f.setMesh(m)
+        f.setGaussLocalizationOnType(NORM_HEXA20,
+                                     [-1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,-1,1,-1,1,1,1,1,1,1,-1,1,-1,0,-1,0,1,-1,1,0,-1,0,-1,-1,-1,0,1,0,1,1,1,0,1,0,-1,1,-1,-1,0,-1,1,0,1,1,0,1,-1,0],
+                                     [-0.774597,-0.774597,-0.774597,-0.774597,-0.774597,0,-0.774597,-0.774597,0.774597,-0.774597,0,-0.774597,-0.774597,0,0,-0.774597,0,0.774597,-0.774597,0.774597,-0.774597,-0.774597,0.774597,0,-0.774597,0.774597,0.774597,0,-0.774597,-0.774597,0,-0.774597,0,0,-0.774597,0.774597,0,0,-0.774597,0,0,0,0,0,0.774597,0,0.774597,-0.774597,0,0.774597,0,0,0.774597,0.774597,0.774597,-0.774597,-0.774597,0.774597,-0.774597,0,0.774597,-0.774597,0.774597,0.774597,0,-0.774597,0.774597,0,0,0.774597,0,0.774597,0.774597,0.774597,-0.774597,0.774597,0.774597,0,0.774597,0.774597,0.774597],
+                                     [0.171468,0.274348,0.171468,0.274348,0.438957,0.274348,0.171468,0.274348,0.171468,0.274348,0.438957,0.274348,0.438957,0.702332,0.438957,0.274348,0.438957,0.274348,0.171468,0.274348,0.171468,0.274348,0.438957,0.274348,0.171468,0.274348,0.171468])
+        arr=DataArrayDouble(27) ; arr.iota() ; f.setArray(arr)
+        f.checkConsistencyLight()
+        f2=f.voronoize(1e-12)
+        a=0.007187820185770747 ; b=0.0090870678008658 ; c=0.011488156225861077 ; d=0.014523687548277797
+        ref=DataArrayDouble(27) ; ref[::2]=a ; ref[1::2]=b
+        ref[[4,10,12,14,16,22]]=c ; ref[13]=d  # 6 cells 4,10,12,14,16,22 are the 6 cells boarding the most inner cell 13
+        #
+        self.assertTrue(f2.getMesh().getMeasureField(False).getArray().isEqual(ref,1e-7))
+        pass
+
     def testConvertQuadToLin4Gauss_1(self):
         coo=DataArrayDouble([0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.5,0.0,0.0,0.0,0.5,0.0,0.5,0.5,0.5,0.5,0.0,0.5,0.0,0.0,0.5,0.0,0.5],10,3)
         m=MEDCouplingUMesh("mesh",3)
@@ -4538,8 +4663,16 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
     def testUMeshComputeEnlargedNeighborsOfNodes(self):
         m=MEDCouplingCMesh() ; arr=DataArrayDouble(4) ; arr.iota() ; m.setCoords(arr,arr) ; m=m.buildUnstructured()
         a,b=m.computeEnlargedNeighborsOfNodes()
-        self.assertTrue(a.isEqual(DataArrayInt([1,4,5,0,2,4,5,6,1,3,5,6,7,2,6,7,0,1,5,8,9,0,1,2,4,6,8,9,10,1,2,3,5,7,9,10,11,2,3,6,10,11,4,5,9,12,13,4,5,6,8,10,12,13,14,5,6,7,9,11,13,14,15,6,7,10,14,15,8,9,13,8,9,10,12,14,9,10,11,13,15,10,11,14])))
-        self.assertTrue(b.isEqual(DataArrayInt([0,3,8,13,16,21,29,37,42,47,55,63,68,71,76,81,84])))
+        aExp=DataArrayInt([1,4,5,0,2,4,5,6,1,3,5,6,7,2,6,7,0,1,5,8,9,0,1,2,4,6,8,9,10,1,2,3,5,7,9,10,11,2,3,6,10,11,4,5,9,12,13,4,5,6,8,10,12,13,14,5,6,7,9,11,13,14,15,6,7,10,14,15,8,9,13,8,9,10,12,14,9,10,11,13,15,10,11,14])
+        bExp=DataArrayInt([0,3,8,13,16,21,29,37,42,47,55,63,68,71,76,81,84])
+        self.assertTrue(a.isEqual(aExp))
+        self.assertTrue(b.isEqual(bExp))
+        m2=m[[1,2,3]]
+        c,d=m2.computeEnlargedNeighborsOfNodes()
+        cExp=DataArrayInt([2,5,6,1,3,5,6,7,2,6,7,5,8,9,1,2,4,6,8,9,1,2,3,5,7,2,3,6,4,5,9,4,5,8])
+        dExp=DataArrayInt([0,0,3,8,11,14,20,25,28,31,34,34,34,34,34,34,34])
+        self.assertTrue(c.isEqual(cExp))
+        self.assertTrue(d.isEqual(dExp))
         pass
 
     def testDAIfindIdsExt1(self):
@@ -4554,14 +4687,14 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         """Test focused of new wrapped methods for MEDCouplingFieldInt thanks to code factorization."""
         d=DataArrayDouble(7) ; d.iota()
         m=MEDCouplingUMesh.Build1DMeshFromCoords(d)
-        f=MEDCouplingFieldInt(ON_CELLS) ; f.setMesh(m) ; arr=DataArrayInt(6) ; arr.iota() ; f.setArray(arr) ; f.checkConsistencyLight()
+        f=MEDCouplingFieldInt(ON_CELLS) ; f.setMesh(m) ; arr=DataArrayInt32(6) ; arr.iota() ; f.setArray(arr) ; f.checkConsistencyLight()
         f_0=f[::2] # test is here
-        self.assertTrue(f_0.getArray().isEqual(DataArrayInt([0,2,4])))
+        self.assertTrue(f_0.getArray().isEqual(DataArrayInt32([0,2,4])))
         self.assertTrue(f_0.getMesh().isEqual(m[[0,2,4]],1e-12))
         #
-        f2=MEDCouplingFieldInt(ON_NODES) ; f2.setMesh(m) ; arr=DataArrayInt(7) ; arr.iota() ; f2.setArray(arr) ; f2.checkConsistencyLight()
+        f2=MEDCouplingFieldInt(ON_NODES) ; f2.setMesh(m) ; arr=DataArrayInt32(7) ; arr.iota() ; f2.setArray(arr) ; f2.checkConsistencyLight()
         f_1=f2[::2] # test is here
-        self.assertTrue(f_1.getArray().isEqual(DataArrayInt([0,1,2,3,4,5])))
+        self.assertTrue(f_1.getArray().isEqual(DataArrayInt32([0,1,2,3,4,5])))
         m_1=m[[0,2,4]] ; m_1.zipCoords()
         self.assertTrue(f_1.getMesh().isEqual(m_1,1e-12))
         pass
@@ -4675,7 +4808,31 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         res=m.computePlaneEquationOf3DFaces()
         self.assertTrue(res.isEqual(ref,1e-12))
         pass
-    
+
+    def testBugInComputationOfEqOfPlane1(self):
+        coo=DataArrayDouble([-1.0, 1.0, -0.3872983455657959, -1.0, 1.0, 0.3872983455657959, -1.0, 1.0, 0.693649172782898, 1.0, 1.0, 0.693649172782898, 1.0, 1.0, 0.3872983455657959, 1.0, 1.0, -0.3872983455657959],6,3)
+        m=MEDCouplingUMesh("",2)
+        m.setCoords(coo)
+        m.allocateCells()
+        m.insertNextCell(NORM_POLYGON,[0,1,2,3,4,5])
+        self.assertTrue(m.computePlaneEquationOf3DFaces().isEqual(DataArrayDouble([0,1,0,-1],1,4),1e-12))
+        pass
+
+    def testSimplifyPolyhedra(self):
+        mesh = MEDCouplingUMesh('mesh', 3)
+        coo = DataArrayDouble([(-0.01225,-0.0212176,0.02),(-0.00634107,-0.0236652,0.02),(1.50019e-18,-0.0245,0.02),(0.00634107,-0.0236652,0.02),(0.01225,-0.0212176,0.02),(-0.0153864,-0.02665,0),(-0.00714085,-0.02665,0),(1.63184e-18,-0.02665,0),(0.00714085,-0.02665,0),(0.0153864,-0.02665,0),(-0.00714085,-0.02665,0.0101475),(1.63184e-18,-0.02665,0.013145),(0.00714085,-0.02665,0.0101475),(-0.013,-0.0225167,0.02),(-0.0067293,-0.0251141,0.02),(1.59204e-18,-0.026,0.02),(0.0067293,-0.0251141,0.02),(0.013,-0.0225167,0.02),(-0.0161658,-0.028,0),(-0.00750258,-0.028,0),(1.71451e-18,-0.028,0),(0.00750258,-0.028,0),(0.0161658,-0.028,0),(-0.00750258,-0.028,0.0105625),(1.71451e-18,-0.028,0.0136825),(0.00750258,-0.028,0.0105625)])
+        mesh.setCoords(coo)
+        c = DataArrayInt([31, 13, 14, 15, 16, 17, 4, 3, 2, 1, 0, -1, 18, 5, 6, 7, 8, 9, 22, 21, 20, 19, -1, 19, 23, 18, -1, 23, 14, 13, 18, -1, 20, 24, 23, 19, -1, 24, 15, 14, 23, -1, 21, 25, 24, 20, -1, 25, 16, 15, 24, -1, 22, 25, 21, -1, 22, 17, 16, 25, -1, 9, 4, 17, 22, -1, 8, 12, 9, -1, 12, 3, 4, 9, -1, 7, 11, 12, 8, -1, 11, 2, 3, 12, -1, 6, 10, 11, 7, -1, 10, 1, 2, 11, -1, 5, 10, 6, -1, 5, 0, 1, 10, -1, 18, 13, 0, 5])
+        cI = DataArrayInt([0, 108])
+        mesh.setConnectivity(c, cI)
+        mesh.simplifyPolyhedra(1.0e-8)
+        c, cI = mesh.getNodalConnectivity(), mesh.getNodalConnectivityIndex()
+        tgt_c = DataArrayInt([31, 23, 18, 19, 20, 21, 22, 25, 24, -1, 12, 9, 8, 7, 6, 5, 10, 11, -1, 13, 14, 15, 16, 17, 4, 3, 2, 1, 0, -1, 18, 5, 6, 7, 8, 9, 22, 21, 20, 19, -1, 23, 14, 13, 18, -1, 24, 15, 14, 23, -1, 25, 16, 15, 24, -1, 22, 17, 16, 25, -1, 9, 4, 17, 22, -1, 12, 3, 4, 9, -1, 11, 2, 3, 12, -1, 10, 1, 2, 11, -1, 5, 0, 1, 10, -1, 18, 13, 0, 5])
+        tgt_cI = DataArrayInt([0, 90])
+        self.assertEqual(c.getValues(), tgt_c.getValues())
+        self.assertEqual(cI.getValues(), tgt_cI.getValues())
+        pass
+
     pass
 
 if __name__ == '__main__':