61 Pout<<
"bool slidingInterface::projectPoints() : "
62 <<
" for object " <<
name() <<
" : "
63 <<
"Projecting slave points onto master surface." <<
endl;
126 scalarField minMasterPointLength(masterLocalPoints.size(), GREAT);
127 scalarField minMasterFaceLength(masterPatch.size(), GREAT);
129 forAll(masterEdges, edgeI)
131 const edge& curEdge = masterEdges[edgeI];
133 const scalar curLength =
134 masterEdges[edgeI].mag(masterLocalPoints);
137 minMasterPointLength[curEdge.
start()] =
140 minMasterPointLength[curEdge.
start()],
144 minMasterPointLength[curEdge.
end()] =
147 minMasterPointLength[curEdge.
end()],
152 const labelList& curFaces = masterEdgeFaces[edgeI];
156 minMasterFaceLength[curFaces[faceI]] =
159 minMasterFaceLength[curFaces[faceI]],
169 scalarField minSlavePointLength(slaveLocalPoints.size(), GREAT);
170 scalarField minSlaveFaceLength(slavePatch.size(), GREAT);
174 const edge& curEdge = slaveEdges[edgeI];
176 const scalar curLength =
177 slaveEdges[edgeI].mag(slaveLocalPoints);
180 minSlavePointLength[curEdge.
start()] =
183 minSlavePointLength[curEdge.
start()],
187 minSlavePointLength[curEdge.
end()] =
190 minSlavePointLength[curEdge.
end()],
195 const labelList& curFaces = slaveEdgeFaces[edgeI];
199 minSlaveFaceLength[curFaces[faceI]] =
202 minSlaveFaceLength[curFaces[faceI]],
236 forAll(slavePointFaceHits, pointI)
238 if (slavePointFaceHits[pointI].hit())
244 Pout<<
"Number of hits in point projection: " << nHits
245 <<
" out of " << slavePointFaceHits.
size() <<
" points."
258 label nAdjustedPoints = 0;
266 Pout<<
"bool slidingInterface::projectPoints() for object "
268 <<
"Adjusting point projection for integral match: ";
271 forAll(slavePointFaceHits, pointI)
273 if (slavePointFaceHits[pointI].hit())
276 projectedSlavePoints[pointI] =
278 [slavePointFaceHits[pointI].hitObject()].ray
280 slaveLocalPoints[pointI],
281 slavePointNormals[pointI],
290 masterLocalFaces[slavePointFaceHits[pointI].hitObject()].ray
292 slaveLocalPoints[pointI],
293 slavePointNormals[pointI],
299 const point missPoint =
300 slaveLocalPoints[pointI]
301 + slavePointNormals[pointI]*missAdjust.
distance();
304 const scalar mergeTol =
308 if (
mag(nearPoint - missPoint) < mergeTol)
321 projectedSlavePoints[pointI] = nearPoint;
323 slavePointFaceHits[pointI] =
324 objectHit(
true, slavePointFaceHits[pointI].hitObject());
330 projectedSlavePoints[pointI] = slaveLocalPoints[pointI];
347 forAll(slavePointFaceHits, pointI)
349 if (slavePointFaceHits[pointI].hit())
352 projectedSlavePoints[pointI] =
354 [slavePointFaceHits[pointI].hitObject()].ray
356 slaveLocalPoints[pointI],
357 slavePointNormals[pointI],
365 projectedSlavePoints[pointI] = slaveLocalPoints[pointI];
372 <<
" for object " <<
name()
378 Pout<<
"Number of adjusted points in projection: "
379 << nAdjustedPoints <<
endl;
382 scalar minEdgeLength = GREAT;
384 label nShortEdges = 0;
388 el = slaveEdges[edgeI].mag(projectedSlavePoints);
392 Pout<<
"Point projection problems for edge: "
393 << slaveEdges[edgeI] <<
". Length = " << el
399 minEdgeLength =
min(minEdgeLength, el);
405 <<
" short projected edges "
406 <<
"after adjustment for object " <<
name()
411 Pout<<
" ... projection OK." <<
endl;
422 labelList slavePointPointHits(slaveLocalPoints.size(), -1);
423 labelList masterPointPointHits(masterLocalPoints.size(), -1);
436 label nMergedPoints = 0;
438 forAll(projectedSlavePoints, pointI)
440 if (slavePointFaceHits[pointI].hit())
443 point& curPoint = projectedSlavePoints[pointI];
446 const face& hitFace =
447 masterLocalFaces[slavePointFaceHits[pointI].hitObject()];
449 label mergePoint = -1;
450 scalar mergeDist = GREAT;
453 forAll(hitFace, hitPointI)
456 mag(masterLocalPoints[hitFace[hitPointI]] - curPoint);
459 const scalar mergeTol =
463 minSlavePointLength[pointI],
464 minMasterPointLength[hitFace[hitPointI]]
467 if (dist < mergeTol && dist < mergeDist)
469 mergePoint = hitFace[hitPointI];
487 slavePointPointHits[pointI] = mergePoint;
488 curPoint = masterLocalPoints[mergePoint];
489 masterPointPointHits[mergePoint] = pointI;
500 scalar minEdgeLength = GREAT;
505 el = slaveEdges[edgeI].mag(projectedSlavePoints);
509 Pout<<
"Point projection problems for edge: "
510 << slaveEdges[edgeI] <<
". Length = " << el
514 minEdgeLength =
min(minEdgeLength, el);
517 if (minEdgeLength < SMALL)
520 <<
" after point merge for object " <<
name()
525 Pout<<
" ... point merge OK." <<
endl;
531 labelList slavePointEdgeHits(slaveLocalPoints.size(), -1);
533 label nMovedPoints = 0;
535 forAll(projectedSlavePoints, pointI)
538 if (slavePointPointHits[pointI] < 0)
541 point& curPoint = projectedSlavePoints[pointI];
545 masterFaceEdges[slavePointFaceHits[pointI].hitObject()];
548 const scalar mergeLength =
551 minSlavePointLength[pointI],
552 minMasterFaceLength[slavePointFaceHits[pointI].hitObject()]
557 scalar minDistance = GREAT;
559 forAll(hitFaceEdges, edgeI)
561 const edge& curEdge = masterEdges[hitFaceEdges[edgeI]];
569 mag(edgeHit.
hitPoint() - projectedSlavePoints[pointI]);
571 if (dist < mergeTol && dist < minDistance)
576 slavePointEdgeHits[pointI] = hitFaceEdges[edgeI];
577 projectedSlavePoints[pointI] = edgeHit.
hitPoint();
596 if (slavePointEdgeHits[pointI] > -1)
600 point& curPoint = projectedSlavePoints[pointI];
602 const edge& hitMasterEdge =
603 masterEdges[slavePointEdgeHits[pointI]];
605 label mergePoint = -1;
606 scalar mergeDist = GREAT;
608 forAll(hitMasterEdge, hmeI)
611 mag(masterLocalPoints[hitMasterEdge[hmeI]] - curPoint);
614 const scalar mergeTol =
618 minSlavePointLength[pointI],
619 minMasterPointLength[hitMasterEdge[hmeI]]
622 if (hmeDist < mergeTol && hmeDist < mergeDist)
624 mergePoint = hitMasterEdge[hmeI];
641 slavePointPointHits[pointI] = mergePoint;
642 curPoint = masterLocalPoints[mergePoint];
643 masterPointPointHits[mergePoint] = pointI;
645 slavePointFaceHits[pointI] =
646 objectHit(
true, slavePointFaceHits[pointI].hitObject());
650 slavePointEdgeHits[pointI] = -1;
658 Pout<<
"Number of merged master points: " << nMergedPoints <<
nl
659 <<
"Number of adjusted slave points: " << nMovedPoints <<
endl;
662 scalar minEdgeLength = GREAT;
667 el = slaveEdges[edgeI].mag(projectedSlavePoints);
671 Pout<<
"Point projection problems for edge: "
672 << slaveEdges[edgeI] <<
". Length = " << el
676 minEdgeLength =
min(minEdgeLength, el);
679 if (minEdgeLength < SMALL)
682 <<
" after correction for object " <<
name()
728 labelList masterPointEdgeHits(masterLocalPoints.size(), -1);
729 scalarField masterPointEdgeDist(masterLocalPoints.size(), GREAT);
739 Pout<<
"Processing slave edges " <<
endl;
752 const edge& curEdge = slaveEdges[edgeI];
760 const label startFace =
761 slavePointFaceHits[curEdge.
start()].hitObject();
762 const label endFace = slavePointFaceHits[curEdge.
end()].hitObject();
765 curFaceMap.
insert(startFace);
766 addedFaces.
insert(startFace);
778 bool completed =
false;
784 if (addedFaces.
found(endFace))
795 const labelList& curNbrs = masterFaceFaces[cf[cfI]];
799 if (!curFaceMap.
found(curNbrs[nbrI]))
801 curFaceMap.
insert(curNbrs[nbrI]);
802 addedFaces.
insert(curNbrs[nbrI]);
807 if (completed)
break;
825 label nReverseSweeps = 0;
828 curFaceMap.
insert(endFace);
829 addedFaces.
insert(endFace);
835 if (addedFaces.
found(startFace))
846 const labelList& curNbrs = masterFaceFaces[cf[cfI]];
850 if (!curFaceMap.
found(curNbrs[nbrI]))
852 curFaceMap.
insert(curNbrs[nbrI]);
853 addedFaces.
insert(curNbrs[nbrI]);
858 if (completed)
break;
894 const face&
f = masterLocalFaces[curFaces[faceI]];
909 const scalar edgeMag = edgeLine.
mag();
915 scalar slaveCatchDist =
921 projectedSlavePoints[curEdge.
start()]
922 - slaveLocalPoints[curEdge.
start()]
926 projectedSlavePoints[curEdge.
end()]
927 - slaveLocalPoints[curEdge.
end()]
939 vector edgeNormalInPlane =
942 slavePointNormals[curEdge.
start()]
943 + slavePointNormals[curEdge.
end()]
946 edgeNormalInPlane /=
mag(edgeNormalInPlane);
948 forAll(curMasterPoints, pointI)
950 const label cmp = curMasterPoints[pointI];
956 slavePointPointHits[curEdge.
start()] == cmp
957 || slavePointPointHits[curEdge.
end()] == cmp
958 || masterPointPointHits[cmp] > -1
969 if (edgeLineHit.
hit())
981 scalar distInEdgePlane =
988 masterLocalPoints[cmp]
1016 masterPointEdgeDist[cmp]
1022 if (masterPointEdgeHits[cmp] == -1)
1035 masterPointEdgeHits[cmp] = edgeI;
1036 masterPointEdgeDist[cmp] = edgeLineHit.
distance();
1070 Pout<<
"bool slidingInterface::projectPoints() for object "
1072 <<
"Finished projecting points. Topology = ";
1112 Pout<<
"(Detached interface) changing." <<
endl;
1144 Pout<<
"(Attached interface restart) changing." <<
endl;
1155 Pout<<
"(Point projection) ";
1165 Pout<<
"(Edge projection) ";
1173 bool faceHitsDifferent =
false;
1177 forAll(slavePointFaceHits, pointI)
1181 slavePointPointHits[pointI] < 0
1182 && slavePointEdgeHits[pointI] < 0
1186 if (slavePointFaceHits[pointI] != oldPointFaceHits[pointI])
1189 faceHitsDifferent =
true;
1195 if (faceHitsDifferent)
1199 Pout<<
"(Face projection) ";
1210 Pout<<
"(Master point projection) ";