56 psis_(i.psis_.
clone())
72 scalar phi[4], phiCandidate[4];
73 label tetLabelCandidate[2], tetPointLabels[2];
80 const vector& cellCentre = this->mesh_.cellCentres()[celli];
81 const labelList& cellFaces = this->mesh_.cells()[celli];
83 vector projection = position - cellCentre;
84 tetPoints[3] = cellCentre;
91 bool foundTet =
false;
92 label closestFace = -1;
93 scalar minDistance = great;
97 label nFace = cellFaces[facei];
99 vector normal = this->mesh_.faceAreas()[nFace];
100 normal /=
mag(normal);
102 const vector& faceCentreTmp = this->mesh_.faceCentres()[nFace];
104 scalar multiplierNumerator = (faceCentreTmp - cellCentre) & normal;
105 scalar multiplierDenominator = projection & normal;
109 if (
mag(multiplierDenominator) > small)
111 scalar multiplier = multiplierNumerator/multiplierDenominator;
112 vector iPoint = cellCentre + multiplier*projection;
113 scalar dist =
mag(position - iPoint);
115 if (dist < minDistance)
130 if (closestFace != -1)
132 label nFace = closestFace;
150 if (minDistance < 1.0e-5)
153 for (
label i=0; i<4; i++)
155 phi[i] = phiCandidate[i];
157 tetPointLabels[0] = tetLabelCandidate[0];
158 tetPointLabels[1] = tetLabelCandidate[1];
171 while (facei < cellFaces.
size() && !foundTet)
173 label nFace = cellFaces[facei];
174 if (nFace < this->mesh_.faceAreas().size())
197 if (minDistance < 1.0e-3)
200 for (
label i=0; i<4; i++)
202 phi[i] = phiCandidate[i];
204 tetPointLabels[0] = tetLabelCandidate[0];
205 tetPointLabels[1] = tetLabelCandidate[1];
216 for (
label i=0; i<2; i++)
218 ts[i] = this->psip_[tetPointLabels[i]];
221 if (closestFace < psis_.size())
223 ts[2] = psis_[closestFace];
228 this->mesh_.boundaryMesh().whichPatch(closestFace);
232 if (this->psi_.boundaryField()[
patchi].size())
234 ts[2] = this->psi_.boundaryField()[
patchi]
236 this->mesh_.boundaryMesh()[
patchi].whichFace
244 ts[2] = this->psi_[celli];
248 ts[3] = this->psi_[celli];
252 phi[
n] =
min(1.0, phi[
n]);
253 phi[
n] =
max(0.0, phi[
n]);
261 <<
"search failed; using closest cellFace value" <<
endl
262 <<
"cell number " << celli <<
tab
263 <<
"position " << position <<
endl;
265 if (closestFace < psis_.size())
267 t = psis_[closestFace];
272 this->mesh_.boundaryMesh().whichPatch(closestFace);
276 if (this->psi_.boundaryField()[
patchi].size())
278 t = this->psi_.boundaryField()[
patchi]
280 this->mesh_.boundaryMesh()[
patchi].whichFace
288 t = this->psi_[celli];
295 bool foundTriangle = findTriangle
306 for (
label i=0; i<2; i++)
308 Type vel = this->psip_[tetPointLabels[i]];
313 if (facei < psis_.size())
315 t += phi[2]*psis_[facei];
319 label patchi = this->mesh_.boundaryMesh().whichPatch(facei);
323 if (this->psi_.boundaryField()[
patchi].size())
325 t += phi[2]*this->psi_.boundaryField()[
patchi]
326 [this->mesh_.boundaryMesh()[
patchi].whichFace(facei)];
330 t += phi[2]*this->psi_[celli];
337 if (facei < psis_.size())
343 label patchi = this->mesh_.boundaryMesh().whichPatch(facei);
347 if (this->psi_.boundaryField()[
patchi].size())
349 t = this->psi_.boundaryField()[
patchi]
350 [this->mesh_.boundaryMesh()[
patchi].whichFace(facei)];
354 t = this->psi_[celli];
#define forAll(list, i)
Loop across all elements in list.
Generic GeometricField class.
void size(const label)
Override size to be inconsistent with allocated storage.
Foam::interpolationCellPointFace.
interpolationCellPointFace(const VolField< Type > &psi)
Construct from components.
Type interpolate(const vector &position, const label celli, const label facei=-1) const
Interpolate field to the given point in the given cell.
Base class for interpolations that require a vol-point interpolated field.
find the tetrahedron in which the position is. while searching for the tet, store the tet closest to ...
const volScalarField & psi
#define InfoInFunction
Report an information message using Foam::Info.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< SurfaceField< Type > > linearInterpolate(const VolField< Type > &vf)
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
dimensioned< scalar > mag(const dimensioned< Type > &)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)