41 bool interpolationCellPointFace<Type>::findTet
46 label tetLabelCandidate[],
47 label tetPointLabels[],
49 scalar phiCandidate[],
54 bool foundTet =
false;
56 const labelList& thisFacePoints = this->pMeshFaces_[nFace];
57 tetPoints[2] = this->pMeshFaceCentres_[nFace];
61 while (pointi < thisFacePoints.size() && !foundTet)
63 label nextPointLabel = (pointi + 1) % thisFacePoints.
size();
65 tetPointLabels[0] = thisFacePoints[pointi];
66 tetPointLabels[1] = thisFacePoints[nextPointLabel];
68 tetPoints[0] = this->pMeshPoints_[tetPointLabels[0]];
69 tetPoints[1] = this->pMeshPoints_[tetPointLabels[1]];
74 for (label n=0; n<4; n++)
76 label p1 = (n + 1) % 4;
77 label p2 = (n + 2) % 4;
78 label p3 = (n + 3) % 4;
80 vector referencePoint, faceNormal;
81 referencePoint = tetPoints[p1];
84 (tetPoints[p3] - tetPoints[p1])
85 ^ (tetPoints[p2] - tetPoints[p1]);
87 faceNormal /=
mag(faceNormal);
90 vector v0 = tetPoints[n] - referencePoint;
91 scalar
correct = v0 & faceNormal;
94 faceNormal = -faceNormal;
97 vector v1 = position - referencePoint + SMALL*faceNormal;
98 scalar rightSide = v1 & faceNormal;
102 inside = inside && (rightSide >= 0);
104 scalar phiLength = (position - referencePoint) & faceNormal;
107 max(VSMALL, (tetPoints[n] - referencePoint) & faceNormal);
109 phi[n] = phiLength/maxLength;
116 if (
mag(dist - 1.0) < minDistance)
118 minDistance =
mag(dist - 1.0);
121 for (label i=0; i<4; i++)
123 phiCandidate[i] = phi[i];
126 tetLabelCandidate[0] = tetPointLabels[0];
127 tetLabelCandidate[1] = tetPointLabels[1];