40 template<
class FaceList,
class Po
intField>
41 template<
class ToPatch>
45 const ToPatch& targetPatch,
49 >& projectionDirection,
56 if (projectionDirection.size() !=
nPoints())
59 <<
"Projection direction field does not correspond to "
60 <<
"patch points." <<
endl
61 <<
"Size: " << projectionDirection.size()
62 <<
" Number of points: " <<
nPoints()
66 const labelList& slavePointOrder = localPointOrder();
68 const labelList& slaveMeshPoints = meshPoints();
73 const labelListList& masterFaceFaces = targetPatch.faceFaces();
75 const ToPatch& masterFaces = targetPatch;
82 forAll(masterFaceCentres, facei)
84 masterFaceCentres[facei] =
97 label nNSquaredSearches = 0;
99 forAll(slavePointOrder, pointi)
102 const label curLocalPointLabel = slavePointOrder[pointi];
105 points_[slaveMeshPoints[curLocalPointLabel]];
108 projectionDirection[curLocalPointLabel];
112 boolList visitedTargetFace(targetPatch.size(),
false);
113 bool doNSquaredSearch =
false;
115 bool foundEligible =
false;
117 scalar sqrDistance = GREAT;
123 doNSquaredSearch =
true;
130 doNSquaredSearch =
false;
134 masterFaces[curFace].ray
143 visitedTargetFace[curFace] =
true;
147 result[curLocalPointLabel] =
objectHit(
true, curFace);
159 foundEligible =
true;
160 result[curLocalPointLabel] =
objectHit(
false, curFace);
170 curPoint + curProjectionDir*curHit.
distance();
172 const labelList& masterNbrs = masterFaceFaces[curFace];
175 magSqr(missPlanePoint - masterFaceCentres[curFace]);
184 - masterFaceCentres[masterNbrs[nbrI]]
190 curFace = masterNbrs[nbrI];
194 if (visitedTargetFace[curFace])
198 doNSquaredSearch =
true;
209 doNSquaredSearch || !foundEligible
214 DebugInfo <<
"p " << curLocalPointLabel <<
": ";
216 result[curLocalPointLabel] =
objectHit(
false, -1);
217 scalar minDistance = GREAT;
219 forAll(masterFaces, facei)
222 masterFaces[facei].ray
233 result[curLocalPointLabel] =
objectHit(
true, facei);
244 if (missDist < minDistance)
246 minDistance = missDist;
248 result[curLocalPointLabel] =
objectHit(
false, facei);
263 <<
nl <<
"Executed " << nNSquaredSearches
264 <<
" n-squared searches out of total of "
271 template<
class FaceList,
class Po
intField>
272 template<
class ToPatch>
276 const ToPatch& targetPatch,
280 >& projectionDirection,
287 if (projectionDirection.size() != this->size())
290 <<
"Projection direction field does not correspond to patch faces."
291 <<
endl <<
"Size: " << projectionDirection.size()
292 <<
" Number of points: " << this->size()
301 const labelListList& masterFaceFaces = targetPatch.faceFaces();
303 const ToPatch& masterFaces = targetPatch;
305 const typename ToPatch::PointFieldType& masterPoints = targetPatch.points();
307 forAll(masterFaceCentres, facei)
309 masterFaceCentres[facei] =
310 masterFaces[facei].centre(masterPoints);
318 const PointField& slaveGlobalPoints =
points();
329 label nNSquaredSearches = 0;
331 forAll(slaveFaceOrder, facei)
334 const label curLocalFaceLabel = slaveFaceOrder[facei];
336 const point& curFaceCentre =
337 slaveFaces[curLocalFaceLabel].centre(slaveGlobalPoints);
339 const vector& curProjectionDir =
340 projectionDirection[curLocalFaceLabel];
344 boolList visitedTargetFace(targetPatch.size(),
false);
345 bool doNSquaredSearch =
false;
347 bool foundEligible =
false;
349 scalar sqrDistance = GREAT;
355 doNSquaredSearch =
true;
362 doNSquaredSearch =
false;
366 masterFaces[curFace].ray
375 visitedTargetFace[curFace] =
true;
379 result[curLocalFaceLabel] =
objectHit(
true, curFace);
391 foundEligible =
true;
392 result[curLocalFaceLabel] =
objectHit(
false, curFace);
401 curFaceCentre + curProjectionDir*curHit.
distance();
404 magSqr(missPlanePoint - masterFaceCentres[curFace]);
406 const labelList& masterNbrs = masterFaceFaces[curFace];
415 - masterFaceCentres[masterNbrs[nbrI]]
421 curFace = masterNbrs[nbrI];
425 if (visitedTargetFace[curFace])
429 doNSquaredSearch =
true;
438 if (doNSquaredSearch || !foundEligible)
442 DebugInfo <<
"p " << curLocalFaceLabel <<
": ";
444 result[curLocalFaceLabel] =
objectHit(
false, -1);
445 scalar minDistance = GREAT;
447 forAll(masterFaces, facei)
450 masterFaces[facei].ray
461 result[curLocalFaceLabel] =
objectHit(
true, facei);
472 if (missDist < minDistance)
474 minDistance = missDist;
476 result[curLocalFaceLabel] =
objectHit(
false, facei);
492 <<
"Executed " << nNSquaredSearches
493 <<
" n-squared searches out of total of "
494 << this->size() <<
endl;