43bool interpolationCellPointFace<Type>::findTet
48 label tetLabelCandidate[],
49 label tetPointLabels[],
51 scalar phiCandidate[],
56 bool foundTet =
false;
58 const labelList& thisFacePoints = this->pMeshFaces_[nFace];
59 tetPoints[2] = this->pMeshFaceCentres_[nFace];
63 while (pointi < thisFacePoints.size() && !foundTet)
65 label nextPointLabel = (pointi + 1) % thisFacePoints.size();
67 tetPointLabels[0] = thisFacePoints[pointi];
68 tetPointLabels[1] = thisFacePoints[nextPointLabel];
70 tetPoints[0] = this->pMeshPoints_[tetPointLabels[0]];
71 tetPoints[1] = this->pMeshPoints_[tetPointLabels[1]];
76 for (label
n=0;
n<4;
n++)
78 label p1 = (
n + 1) % 4;
79 label p2 = (
n + 2) % 4;
80 label p3 = (
n + 3) % 4;
82 vector referencePoint, faceNormal;
83 referencePoint = tetPoints[p1];
88 (tetPoints[p3] - tetPoints[p1])
89 ^ (tetPoints[p2] - tetPoints[p1])
93 vector v0 = tetPoints[
n] - referencePoint;
94 scalar
correct = v0 & faceNormal;
97 faceNormal = -faceNormal;
100 vector v1 = position - referencePoint + SMALL*faceNormal;
101 scalar rightSide = v1 & faceNormal;
105 inside = inside && (rightSide >= 0);
107 scalar phiLength = (position - referencePoint) & faceNormal;
110 max(VSMALL, (tetPoints[
n] - referencePoint) & faceNormal);
112 phi[
n] = phiLength/maxLength;
119 if (
mag(dist - 1.0) < minDistance)
121 minDistance =
mag(dist - 1.0);
124 for (label i=0; i<4; i++)
126 phiCandidate[i] =
phi[i];
129 tetLabelCandidate[0] = tetPointLabels[0];
130 tetLabelCandidate[1] = tetPointLabels[1];
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
List< label > labelList
A List of labels.
quaternion normalised(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)