]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Bug fix: infinite loop when ordering 1D cells of piecewise meshes made up of closed... akr/orderConsecutiveCells1D
authorAnida Khizar <anida.khizar@cea.fr>
Mon, 28 Mar 2022 16:04:46 +0000 (18:04 +0200)
committerAnida Khizar <anida.khizar@cea.fr>
Mon, 28 Mar 2022 16:04:46 +0000 (18:04 +0200)
src/MEDCoupling/MEDCouplingUMesh.cxx

index a9181f3e7dcf75f00bab788a8e1c127594efd5a5..c68de91a6dc3b21b1a4b94494f7219157349db49 100755 (executable)
@@ -7975,9 +7975,16 @@ DataArrayIdType *MEDCouplingUMesh::orderConsecutiveCells1D() const
               ptId = direction ? (ptId1 == prevPointId ? ptId2 : ptId1) : (ptId2 == prevPointId ? ptId1 : ptId2);
               if (dsi[ptId] == 1) // hitting the end of the line
                 break;
+
               prevPointId = ptId;
               mcIdType seg1 = rD[rDI[ptId]], seg2 = rD[rDI[ptId]+1];
               activeSeg = (seg1 == activeSeg) ? seg2 : seg1;
+
+              //for piecewise meshes made up of closed parts
+              bool segmentAlreadyTreated = (std::find(linePiece.begin(), linePiece.end(), activeSeg) != linePiece.end());
+              if(segmentAlreadyTreated)
+                break;
+
             }
         }
       // Done, save final piece into DA:
@@ -7987,6 +7994,7 @@ DataArrayIdType *MEDCouplingUMesh::orderConsecutiveCells1D() const
       // identify next valid start segment (one which is not consumed)
       if(!edgeSet.empty())
         startSeg = *(edgeSet.begin());
+
     }
   while (!edgeSet.empty());
   return result.retn();