50 "volPointInterpolate(" +
psi.name() +
')',
70 scalar
phi[4], phiCandidate[4];
71 label tetLabelCandidate[2], tetPointLabels[2];
78 const vector& cellCentre = this->pMesh_.cellCentres()[celli];
79 const labelList& cellFaces = this->pMesh_.cells()[celli];
81 vector projection = position - cellCentre;
89 bool foundTet =
false;
90 label closestFace = -1;
91 scalar minDistance = GREAT;
93 for (
const label nFace : cellFaces)
97 const vector& faceCentreTmp = this->pMeshFaceCentres_[nFace];
99 scalar multiplierNumerator = (faceCentreTmp - cellCentre) & normal;
100 scalar multiplierDenominator = projection & normal;
104 if (
mag(multiplierDenominator) > SMALL)
106 scalar multiplier = multiplierNumerator/multiplierDenominator;
107 vector iPoint = cellCentre + multiplier*projection;
108 scalar dist =
mag(position - iPoint);
110 if (dist < minDistance)
125 if (closestFace != -1)
127 label nFace = closestFace;
145 if (minDistance < 1.0
e-5)
148 for (label i=0; i<4; i++)
150 phi[i] = phiCandidate[i];
152 tetPointLabels[0] = tetLabelCandidate[0];
153 tetPointLabels[1] = tetLabelCandidate[1];
166 while (facei < cellFaces.size() && !foundTet)
168 label nFace = cellFaces[facei];
169 if (nFace < this->pMeshFaceAreas_.size())
192 if (minDistance < 1.0
e-3)
195 for (label i=0; i<4; i++)
197 phi[i] = phiCandidate[i];
199 tetPointLabels[0] = tetLabelCandidate[0];
200 tetPointLabels[1] = tetLabelCandidate[1];
211 for (label i=0; i<2; i++)
213 ts[i] = psip_[tetPointLabels[i]];
216 if (closestFace < psis_.size())
218 ts[2] = psis_[closestFace];
223 this->pMesh_.boundaryMesh().whichPatch(closestFace);
227 if (this->psi_.boundaryField()[patchi].size())
229 ts[2] = this->psi_.boundaryField()[patchi]
231 this->pMesh_.boundaryMesh()[patchi].whichFace
239 ts[2] = this->psi_[celli];
243 ts[3] = this->psi_[celli];
245 for (label
n=0;
n<4;
n++)
256 <<
"search failed; using closest cellFace value" <<
endl
257 <<
"cell number " << celli <<
tab
258 <<
"position " << position <<
endl;
260 if (closestFace < psis_.size())
262 t = psis_[closestFace];
267 this->pMesh_.boundaryMesh().whichPatch(closestFace);
271 if (this->psi_.boundaryField()[patchi].size())
273 t = this->psi_.boundaryField()[patchi]
275 this->pMesh_.boundaryMesh()[patchi].whichFace
283 t = this->psi_[celli];
290 bool foundTriangle = findTriangle
301 for (label i=0; i<2; i++)
303 Type vel = psip_[tetPointLabels[i]];
308 if (facei < psis_.size())
310 t +=
phi[2]*psis_[facei];
314 label patchi = this->pMesh_.boundaryMesh().whichPatch(facei);
318 if (this->psi_.boundaryField()[patchi].size())
320 t +=
phi[2]*this->psi_.boundaryField()[patchi]
321 [this->pMesh_.boundaryMesh()[patchi].whichFace(facei)];
325 t +=
phi[2]*this->psi_[celli];
332 if (facei < psis_.size())
338 label patchi = this->pMesh_.boundaryMesh().whichPatch(facei);
342 if (this->psi_.boundaryField()[patchi].size())
344 t = this->psi_.boundaryField()[patchi]
345 [this->pMesh_.boundaryMesh()[patchi].whichFace(facei)];
349 t = this->psi_[celli];