From 77e8d78ba1949ffbb6f6870f8be051fa2cf3d279 Mon Sep 17 00:00:00 2001 From: Nathalie GORE Date: Wed, 12 Jul 2017 10:25:35 +0200 Subject: [PATCH] NGO - Ajout test pour fiche pleaide 15094 --- .../MEDCouplingBasicsTest5.py | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py index 3b8a0feaf..8b48fb0b5 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py @@ -4276,6 +4276,35 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertEqual(fieldOnCell.getMesh().buildDescendingConnectivity()[0].getNumberOfCells(),2*7+21) pass + def testVoronoi3D_3(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() -- 2.39.2