self.assertTrue(m3.getNodalConnectivityIndex().isEqual(DataArrayInt([0,9,18,27,36,45,54,63,72,186,286,330,423])))
pass
- def testSwig2Simplexize3D1(self):
+ def testSwig2Tetrahedrize1(self):
d=DataArrayInt([0,3,6,10,14,20])
d2=d.buildExplicitArrOfSliceOnScaledArr(slice(0,5,2))
self.assertTrue(d2.isEqual(DataArrayInt([0,0,0, 2,2,2,2, 4,4,4,4,4,4])))
m.allocateCells()
m.insertNextCell(NORM_PENTA6,[1,2,0,4,5,3])
st=m.getCoords().getHiddenCppPointer()
- a,b=m.simplexize3D(PLANAR_FACE_5)
- m.checkCoherency2()
+ c,a,b=m.tetrahedrize(PLANAR_FACE_5)
+ c.checkCoherency2()
self.assertTrue(a.isEqual(DataArrayInt([0,0,0])))
self.assertEqual(0,b)
- self.assertEqual(m.getCoords().getHiddenCppPointer(),st)
- self.assertTrue(m.getNodalConnectivity().isEqual(DataArrayInt([14,1,2,0,4,14,4,3,5,0,14,5,0,2,4])))
- self.assertTrue(m.getNodalConnectivityIndex().isEqual(DataArrayInt([0,5,10,15])))
- del m
+ self.assertEqual(m.getCoords().getHiddenCppPointer(),c.getCoords().getHiddenCppPointer())
+ self.assertTrue(c.getNodalConnectivity().isEqual(DataArrayInt([1,2,0,4,4,3,5,0,5,0,2,4])))
+ del m,c
#
m2=MEDCouplingUMesh("octa12",3)
coords=DataArrayDouble([1.,0.,0.,0.5,0.8660254037844386,0.,-0.5,0.8660254037844387,0.,-1.,1.2246467991473532e-16,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.,1.2246467991473532e-16,2.,-0.5,-0.8660254037844384,2.,0.5,-0.866025403784439,2.0],12,3)
m2.setCoords(coords)
m2.allocateCells()
m2.insertNextCell(NORM_HEXGP12,[3,2,1,0,5,4,9,8,7,6,11,10])
- a,b=m2.simplexize3D(PLANAR_FACE_5)
- m2.checkCoherency2()
+ c,a,b=m2.tetrahedrize(PLANAR_FACE_5)
+ c.checkCoherency2()
self.assertTrue(a.isEqual(DataArrayInt([0,0,0,0,0,0,0,0,0,0,0,0])))
self.assertEqual(0,b)
- self.assertEqual(m2.getCoords().getHiddenCppPointer(),coords.getHiddenCppPointer())
- self.assertTrue(m2.getNodalConnectivity().isEqual(DataArrayInt([14,3,2,4,9,14,9,10,8,4,14,8,4,2,9,14,2,5,4,8,14,8,10,11,4,14,11,4,5,8,14,2,1,5,8,14,8,11,7,5,14,7,5,1,8,14,1,0,5,7,14,7,11,6,5,14,6,5,0,7])))
- self.assertTrue(m2.getNodalConnectivityIndex().isEqual(DataArrayInt([0,5,10,15,20,25,30,35,40,45,50,55,60])))
- del m2,coords
+ self.assertEqual(c.getCoords().getHiddenCppPointer(),coords.getHiddenCppPointer())
+ self.assertTrue(c.getNodalConnectivity().isEqual(DataArrayInt([3,2,4,9,9,10,8,4,8,4,2,9,2,5,4,8,8,10,11,4,11,4,5,8,2,1,5,8,8,11,7,5,7,5,1,8,1,0,5,7,7,11,6,5,6,5,0,7])))
+ del m2,coords,c
#
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"])
m3=MEDCouplingUMesh("hexa8",3)
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_5)
- m3.checkCoherency2()
+ c,a,b=m3.tetrahedrize(PLANAR_FACE_5)
+ c.checkCoherency2()
a.isEqual(DataArrayInt([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,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])))
+ self.assertTrue(c.getNodalConnectivity().isEqual(DataArrayInt([3,6,2,1,3,7,6,4,3,0,4,1,6,4,5,1,3,6,1,4])))
#
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)
+ c,a,b=m4.tetrahedrize(PLANAR_FACE_6)
m4.checkCoherency2()
a.isEqual(DataArrayInt([0,0,0,0,0,0]))
self.assertEqual(0,b)
- 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])))
+ self.assertEqual(c.getCoords().getHiddenCppPointer(),coords.getHiddenCppPointer())
+ self.assertTrue(c.getNodalConnectivity().isEqual(DataArrayInt([3,6,2,5,3,2,1,5,3,7,6,5,3,4,7,5,3,1,0,5,3,0,4,5])))
#
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()
+ c,a,b=m4.tetrahedrize(GENERAL_24)
+ c.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])))
+ self.assertTrue(c.getCoords().getHiddenCppPointer()!=coords.getHiddenCppPointer())
+ self.assertTrue(c.getCoords()[:8].isEqual(coords,0))
+ self.assertTrue(c.getNodalConnectivity().isEqual(DataArrayInt([3,7,8,14,7,6,8,14,6,2,8,14,2,3,8,14,3,2,9,14,2,1,9,14,1,0,9,14,0,3,9,14,3,0,10,14,0,4,10,14,4,7,10,14,7,3,10,14,2,6,11,14,6,5,11,14,5,1,11,14,1,2,11,14,7,4,12,14,4,5,12,14,5,6,12,14,6,7,12,14,1,5,13,14,5,4,13,14,4,0,13,14,0,1,13,14])))
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)
+ self.assertTrue(c.getCoords().isEqual(m4CoordsExp,1e-12))
+ self.assertAlmostEqual(2.,c.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()
+ c,a,b=m6.tetrahedrize(GENERAL_48)
+ c.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])))
+ self.assertTrue(c.getCoords().getHiddenCppPointer()!=coords.getHiddenCppPointer())
+ self.assertTrue(c.getCoords()[:8].isEqual(coords,0))
+ self.assertTrue(c.getNodalConnectivity().isEqual(DataArrayInt([3,20,8,26,3,8,21,26,3,9,20,26,3,22,9,26,3,21,12,26,3,12,22,26,8,10,2,23,8,2,13,23,8,20,10,23,8,26,20,23,8,13,21,23,8,21,26,23,12,26,21,25,12,21,16,25,12,22,26,25,12,17,22,25,12,16,0,25,12,0,17,25,21,23,13,18,21,13,1,18,21,26,23,18,21,25,26,18,21,1,16,18,21,16,25,18,9,11,20,24,9,20,26,24,9,7,11,24,9,14,7,24,9,26,22,24,9,22,14,24,20,6,10,15,20,10,23,15,20,11,6,15,20,24,11,15,20,23,26,15,20,26,24,15,22,24,26,19,22,26,25,19,22,14,24,19,22,4,14,19,22,25,17,19,22,17,4,19,26,15,23,5,26,23,18,5,26,24,15,5,26,19,24,5,26,18,25,5,26,25,19,5])))
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)
+ self.assertTrue(c.getCoords().isEqual(m6CoordsExp,1e-12))
+ self.assertAlmostEqual(2.,c.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()
+ c,a,b=m7.tetrahedrize(PLANAR_FACE_5)
+ c.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)
+ self.assertTrue(c.getNodalConnectivity().isEqual(DataArrayInt([3,2,12,20,2,1,12,20,1,0,12,20,0,5,12,20,5,4,12,20,4,3,12,20,9,10,13,20,10,11,13,20,11,6,13,20,6,7,13,20,7,8,13,20,8,9,13,20,3,9,14,20,9,8,14,20,8,2,14,20,2,3,14,20,2,8,15,20,8,7,15,20,7,1,15,20,1,2,15,20,1,7,16,20,7,6,16,20,6,0,16,20,0,1,16,20,0,6,17,20,6,11,17,20,11,5,17,20,5,0,17,20,5,11,18,20,11,10,18,20,10,4,18,20,4,5,18,20,4,10,19,20,10,9,19,20,9,3,19,20,3,4,19,20])))
+ self.assertAlmostEqual(5.196152422706635,c.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
+ self.assertTrue(c.getCoords().isEqual(m7CoordsExp,1e-12))
+ del m7,coords,c
#
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.allocateCells(0)
m8.insertNextCell(NORM_PYRA5,[3,2,1,0,7])
st=m8.getCoords().getHiddenCppPointer()
- a,b=m8.simplexize3D(PLANAR_FACE_5)
+ c,a,b=m8.tetrahedrize(PLANAR_FACE_5)
self.assertEqual(m8.getCoords().getHiddenCppPointer(),coords.getHiddenCppPointer())
- m8.checkCoherency2()
+ c.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)
+ self.assertTrue(c.getNodalConnectivity().isEqual(DataArrayInt([3,2,1,7,3,1,0,7])))
+ self.assertAlmostEqual(0.6666666666666667,c.getMeasureField(False).accumulate()[0],12)
pass
def setUp(self):