We might end up with remaining boundary edges from pol2 (and that's OK)
+/*!
+* Compute the remaining parts of the intersection of mesh1 by mesh2.
+* The general algorithm is to :
+* - either return full cells from pol1 that were simply not touched by mesh2
+* - or to:
+* - concatenate pieces from pol1 into consecutive pieces (a bit like zipConsecutiveSegments())
+* - complete those pieces by edges found in edgesInPol2OnBoundary, which are edges from pol2 located on the boundary of the previously built
+* intersecting cells
+*/
void QuadraticPolygon::ComputeResidual(const QuadraticPolygon& pol1, const std::set<Edge *>& notUsedInPol1, const std::set<Edge *>& edgesInPol2OnBoundary,
const std::map<INTERP_KERNEL::Node *,int>& mapp, int offset, int idThis,
std::vector<double>& addCoordsQuadratic, std::vector<int>& conn,
void QuadraticPolygon::ComputeResidual(const QuadraticPolygon& pol1, const std::set<Edge *>& notUsedInPol1, const std::set<Edge *>& edgesInPol2OnBoundary,
const std::map<INTERP_KERNEL::Node *,int>& mapp, int offset, int idThis,
std::vector<double>& addCoordsQuadratic, std::vector<int>& conn,
// Zip consecutive edges found in notUsedInPol1L and which are not overlapping with boundary edge from edgesInPol2OnBoundary:
while(!notUsedInPol1L.empty())
{
// Zip consecutive edges found in notUsedInPol1L and which are not overlapping with boundary edge from edgesInPol2OnBoundary:
while(!notUsedInPol1L.empty())
{
- // If all nodes are IN or ON (why ON?) then error
+ // If all nodes are IN or edge is ON (i.e. as initialised at the begining of the method) then error
for(int i=0;i<sz && (itPol1.current()->getStartNode()->getLoc()!=IN_1 || itPol1.current()->getLoc()!=FULL_ON_1);i++)
itPol1.nextLoop();
if(itPol1.current()->getStartNode()->getLoc()!=IN_1 || itPol1.current()->getLoc()!=FULL_ON_1)
for(int i=0;i<sz && (itPol1.current()->getStartNode()->getLoc()!=IN_1 || itPol1.current()->getLoc()!=FULL_ON_1);i++)
itPol1.nextLoop();
if(itPol1.current()->getStartNode()->getLoc()!=IN_1 || itPol1.current()->getLoc()!=FULL_ON_1)
// [ABN] at least 3 turns for very small cases (typically one (quad) edge against one (quad or lin) edge forming a new cell)!
maxNbOfTurn = maxNbOfTurn<3 ? 3 : maxNbOfTurn;
nbOfTurn=0;
// [ABN] at least 3 turns for very small cases (typically one (quad) edge against one (quad or lin) edge forming a new cell)!
maxNbOfTurn = maxNbOfTurn<3 ? 3 : maxNbOfTurn;
nbOfTurn=0;
- while(nbOfTurn<maxNbOfTurn && ((!pol1Zip.empty() || !edgesInPol2OnBoundaryL.empty())))
+ while(nbOfTurn<maxNbOfTurn) // the 'normal' way out of this loop is the break towards the end when pol1Zip is empty.
{
// retPolsUnderConstruction initially empty -> see if(!pol1Zip.empty()) below ...
for(std::list<QuadraticPolygon *>::iterator itConstr=retPolsUnderContruction.begin();itConstr!=retPolsUnderContruction.end();)
{
// retPolsUnderConstruction initially empty -> see if(!pol1Zip.empty()) below ...
for(std::list<QuadraticPolygon *>::iterator itConstr=retPolsUnderContruction.begin();itConstr!=retPolsUnderContruction.end();)
retPolsUnderContruction.push_back(tmp);
pol1Zip.erase(pol1Zip.begin());
}
retPolsUnderContruction.push_back(tmp);
pol1Zip.erase(pol1Zip.begin());
}
nbOfTurn++;
}
if(nbOfTurn==maxNbOfTurn)
nbOfTurn++;
}
if(nbOfTurn==maxNbOfTurn)