]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Still a bug in DataArrayInt::sortEachPairToMakeALinkedList
authorAnthony Geay <anthony.geay@edf.fr>
Thu, 16 Jun 2016 15:58:55 +0000 (17:58 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Thu, 16 Jun 2016 15:58:55 +0000 (17:58 +0200)
src/MEDCoupling/MEDCouplingMemArray.cxx
src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py

index 8f90e1e173f81d343685c9d84edcc9e023611727..8ccb92e540131fdcca2c70e82283e1ee8d3d361d 100644 (file)
@@ -10757,7 +10757,8 @@ void DataArrayInt::sortEachPairToMakeALinkedList()
             }
           else
             {//here we are sure to have (std::count(conn,conn+4,conn[1])==2)
-              std::swap(conn[2],conn[3]);
+              if(conn[1]==conn[3])
+                std::swap(conn[2],conn[3]);
             }
         }
     }
index a9b6541fb1ab7fd5c04534a5e34e6f8a40d541c1..e3abefdd079d80a86de96a77c0ff23f9a83f10fe 100644 (file)
@@ -3730,6 +3730,9 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
         d=DataArrayInt([(0,2),(1,2),(3,1)])
         d.sortEachPairToMakeALinkedList()
         self.assertTrue(d.isEqual(DataArrayInt([(0,2),(2,1),(1,3)])))
+        d=DataArrayInt([(8,6062),(6062,472),(472,6292),(6292,960)])
+        d.sortEachPairToMakeALinkedList()
+        self.assertTrue(d.isEqual(DataArrayInt([(8,6062),(6062,472),(472,6292),(6292,960)])))
         pass
 
     def testSwig2DAIIsRange(self):