]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Added another test (very similar to test13) triggering an internal error. agy/intersect_fix_ready_to_merge
authorabn <adrien.bruneton@cea.fr>
Mon, 5 Jan 2015 09:25:47 +0000 (10:25 +0100)
committerabn <adrien.bruneton@cea.fr>
Mon, 5 Jan 2015 09:25:47 +0000 (10:25 +0100)
src/MEDCoupling_Swig/MEDCouplingBasicsTest.py

index 8a5c0e8f263e5e9c1a4183cccfa5371b887028f2..c6aec8e4fd3980a0c59932b460fa699334c771e6 100644 (file)
@@ -16040,6 +16040,42 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         self.assertTrue(d.isEqual(DataArrayInt([(-1,-1),(2,4),(1,0),(1,0),(3,4),(-1,-1)])))
         pass
 
+    def testSwig2Intersect2DMeshWith1DLine16(self):
+        """ A square (side length) in a circle intersected by a simple vertical line 
+        Exactly like test 13 but with a vertical line.
+        """
+        import math
+        eps = 1.0e-8
+        m = MEDCouplingUMesh("boxcircle", 2)
+        sq2 = math.sqrt(2.0)
+        soth = (sq2+1.0)/2.0
+        coo = [2., 0., sq2, sq2, 0., 2., -sq2, sq2, -2., 0., -sq2, -sq2, 0., -2., sq2, -sq2, -1., -1., -1., 1., 1., 
+         1., 1., -1., -1., 0., 0., 1., 1., 0., 0., -1., -soth, soth, soth,soth]
+        coo = DataArrayDouble(coo); coo.rearrange(2) 
+        m.setCoords(coo)
+        c = [NORM_QPOLYG, 8, 9, 10, 11, 12, 13, 14, 15, NORM_QPOLYG, 3, 1, 10, 9, 2, 17, 13, 16, NORM_QPOLYG, 1, 7, 5, 3, 9, 8, 11, 10, 0, 6, 4, 16, 12, 15, 14, 17]
+        cI = [0, 9, 18, 35]
+        m.setConnectivity(DataArrayInt(c), DataArrayInt(cI))
+        m.checkCoherency()
+        coords2 = [1., -2., 1., 2.0]
+        connec2, cI2 = [NORM_SEG2, 0, 1], [0,3]
+        m_line = MEDCouplingUMesh("seg", 1)  
+        m_line.setCoords(DataArrayDouble(coords2, len(coords2)/2, 2))
+        m_line.setConnectivity(DataArrayInt(connec2), DataArrayInt(cI2))
+        a, b, c, d = MEDCouplingUMesh.Intersect2DMeshWith1DLine(m, m_line, eps)
+        self.assertTrue(a.getCoords().getHiddenCppPointer()==b.getCoords().getHiddenCppPointer())
+        self.assertTrue(a.getCoords()[:m.getNumberOfNodes()].isEqual(m.getCoords(),1e-12))
+        self.assertTrue(a.getCoords()[m.getNumberOfNodes():m.getNumberOfNodes()+m_line.getNumberOfNodes()].isEqual(m_line.getCoords(),1e-12))
+#         self.assertTrue(a.getCoords().isEqual(DataArrayDouble([(2.,0.),(1.4142135623730951,1.4142135623730951),(0.,2.),(-1.4142135623730951,1.4142135623730951),(-2.,0.),(-1.4142135623730951,-1.4142135623730951),(0.,-2.),(1.4142135623730951,-1.4142135623730951),(-1.,-1.),(-1.,1.),(1.,1.),(1.,-1.),(-1.,0.),(0.,1.),(1.,0.),(0.,-1.),(-1.2071067811865475,1.2071067811865475),(1.2071067811865475,1.2071067811865475),(-2.,1.),(2.,1.),(1.7320508075688772,1.),(-1.7320508075688772,1.),(-1.2071067811865475,1.2071067811865475),(-1.3660254037844386,1.),(-1.58670668058247,1.2175228580174415),(0.,-1.),(1.,0.),(1.2071067811865475,1.2071067811865475),(1.5867066805824703,1.2175228580174413),(1.9828897227476205,-0.26105238444010315),(0.,-2.),(-1.9828897227476205,-0.2610523844401032),(-1.3660254037844386,1.),(-1.,0.),(1.5867066805824703,1.2175228580174413),(1.3660254037844386,1.),(1.2071067811865475,1.2071067811865475),(0.,-2.),(-1.9828897227476205,-0.2610523844401032),(-1.3660254037844386,1.),(-1.,0.),(0.,-1.),(1.,0.),(1.3660254037844386,1.),(1.9828897227476205,-0.26105238444010315)]),1e-12))
+#         self.assertEqual([32,8,9,10,11,12,13,14,15,32,3,1,10,9,2,17,13,16,32,3,9,21,22,23,24,32,1,20,10,34,35,36,32,7,5,21,9,8,11,10,20,37,38,39,40,41,42,43,44],a.getNodalConnectivity().getValues())
+#         self.assertEqual([0,9,18,25,32,49],a.getNodalConnectivityIndex().getValues())
+#         self.assertEqual([1,18,21,1,21,9,1,9,10,1,10,20,1,20,19],b.getNodalConnectivity().getValues())
+#         self.assertEqual([0,3,6,9,12,15],b.getNodalConnectivityIndex().getValues())
+#         self.assertTrue(c.isEqual(DataArrayInt([0,1,2,2,2])))
+#         self.assertTrue(d.isEqual(DataArrayInt([(-1,-1),(2,4),(1,0),(3,4),(-1,-1)])))
+        pass
+
+
     def testOrderConsecutiveCells1D1(self):
         """A line in several unconnected pieces:"""
         m2 = MEDCouplingUMesh.New("bla", 1)