From 1fd57a2e42af23370ccf6acb025548d9531f17a4 Mon Sep 17 00:00:00 2001 From: ageay Date: Mon, 5 Aug 2013 08:35:03 +0000 Subject: [PATCH] Debug on GENERAL_24 and GENERAL_48 --- src/MEDCoupling_Swig/MEDCouplingBasicsTest.py | 100 ++++++++++++++---- 1 file changed, 78 insertions(+), 22 deletions(-) diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index 6c16f1695..e06404160 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -13635,30 +13635,86 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertTrue(m3.getNodalConnectivity().isEqual(DataArrayInt([14,3,6,2,1,14,3,7,6,4,14,3,0,4,1,14,6,4,5,1,14,3,6,1,4]))) self.assertTrue(m3.getNodalConnectivityIndex().isEqual(DataArrayInt([0,5,10,15,20,25]))) # - m3=MEDCouplingUMesh("hexa8",3) - m3.setCoords(coords) - m3.allocateCells(0) - m3.insertNextCell(NORM_HEXA8,[3,2,1,0,7,6,5,4]) - st=m3.getCoords().getHiddenCppPointer() - a,b=m3.simplexize3D(PLANAR_FACE_6) - m3.checkCoherency2() + m4=MEDCouplingUMesh("hexa8",3) + m4.setCoords(coords) + m4.allocateCells(0) + m4.insertNextCell(NORM_HEXA8,[3,2,1,0,7,6,5,4]) + st=m4.getCoords().getHiddenCppPointer() + a,b=m4.simplexize3D(PLANAR_FACE_6) + m4.checkCoherency2() a.isEqual(DataArrayInt([0,0,0,0,0,0])) self.assertEqual(0,b) - self.assertEqual(m3.getCoords().getHiddenCppPointer(),coords.getHiddenCppPointer()) - self.assertTrue(m3.getNodalConnectivity().isEqual(DataArrayInt([14,3,6,2,5,14,3,2,1,5,14,3,7,6,5,14,3,4,7,5,14,3,1,0,5,14,3,0,4,5]))) - self.assertTrue(m3.getNodalConnectivityIndex().isEqual(DataArrayInt([0,5,10,15,20,25,30]))) - # - #m3=MEDCouplingUMesh("hexa8",3) - #m3.setCoords(coords) - #m3.allocateCells(0) - #m3.insertNextCell(NORM_HEXA8,[3,2,1,0,7,6,5,4]) - #st=m3.getCoords().getHiddenCppPointer() - #a,b=m3.simplexize3D(GENERAL_24) - #m3.checkCoherency2() - #a.isEqual(DataArrayInt([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])) - #self.assertEqual(7,b) - #self.assertTrue(m3.getCoords().getHiddenCppPointer()!=coords.getHiddenCppPointer()) - #self.assertTrue(m3.getCoords()[:8].isEqual(coords,0)) + self.assertEqual(m4.getCoords().getHiddenCppPointer(),coords.getHiddenCppPointer()) + self.assertTrue(m4.getNodalConnectivity().isEqual(DataArrayInt([14,3,6,2,5,14,3,2,1,5,14,3,7,6,5,14,3,4,7,5,14,3,1,0,5,14,3,0,4,5]))) + self.assertTrue(m4.getNodalConnectivityIndex().isEqual(DataArrayInt([0,5,10,15,20,25,30]))) + # + m4=MEDCouplingUMesh("hexa8",3) + m4.setCoords(coords) + m4.allocateCells(0) + m4.insertNextCell(NORM_HEXA8,[3,2,1,0,7,6,5,4]) + st=m4.getCoords().getHiddenCppPointer() + a,b=m4.simplexize3D(GENERAL_24) + m4.checkCoherency2() + a.isEqual(DataArrayInt([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])) + self.assertEqual(7,b) + self.assertTrue(m4.getCoords().getHiddenCppPointer()!=coords.getHiddenCppPointer()) + self.assertTrue(m4.getCoords()[:8].isEqual(coords,0)) + self.assertTrue(m4.getNodalConnectivity().isEqual(DataArrayInt([14,3,7,8,14,14,7,6,8,14,14,6,2,8,14,14,2,3,8,14,14,3,2,9,14,14,2,1,9,14,14,1,0,9,14,14,0,3,9,14,14,3,0,10,14,14,0,4,10,14,14,4,7,10,14,14,7,3,10,14,14,2,6,11,14,14,6,5,11,14,14,5,1,11,14,14,1,2,11,14,14,7,4,12,14,14,4,5,12,14,14,5,6,12,14,14,6,7,12,14,14,1,5,13,14,14,5,4,13,14,14,4,0,13,14,14,0,1,13,14]))) + self.assertTrue(m4.getNodalConnectivityIndex().isEqual(DataArrayInt([0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,110,115,120]))) + m4CoordsExp=DataArrayDouble([0.,0.,0.,1.,0.,0.,1.,1.,0.,0.,1.,0.,0.,0.,2.,1.,0.,2.,1.,1.,2.,0.,1.,2.,0.5,1.,1.,0.5,0.5,0.,0.,0.5,1.,1.,0.5,1.,0.5,0.5,2.,0.5,0.,1.,0.5,0.5,1.],15,3) + m4CoordsExp.setInfoOnComponents(["X","YY","ZZZ"]) + self.assertTrue(m4.getCoords().isEqual(m4CoordsExp,1e-12)) + self.assertAlmostEqual(2.,m4.getMeasureField(False).accumulate()[0],12) + # + m6=MEDCouplingUMesh("hexa8",3) + m6.setCoords(coords) + m6.allocateCells(0) + m6.insertNextCell(NORM_HEXA8,[3,2,1,0,7,6,5,4]) + st=m6.getCoords().getHiddenCppPointer() + a,b=m6.simplexize3D(GENERAL_48) + m6.checkCoherency2() + a.isEqual(DataArrayInt([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])) + self.assertEqual(19,b) + self.assertTrue(m6.getCoords().getHiddenCppPointer()!=coords.getHiddenCppPointer()) + self.assertTrue(m6.getCoords()[:8].isEqual(coords,0)) + self.assertTrue(m6.getNodalConnectivity().isEqual(DataArrayInt([14,3,20,8,26,14,3,8,21,26,14,3,9,20,26,14,3,22,9,26,14,3,21,12,26,14,3,12,22,26,14,8,10,2,23,14,8,2,13,23,14,8,20,10,23,14,8,26,20,23,14,8,13,21,23,14,8,21,26,23,14,12,26,21,25,14,12,21,16,25,14,12,22,26,25,14,12,17,22,25,14,12,16,0,25,14,12,0,17,25,14,21,23,13,18,14,21,13,1,18,14,21,26,23,18,14,21,25,26,18,14,21,1,16,18,14,21,16,25,18,14,9,11,20,24,14,9,20,26,24,14,9,7,11,24,14,9,14,7,24,14,9,26,22,24,14,9,22,14,24,14,20,6,10,15,14,20,10,23,15,14,20,11,6,15,14,20,24,11,15,14,20,23,26,15,14,20,26,24,15,14,22,24,26,19,14,22,26,25,19,14,22,14,24,19,14,22,4,14,19,14,22,25,17,19,14,22,17,4,19,14,26,15,23,5,14,26,23,18,5,14,26,24,15,5,14,26,19,24,5,14,26,18,25,5,14,26,25,19,5]))) + self.assertTrue(m6.getNodalConnectivityIndex().isEqual(DataArrayInt([0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175,180,185,190,195,200,205,210,215,220,225,230,235,240]))) + m6CoordsExp=DataArrayDouble([0.,0.,0.,1.,0.,0.,1.,1.,0.,0.,1.,0.,0.,0.,2.,1.,0.,2.,1.,1.,2.,0.,1.,2.,0.5,1.,0.,0.,1.,1.,1.,1.,1.,0.5,1.,2.,0.,0.5,0.,1.,0.5,0.,0.,0.5,2.,1.,0.5,2.,0.5,0.,0.,0.,0.,1.,1.,0.,1.,0.5,0.,2.,0.5,1.,1.,0.5,0.5,0.,0.,0.5,1.,1.,0.5,1.,0.5,0.5,2.,0.5,0.,1.,0.5,0.5,1.],27,3) + m6CoordsExp.setInfoOnComponents(["X","YY","ZZZ"]) + self.assertTrue(m6.getCoords().isEqual(m6CoordsExp,1e-12)) + self.assertAlmostEqual(2.,m6.getMeasureField(False).accumulate()[0],12) + # + m7=MEDCouplingUMesh("polyhed",3) + coords=DataArrayDouble([1.,0.,0.,0.5,0.8660254037844386,0.,-0.5,0.8660254037844387,0.,-1.,0.,0.,-0.5,-0.8660254037844384,0.,0.5,-0.866025403784439,0.,1.,0.,2.,0.5,0.8660254037844386,2.,-0.5,0.8660254037844387,2.,-1.,0.,2.,-0.5,-0.8660254037844384,2.,0.5,-0.866025403784439,2.0],12,3) ; coords.setInfoOnComponents(["X","YY","ZZZ"]) + m7.setCoords(coords) + m7.allocateCells() + m7.insertNextCell(NORM_POLYHED,[3,2,1,0,5,4,-1,9,10,11,6,7,8,-1,3,9,8,2,-1,2,8,7,1,-1,1,7,6,0,-1,0,6,11,5,-1,5,11,10,4,-1,4,10,9,3]) + a,b=m7.simplexize3D(PLANAR_FACE_5) + m7.checkCoherency2() + self.assertTrue(a.isEqual(DataArrayInt([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]))) + self.assertEqual(9,b) + self.assertTrue(m7.getNodalConnectivity().isEqual(DataArrayInt([14,3,2,12,20,14,2,1,12,20,14,1,0,12,20,14,0,5,12,20,14,5,4,12,20,14,4,3,12,20,14,9,10,13,20,14,10,11,13,20,14,11,6,13,20,14,6,7,13,20,14,7,8,13,20,14,8,9,13,20,14,3,9,14,20,14,9,8,14,20,14,8,2,14,20,14,2,3,14,20,14,2,8,15,20,14,8,7,15,20,14,7,1,15,20,14,1,2,15,20,14,1,7,16,20,14,7,6,16,20,14,6,0,16,20,14,0,1,16,20,14,0,6,17,20,14,6,11,17,20,14,11,5,17,20,14,5,0,17,20,14,5,11,18,20,14,11,10,18,20,14,10,4,18,20,14,4,5,18,20,14,4,10,19,20,14,10,9,19,20,14,9,3,19,20,14,3,4,19,20]))) + self.assertTrue(m7.getNodalConnectivityIndex().isEqual(DataArrayInt([0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100,105,110,115,120,125,130,135,140,145,150,155,160,165,170,175,180]))) + self.assertAlmostEqual(5.196152422706635,m7.getMeasureField(False).accumulate()[0],12) + m7CoordsExp=DataArrayDouble([1.0, 0.0, 0.0, 0.5, 0.8660254037844386, 0.0, -0.5, 0.8660254037844387, 0.0, -1.0, 0., 0.0, -0.5, -0.8660254037844384, 0.0, 0.5, -0.866025403784439, 0.0, 1.0, 0.0, 2.0, 0.5, 0.8660254037844386, 2.0, -0.5, 0.8660254037844387, 2.0, -1.0, 0., 2.0, -0.5, -0.8660254037844384, 2.0, 0.5, -0.866025403784439, 2.0, 0.0, 0.0, 0.0, 0.0, 0., 2.0, -0.75, 0.4330127018922194, 1.0, 0.0, 0.8660254037844386, 1.0, 0.75, 0.4330127018922193, 1.0, 0.75, -0.4330127018922195, 1.0, 0.0, -0.8660254037844387, 1.0, -0.75, -0.4330127018922191, 1.0, 0.0,0., 1.0],21,3) + m7CoordsExp.setInfoOnComponents(["X","YY","ZZZ"]) + self.assertTrue(m7.getCoords().isEqual(m7CoordsExp,1e-12)) + del m7,coords + # + coords=DataArrayDouble([0.,0.,0.,1.,0.,0.,1.,1.,0.,0.,1.,0.,0.,0.,2.,1.,0.,2.,1.,1.,2.,0.,1.,2.],8,3) ; coords.setInfoOnComponents(["X","YY","ZZZ"]) + m8=MEDCouplingUMesh("pyra5",3) + m8.setCoords(coords) + m8.allocateCells(0) + m8.insertNextCell(NORM_PYRA5,[3,2,1,0,7]) + st=m8.getCoords().getHiddenCppPointer() + a,b=m8.simplexize3D(PLANAR_FACE_5) + self.assertEqual(m8.getCoords().getHiddenCppPointer(),coords.getHiddenCppPointer()) + m8.checkCoherency2() + self.assertTrue(a.isEqual(DataArrayInt([0,0]))) + self.assertEqual(0,b) + self.assertTrue(m8.getNodalConnectivity().isEqual(DataArrayInt([14,3,2,1,7,14,3,1,0,7]))) + self.assertTrue(m8.getNodalConnectivityIndex().isEqual(DataArrayInt([0,5,10]))) + self.assertAlmostEqual(0.6666666666666667,m8.getMeasureField(False).accumulate()[0],12) pass def setUp(self): -- 2.39.2