40 template<
class>
class FaceList,
44 template<
class ToPatch>
49 const ToPatch& targetPatch,
61 "PrimitivePatch<Face, FaceList, PointField, PointType>::" 62 "projectPoints(const PrimitivePatch& " 63 ", const Field<PointType>&) const" 64 ) <<
"Projection direction field does not correspond to " 65 <<
"patch points." <<
endl 66 <<
"Size: " << projectionDirection.
size()
67 <<
" Number of points: " <<
nPoints()
71 const labelList& slavePointOrder = localPointOrder();
73 const labelList& slaveMeshPoints = meshPoints();
78 const labelListList& masterFaceFaces = targetPatch.faceFaces();
80 const ToPatch& masterFaces = targetPatch;
87 forAll(masterFaceCentres, faceI)
89 masterFaceCentres[faceI] =
102 label nNSquaredSearches = 0;
104 forAll(slavePointOrder, pointI)
107 const label curLocalPointLabel = slavePointOrder[pointI];
109 const PointType& curPoint =
110 points_[slaveMeshPoints[curLocalPointLabel]];
112 const PointType& curProjectionDir =
113 projectionDirection[curLocalPointLabel];
117 boolList visitedTargetFace(targetPatch.size(),
false);
118 bool doNSquaredSearch =
false;
120 bool foundEligible =
false;
122 scalar sqrDistance = GREAT;
128 doNSquaredSearch =
true;
135 doNSquaredSearch =
false;
139 masterFaces[curFace].ray
148 visitedTargetFace[curFace] =
true;
152 result[curLocalPointLabel] =
objectHit(
true, curFace);
164 foundEligible =
true;
165 result[curLocalPointLabel] =
objectHit(
false, curFace);
174 PointType missPlanePoint =
175 curPoint + curProjectionDir*curHit.
distance();
177 const labelList& masterNbrs = masterFaceFaces[curFace];
180 magSqr(missPlanePoint - masterFaceCentres[curFace]);
189 - masterFaceCentres[masterNbrs[nbrI]]
195 curFace = masterNbrs[nbrI];
199 if (visitedTargetFace[curFace])
203 doNSquaredSearch =
true;
208 if (debug)
Info<<
".";
214 doNSquaredSearch || !foundEligible
221 Info<<
"p " << curLocalPointLabel <<
": ";
224 result[curLocalPointLabel] =
objectHit(
false, -1);
225 scalar minDistance = GREAT;
227 forAll(masterFaces, faceI)
230 masterFaces[faceI].ray
241 result[curLocalPointLabel] =
objectHit(
true, faceI);
252 if (missDist < minDistance)
254 minDistance = missDist;
256 result[curLocalPointLabel] =
objectHit(
false, faceI);
264 Info<< result[curLocalPointLabel] <<
nl;
269 if (debug)
Info<<
"x";
275 Info<<
nl <<
"Executed " << nNSquaredSearches
276 <<
" n-squared searches out of total of " 287 template<
class>
class FaceList,
291 template<
class ToPatch>
296 const ToPatch& targetPatch,
304 if (projectionDirection.
size() != this->size())
308 "labelList PrimitivePatch<Face, FaceList, PointField, PointType>::" 309 "projectFaceCentres(const PrimitivePatch& " 310 ", const Field<PointType>&) const" 311 ) <<
"Projection direction field does not correspond to patch faces." 312 <<
endl <<
"Size: " << projectionDirection.
size()
313 <<
" Number of points: " << this->size()
322 const labelListList& masterFaceFaces = targetPatch.faceFaces();
324 const ToPatch& masterFaces = targetPatch;
326 const typename ToPatch::PointFieldType& masterPoints = targetPatch.points();
328 forAll(masterFaceCentres, faceI)
330 masterFaceCentres[faceI] =
331 masterFaces[faceI].centre(masterPoints);
340 const PointField& slaveGlobalPoints =
points();
351 label nNSquaredSearches = 0;
353 forAll(slaveFaceOrder, faceI)
356 const label curLocalFaceLabel = slaveFaceOrder[faceI];
358 const point& curFaceCentre =
359 slaveFaces[curLocalFaceLabel].centre(slaveGlobalPoints);
361 const vector& curProjectionDir =
362 projectionDirection[curLocalFaceLabel];
366 boolList visitedTargetFace(targetPatch.size(),
false);
367 bool doNSquaredSearch =
false;
369 bool foundEligible =
false;
371 scalar sqrDistance = GREAT;
377 doNSquaredSearch =
true;
384 doNSquaredSearch =
false;
388 masterFaces[curFace].ray
397 visitedTargetFace[curFace] =
true;
401 result[curLocalFaceLabel] =
objectHit(
true, curFace);
413 foundEligible =
true;
414 result[curLocalFaceLabel] =
objectHit(
false, curFace);
422 PointType missPlanePoint =
423 curFaceCentre + curProjectionDir*curHit.
distance();
426 magSqr(missPlanePoint - masterFaceCentres[curFace]);
428 const labelList& masterNbrs = masterFaceFaces[curFace];
437 - masterFaceCentres[masterNbrs[nbrI]]
443 curFace = masterNbrs[nbrI];
447 if (visitedTargetFace[curFace])
451 doNSquaredSearch =
true;
456 if (debug)
Info<<
".";
460 if (doNSquaredSearch || !foundEligible)
466 Info<<
"p " << curLocalFaceLabel <<
": ";
469 result[curLocalFaceLabel] =
objectHit(
false, -1);
470 scalar minDistance = GREAT;
472 forAll(masterFaces, faceI)
475 masterFaces[faceI].ray
486 result[curLocalFaceLabel] =
objectHit(
true, faceI);
497 if (missDist < minDistance)
499 minDistance = missDist;
501 result[curLocalFaceLabel] =
objectHit(
false, faceI);
509 Info<< result[curLocalFaceLabel] <<
nl;
514 if (debug)
Info<<
"x";
520 Info<<
nl <<
"Executed " << nNSquaredSearches
521 <<
" n-squared searches out of total of " 522 << this->size() <<
endl;
const pointField & points
This class describes the interaction of a face and a point. It carries the info of a successful hit a...
dimensioned< scalar > mag(const dimensioned< Type > &)
dimensioned< scalar > magSqr(const dimensioned< Type > &)
const Point & missPoint() const
Return miss point.
labelList bandCompression(const labelListList &addressing)
Renumbers the addressing to reduce the band of the matrix.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void size(const label)
Override size to be inconsistent with allocated storage.
List< objectHit > projectPoints(const ToPatch &targetPatch, const Field< PointType > &projectionDirection, const intersection::algorithm=intersection::FULL_RAY, const intersection::direction=intersection::VECTOR) const
Project vertices of patch onto another patch.
This class describes a combination of target object index and success flag.
Ostream & endl(Ostream &os)
Add newline and flush stream.
List< objectHit > projectFaceCentres(const ToPatch &targetPatch, const Field< PointType > &projectionDirection, const intersection::algorithm=intersection::FULL_RAY, const intersection::direction=intersection::VECTOR) const
Project vertices of patch onto another patch.
errorManip< error > abort(error &err)
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
A list of faces which address into the list of points.
scalar distance() const
Return distance to hit.
The bandCompression function renumbers the addressing such that the band of the matrix is reduced...
tmp< GeometricField< Type, fvPatchField, volMesh > > average(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Area-weighted average a surfaceField creating a volField.
bool hit() const
Is there a hit.
bool eligibleMiss() const
Is this an eligible miss.