67 scalar
phi[4], phiCandidate[4];
68 label tetLabelCandidate[2], tetPointLabels[2];
75 const vector& cellCentre = this->pMesh_.cellCentres()[nCell];
76 const labelList& cellFaces = this->pMesh_.cells()[nCell];
78 vector projection = position - cellCentre;
79 tetPoints[3] = cellCentre;
86 bool foundTet =
false;
87 label closestFace = -1;
88 scalar minDistance = GREAT;
92 label nFace = cellFaces[facei];
95 normal /=
mag(normal);
97 const vector& faceCentreTmp = this->pMeshFaceCentres_[nFace];
99 scalar multiplierNumerator = (faceCentreTmp - cellCentre) & normal;
100 scalar multiplierDenominator = projection & normal;
103 if (
mag(multiplierDenominator) > SMALL)
105 scalar multiplier = multiplierNumerator/multiplierDenominator;
106 vector iPoint = cellCentre + multiplier*projection;
107 scalar
dist =
mag(position - iPoint);
109 if (dist < minDistance)
124 if (closestFace != -1)
126 label nFace = closestFace;
144 if (minDistance < 1.0
e-5)
147 for (label i=0; i<4; i++)
149 phi[i] = phiCandidate[i];
151 tetPointLabels[0] = tetLabelCandidate[0];
152 tetPointLabels[1] = tetLabelCandidate[1];
165 while (facei < cellFaces.
size() && !foundTet)
167 label nFace = cellFaces[facei];
168 if (nFace < this->pMeshFaceAreas_.size())
191 if (minDistance < 1.0
e-3)
194 for (label i=0; i<4; i++)
196 phi[i] = phiCandidate[i];
198 tetPointLabels[0] = tetLabelCandidate[0];
199 tetPointLabels[1] = tetLabelCandidate[1];
210 for (label i=0; i<2; i++)
212 ts[i] = psip_[tetPointLabels[i]];
215 if (closestFace < psis_.size())
217 ts[2] = psis_[closestFace];
221 label
patchi = this->pMesh_.boundaryMesh().whichPatch(closestFace);
225 if (this->psi_.boundaryField()[
patchi].size())
227 ts[2] = this->psi_.boundaryField()[
patchi]
228 [this->pMesh_.boundaryMesh()[
patchi].whichFace(closestFace)];
232 ts[2] = this->psi_[nCell];
236 ts[3] = this->psi_[nCell];
238 for (label n=0; n<4; n++)
240 phi[n] =
min(1.0, phi[n]);
241 phi[n] =
max(0.0, phi[n]);
248 Info<<
"interpolationCellPointFace<Type>::interpolate"
249 <<
"(const vector&, const label nCell) const : "
250 <<
"search failed; using closest cellFace value" <<
endl
251 <<
"cell number " << nCell <<
tab
252 <<
"position " << position <<
endl;
254 if (closestFace < psis_.size())
256 t = psis_[closestFace];
260 label
patchi = this->pMesh_.boundaryMesh().whichPatch(closestFace);
264 if (this->psi_.boundaryField()[
patchi].size())
266 t = this->psi_.boundaryField()[
patchi]
267 [this->pMesh_.boundaryMesh()[
patchi].whichFace(closestFace)];
271 t = this->psi_[nCell];
278 bool foundTriangle = findTriangle
289 for (label i=0; i<2; i++)
291 Type vel = psip_[tetPointLabels[i]];
296 if (facei < psis_.size())
298 t += phi[2]*psis_[facei];
302 label
patchi = this->pMesh_.boundaryMesh().whichPatch(facei);
306 if (this->psi_.boundaryField()[
patchi].size())
308 t += phi[2]*this->psi_.boundaryField()[
patchi]
309 [this->pMesh_.boundaryMesh()[
patchi].whichFace(facei)];
313 t += phi[2]*this->psi_[nCell];
320 if (facei < psis_.size())
326 label
patchi = this->pMesh_.boundaryMesh().whichPatch(facei);
330 if (this->psi_.boundaryField()[
patchi].size())
332 t = this->psi_.boundaryField()[
patchi]
333 [this->pMesh_.boundaryMesh()[
patchi].whichFace(facei)];
337 t = this->psi_[nCell];