X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FINTERP_KERNEL%2FGeometric2D%2FInterpKernelGeo2DQuadraticPolygon.cxx;h=f6c1ee3164a5cbcf525d754ca07fad61c474a9b4;hb=aafcf704892f03308a84407e898d9e8b19496a1c;hp=38dbea803b6b5dd542d0f8027819e12140ff472c;hpb=7d6cd5210193f67a42eafe226582f114adbd0f53;p=tools%2Fmedcoupling.git diff --git a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx index 38dbea803..f6c1ee316 100644 --- a/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx +++ b/src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2021 CEA/DEN, EDF R&D +// Copyright (C) 2007-2022 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -1310,7 +1310,7 @@ void QuadraticPolygon::ComputeResidual(const QuadraticPolygon& pol1, const std:: { itConstr++; continue; } bool smthHappened=false, doneEarly=false; - // Complete a partially reconstructed polygon with boundary edges by matching nodes: + // Complete a partially reconstructed polygon with boundary edges of pol2 by matching nodes: for(std::list::iterator it2=edgesInPol2OnBoundaryL.begin();it2!=edgesInPol2OnBoundaryL.end();) { if(curN==(*it2)->getEndNode()) // only end node should be considered if orientation is correct for input meshes @@ -1327,6 +1327,28 @@ void QuadraticPolygon::ComputeResidual(const QuadraticPolygon& pol1, const std:: if (curN == startN) // we might end here { doneEarly = true; break; } } + + // It might be the case that the lookup on start nodes made above failed because pol2 is wrongly oriented. + // Be somewhat flexible and keep on supporting this case here (useful for voronisation notably): + if(!smthHappened) + { + for(std::list::iterator it2=edgesInPol2OnBoundaryL.begin();it2!=edgesInPol2OnBoundaryL.end();) + { + if(curN==(*it2)->getStartNode()) + { + (*it2)->incrRef(); + (*itConstr)->pushBack(new ElementaryEdge(*it2,true)); + curN=(*it2)->getEndNode(); + smthHappened=true; + it2=edgesInPol2OnBoundaryL.erase(it2); + } + else + it2++; + if (curN == startN) // we might end here + { doneEarly = true; break; } + } + } + if (doneEarly) { itConstr++; continue; } @@ -1347,7 +1369,7 @@ void QuadraticPolygon::ComputeResidual(const QuadraticPolygon& pol1, const std:: itZip++; } } - else + else // Nothing happened. { for(std::list::const_iterator it5=(*itConstr)->_sub_edges.begin();it5!=(*itConstr)->_sub_edges.end();it5++) {