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.0e-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.0e-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())
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())
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())
345 [this->pMesh_.boundaryMesh()[patchi].whichFace(facei)];
349 t = this->psi_[celli];
Generic GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
void size(const label n)
Older name for setAddressableSize.
Foam::interpolationCellPointFace.
Abstract base class for volume field interpolation.
bool interpolate() const noexcept
Same as isPointData()
Tet storage. Null constructable (unfortunately tetrahedron<point, point> is not)
Interpolate from cell centres to points (vertices) using inverse distance weighting.
const volScalarField & psi
find the tetrahedron in which the position is. while searching for the tet, store the tet closest to ...
#define InfoInFunction
Report an information message using Foam::Info.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
quaternion normalised(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > linearInterpolate(const GeometricField< Type, fvPatchField, volMesh > &vf)
static constexpr const zero Zero
Global zero (0)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
constexpr char tab
The tab '\t' character(0x09)