From: Anida Khizar Date: Mon, 28 Mar 2022 16:04:46 +0000 (+0200) Subject: Bug fix: infinite loop when ordering 1D cells of piecewise meshes made up of closed... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8e10113f024cd7288ed3e6e8ab44d51cee64d854;p=tools%2Fmedcoupling.git Bug fix: infinite loop when ordering 1D cells of piecewise meshes made up of closed parts --- diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index a9181f3e7..c68de91a6 100755 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -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();