]> SALOME platform Git repositories - tools/medcoupling.git/blobdiff - src/MEDCoupling_Swig/MEDCouplingIntersectTest.py
Salome HOME
Intersector: optim for SegSeg and ArcCSeg when an extremity is shared.
[tools/medcoupling.git] / src / MEDCoupling_Swig / MEDCouplingIntersectTest.py
index 55f3b6d8f26abb0ddf90555fd59602eb10a4bae1..51f92f45b3952c8371c7b087e09ad79b472ca249 100644 (file)
@@ -641,6 +641,36 @@ class MEDCouplingIntersectTest(unittest.TestCase):
         self.assertEqual(res2Tool.getValues(), [0, -1, -1])
         pass
 
+    def testIntersect2DMeshesTmp12(self):
+        """ Optimisation of SegSeg and ArcCSeg intersector which also allows to handle some degenerated cases.
+        See method identifyEarlyIntersection() in C++ """
+        eps = 1e-6
+        back = MEDCouplingUMesh('merge', 2)
+        coo = DataArrayDouble([(-22.20967875173176154,32.26829201778234335),(-16.84032124826824273,35.36829201778233767),(-19.52500000000000213,33.81829201778234051),(-22.09987113059642283,32.67809963891765790),(-17.25012886940356438,35.47809963891765506),(-19.67499999999999361,34.07809963891765648),(-16.98614843981577138,35.62087212266773406),(-22.46315640161999028,32.70732818597191027)])
+        back.setCoords(coo)
+        c = DataArrayInt([32, 1, 0, 3, 4,    2, 7, 5, 6])
+        cI = DataArrayInt([0, 9])
+        back.setConnectivity(c, cI)
+        back.checkConsistency()
+
+        tool = MEDCouplingUMesh('layer_2', 2)
+        coo = DataArrayDouble([(-16.84032124826824273,35.36829201778233767),(-19.52500000000000924,33.81829201778234051),(-19.46500000000013841,33.71436896932812743),(-22.58118035378681299,31.71175166763502418),(-16.17259236578203740,35.41175166763498083),(-21.04692233083152786,32.75014443326846703),(-17.83899589140436603,34.60224162661226899),(-19.49500000000007560,33.76633049355523042),(-22.64145235112855659,31.81614582930458823),(-16.23286436312378100,35.51614582930454134),(-21.10697925592403834,32.85419191960125573),(-17.89907519522208545,34.70627619258202401),(-22.61131635245768479,31.76394874846980798),(-16.20272836445290920,35.46394874846976109),(-19.07887754666707991,34.07586093630563795),(-19.52453703982536481,33.81855930796379539),(-19.93627714687611530,33.92725120783563142),(-19.50943608541021135,34.17368800957415687),(-17.95959939746765599,34.72207647704399136),(-16.53659280569601009,35.44221892354343595),(-19.30170729324622414,33.94721012213472022),(-19.72285661614316155,34.05046960870489414),(-19.29415681603864741,34.12477447293989741),(-19.73040709335074183,33.87290525789970985),(-19.52476851991268703,33.81842566287306795)])
+        tool.setCoords(coo)
+        c = DataArrayInt([8, 14, 15, 16, 17,   20, 23, 21, 22,
+                             32, 2, 3, 8, 1,    5, 12, 10, 7,
+                             32, 4, 2, 1, 9,    6, 7, 11, 13,
+                             32, 9, 1, 15, 14, 0,     11, 24, 20, 18, 19])
+        cI = DataArrayInt([0, 9, 18, 27, 38])
+        tool.setConnectivity(c, cI)
+
+        result, res2Back, res2Tool = MEDCouplingUMesh.Intersect2DMeshes(back, tool, eps)
+
+        self.assertEqual(result.getNodalConnectivity().getValues(), [5, 24, 25, 22, 23, 32, 23, 9, 0, 3, 24, 33, 34, 35, 36, 37, 32, 25, 4, 8, 22, 38, 39, 40, 41])
+        self.assertEqual(result.getNodalConnectivityIndex().getValues(), [0, 5, 16, 25])
+        self.assertEqual(res2Back.getValues(), [0, 0, 0])
+        self.assertEqual(res2Tool.getValues(), [0, -1, -1])
+        pass
+
     def testSwig2Intersect2DMeshWith1DLine1(self):
         """A basic test with no colinearity between m1 and m2."""
         i=MEDCouplingIMesh("mesh",2,[5,5],[0.,0.],[1.,1.])