]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
correction in computeEnlargedNeighborsOfNodes
authorMaximilien Siavelis <maximilien.siavelis@necs.fr>
Thu, 28 Sep 2017 09:26:34 +0000 (11:26 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Tue, 17 Oct 2017 07:24:09 +0000 (09:24 +0200)
src/MEDCoupling/MEDCouplingUMesh.cxx

index 94be2bd5a6791caf733e42d93bcf6e0ee52e65e6..07ba3283502f47722b3e3dc0cf9846eb57202c42 100644 (file)
@@ -974,8 +974,12 @@ 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++)
-      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);
   {