]> 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...
authorAnida Khizar <anida.khizar@cea.fr>
Mon, 28 Mar 2022 16:04:46 +0000 (18:04 +0200)
committerabn <adrien.bruneton@cea.fr>
Tue, 29 Mar 2022 13:11:21 +0000 (15:11 +0200)
src/MEDCoupling/MEDCouplingUMesh.cxx

index 0bbeeef39243d1bbf790598bac8f1e1db62a9c9d..9f1dbbff46e32eb28b6d7ddcfe9309878ac72054 100755 (executable)
@@ -7979,9 +7979,15 @@ 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:
@@ -7991,6 +7997,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();