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
216 Info<<
"p " << curLocalPointLabel <<
": ";
219 result[curLocalPointLabel] =
objectHit(
false, -1);
220 scalar minDistance = GREAT;
222 forAll(masterFaces, facei)
225 masterFaces[facei].ray
236 result[curLocalPointLabel] =
objectHit(
true, facei);
247 if (missDist < minDistance)
249 minDistance = missDist;
251 result[curLocalPointLabel] =
objectHit(
false, facei);
259 Info<< result[curLocalPointLabel] <<
nl;
270 Info<<
nl <<
"Executed " << nNSquaredSearches
271 <<
" n-squared searches out of total of "
279 template<
class FaceList,
class Po
intField>
280 template<
class ToPatch>
284 const ToPatch& targetPatch,
288 >& projectionDirection,
295 if (projectionDirection.size() != this->size())
298 <<
"Projection direction field does not correspond to patch faces."
299 <<
endl <<
"Size: " << projectionDirection.size()
300 <<
" Number of points: " << this->size()
309 const labelListList& masterFaceFaces = targetPatch.faceFaces();
311 const ToPatch& masterFaces = targetPatch;
313 const typename ToPatch::PointFieldType& masterPoints = targetPatch.points();
315 forAll(masterFaceCentres, facei)
317 masterFaceCentres[facei] =
318 masterFaces[facei].centre(masterPoints);
326 const PointField& slaveGlobalPoints =
points();
337 label nNSquaredSearches = 0;
339 forAll(slaveFaceOrder, facei)
342 const label curLocalFaceLabel = slaveFaceOrder[facei];
344 const point& curFaceCentre =
345 slaveFaces[curLocalFaceLabel].centre(slaveGlobalPoints);
347 const vector& curProjectionDir =
348 projectionDirection[curLocalFaceLabel];
352 boolList visitedTargetFace(targetPatch.size(),
false);
353 bool doNSquaredSearch =
false;
355 bool foundEligible =
false;
357 scalar sqrDistance = GREAT;
363 doNSquaredSearch =
true;
370 doNSquaredSearch =
false;
374 masterFaces[curFace].ray
383 visitedTargetFace[curFace] =
true;
387 result[curLocalFaceLabel] =
objectHit(
true, curFace);
399 foundEligible =
true;
400 result[curLocalFaceLabel] =
objectHit(
false, curFace);
409 curFaceCentre + curProjectionDir*curHit.
distance();
412 magSqr(missPlanePoint - masterFaceCentres[curFace]);
414 const labelList& masterNbrs = masterFaceFaces[curFace];
423 - masterFaceCentres[masterNbrs[nbrI]]
429 curFace = masterNbrs[nbrI];
433 if (visitedTargetFace[curFace])
437 doNSquaredSearch =
true;
446 if (doNSquaredSearch || !foundEligible)
452 Info<<
"p " << curLocalFaceLabel <<
": ";
455 result[curLocalFaceLabel] =
objectHit(
false, -1);
456 scalar minDistance = GREAT;
458 forAll(masterFaces, facei)
461 masterFaces[facei].ray
472 result[curLocalFaceLabel] =
objectHit(
true, facei);
483 if (missDist < minDistance)
485 minDistance = missDist;
487 result[curLocalFaceLabel] =
objectHit(
false, facei);
495 Info<< result[curLocalFaceLabel] <<
nl;
506 Info<<
nl <<
"Executed " << nNSquaredSearches
507 <<
" n-squared searches out of total of "
508 << this->size() <<
endl;