41 bool interpolationCellPointFace<Type>::findTet
46 label tetLabelCandidate[],
47 label tetPointLabels[],
49 scalar phiCandidate[],
54 bool foundTet =
false;
56 const labelList& thisFacePoints = this->mesh_.faces()[nFace];
57 tetPoints[2] = this->mesh_.faceCentres()[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->mesh_.points()[tetPointLabels[0]];
69 tetPoints[1] = this->mesh_.points()[tetPointLabels[1]];
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];
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
Vector< scalar > vector
A scalar version of the templated Vector.
List< label > labelList
A List of labels.
dimensioned< scalar > mag(const dimensioned< Type > &)