]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Add a non reg test to highlight debug on computeEnlargedNeighborsOfNodes
authorAnthony Geay <anthony.geay@edf.fr>
Tue, 17 Oct 2017 08:32:53 +0000 (10:32 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Tue, 17 Oct 2017 08:32:53 +0000 (10:32 +0200)
src/MEDCoupling/MEDCouplingUMesh.cxx
src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py

index 07ba3283502f47722b3e3dc0cf9846eb57202c42..dfd764ab3ef7e171e6941d39f0afca169a7dd57e 100644 (file)
@@ -974,12 +974,13 @@ void MEDCouplingUMesh::computeEnlargedNeighborsOfNodes(MCAuto<DataArrayInt> &nei
   neighborsIdx=DataArrayInt::New(); neighborsIdx->alloc(nbOfNodes+1,1); neighborsIdx->setIJ(0,0,0);
   {
     int *neighIdx(neighborsIdx->getPointer());
-    for(std::vector< std::set<int> >::const_iterator it=st0.begin();it!=st0.end();it++,neighIdx++){
-      if ((*it).empty())
-        neighIdx[1]=neighIdx[0];
-      else
-        neighIdx[1]=neighIdx[0]+(*it).size()-1;
-    }
+    for(std::vector< std::set<int> >::const_iterator it=st0.begin();it!=st0.end();it++,neighIdx++)
+      {
+        if ((*it).empty())
+          neighIdx[1]=neighIdx[0];
+        else
+          neighIdx[1]=neighIdx[0]+(*it).size()-1;
+      }
   }
   neighbors=DataArrayInt::New(); neighbors->alloc(neighborsIdx->back(),1);
   {
index 5929051f46621d2ba1319cca9a4c203e80f1fb2c..8bc39b38af5d08fd6c1bc6f266d899055ed6d686 100644 (file)
@@ -4592,8 +4592,16 @@ class MEDCouplingBasicsTest5(unittest.TestCase):
     def testUMeshComputeEnlargedNeighborsOfNodes(self):
         m=MEDCouplingCMesh() ; arr=DataArrayDouble(4) ; arr.iota() ; m.setCoords(arr,arr) ; m=m.buildUnstructured()
         a,b=m.computeEnlargedNeighborsOfNodes()
-        self.assertTrue(a.isEqual(DataArrayInt([1,4,5,0,2,4,5,6,1,3,5,6,7,2,6,7,0,1,5,8,9,0,1,2,4,6,8,9,10,1,2,3,5,7,9,10,11,2,3,6,10,11,4,5,9,12,13,4,5,6,8,10,12,13,14,5,6,7,9,11,13,14,15,6,7,10,14,15,8,9,13,8,9,10,12,14,9,10,11,13,15,10,11,14])))
-        self.assertTrue(b.isEqual(DataArrayInt([0,3,8,13,16,21,29,37,42,47,55,63,68,71,76,81,84])))
+        aExp=DataArrayInt([1,4,5,0,2,4,5,6,1,3,5,6,7,2,6,7,0,1,5,8,9,0,1,2,4,6,8,9,10,1,2,3,5,7,9,10,11,2,3,6,10,11,4,5,9,12,13,4,5,6,8,10,12,13,14,5,6,7,9,11,13,14,15,6,7,10,14,15,8,9,13,8,9,10,12,14,9,10,11,13,15,10,11,14])
+        bExp=DataArrayInt([0,3,8,13,16,21,29,37,42,47,55,63,68,71,76,81,84])
+        self.assertTrue(a.isEqual(aExp))
+        self.assertTrue(b.isEqual(bExp))
+        m2=m[[1,2,3]]
+        c,d=m2.computeEnlargedNeighborsOfNodes()
+        cExp=DataArrayInt([2,5,6,1,3,5,6,7,2,6,7,5,8,9,1,2,4,6,8,9,1,2,3,5,7,2,3,6,4,5,9,4,5,8])
+        dExp=DataArrayInt([0,0,3,8,11,14,20,25,28,31,34,34,34,34,34,34,34])
+        self.assertTrue(c.isEqual(cExp))
+        self.assertTrue(d.isEqual(dExp))
         pass
 
     def testDAIfindIdsExt1(self):