14 bool interpolationCellPointFace<Type>::findTriangle
18 label tetPointLabels[],
22 bool foundTriangle =
false;
24 const labelList& facePoints = this->mesh_.faces()[nFace];
25 tetPoints[2] = this->mesh_.faceCentres()[nFace];
29 while (pointi < facePoints.size() && !foundTriangle)
33 label nextPointLabel = (pointi + 1) % facePoints.size();
35 tetPointLabels[0] = facePoints[pointi];
36 tetPointLabels[1] = facePoints[nextPointLabel];
38 tetPoints[0] = this->mesh_.points()[tetPointLabels[0]];
39 tetPoints[1] = this->mesh_.points()[tetPointLabels[1]];
41 vector fc = (tetPoints[0] + tetPoints[1] + tetPoints[2])/3.0;
43 vector newPos = position + small*(fc-position);
48 for (
label i=0; i<3; i++)
50 label ip0 = (i+1) % 3;
51 label ipp = (i+2) % 3;
52 edge[i] = tetPoints[ipp]-tetPoints[ip0];
55 vector triangleFaceNormal = edge[1] ^ edge[2];
58 for (
label i=0; i<3; i++)
60 normal[i] = triangleFaceNormal ^ edge[i];
61 normal[i] /=
mag(normal[i]) + vSmall;
66 for (
label i=0; i<3; i++)
69 inside = inside && (((newPos - tetPoints[ip]) & edge[i]) >= 0);
77 for (
label i=0; i<3; i++)
80 scalar phiMax =
max(vSmall, normal[i] & edge[ip]);
81 scalar phiLength = (position-tetPoints[ip]) & normal[i];
82 phi[i] = phiLength/phiMax;
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 > &)