47 Pout<<
nl <<
"Foam::cellPointWeight::findTetrahedron" <<
nl 48 <<
"position = " << position <<
nl 49 <<
"celli = " << celli <<
endl;
58 const scalar cellVolume = mesh.
cellVolumes()[celli];
67 if (
mag(det/cellVolume) > tol)
69 const scalar& u = weights_[0];
70 const scalar& v = weights_[1];
71 const scalar& w = weights_[2];
78 && (u + v + w < 1 + tol)
92 scalar minNearDist = vGreat;
94 label nearestTetI = -1;
102 if (nearDist < minNearDist)
104 minNearDist = nearDist;
112 Pout<<
"cellPointWeight::findTetrahedron" <<
nl 113 <<
" Tetrahedron search failed; using closest tet to point " 121 const tetIndices& tetIs = cellTets[nearestTetI];
141 Pout<<
"\nbool Foam::cellPointWeight::findTriangle" <<
nl 142 <<
"position = " << position <<
nl 143 <<
"facei = " << facei <<
endl;
164 if (0.25*
mag(det)/faceAreaSqr > tol)
166 const scalar& u = triWeights[0];
167 const scalar& v = triWeights[1];
178 weights_[1] = triWeights[0];
179 weights_[2] = triWeights[1];
180 weights_[3] = triWeights[2];
191 scalar minNearDist = vGreat;
193 label nearestTetI = -1;
201 if (nearDist < minNearDist)
203 minNearDist = nearDist;
211 Pout<<
"cellPointWeight::findTriangle" <<
nl 212 <<
" Triangle search failed; using closest tri to point " 219 const tetIndices& tetIs = faceTets[nearestTetI];
230 weights_[1] = triWeights[0];
231 weights_[2] = triWeights[1];
232 weights_[3] = triWeights[2];
253 findTetrahedron(mesh, position, celli);
258 findTriangle(mesh, position, facei);
#define forAll(list, i)
Loop across all elements in list.
static scalar tol
Tolerance used in calculating barycentric co-ordinates.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
barycentric2D pointToBarycentric(const point &pt) const
Calculate the barycentric coordinates from the given point.
static int debug
Debug switch.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
triPointRef faceTri(const polyMesh &mesh) const
Return the geometry corresponding to the tri on the face for.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Ostream & endl(Ostream &os)
Add newline and flush stream.
triFace faceTriIs(const polyMesh &mesh) const
Return the indices corresponding to the tri on the face for.
dimensionedScalar det(const dimensionedSphericalTensor &dt)
tetPointRef tet(const polyMesh &mesh) const
Return the geometry corresponding to this tet.
Templated 2D Barycentric derived from VectorSpace. Has 3 components, one of which is redundant...
const scalarField & magFaceAreas() const
cellPointWeight(const polyMesh &mesh, const vector &position, const label celli, const label facei=-1)
Construct from components.
pointHit nearestPoint(const point &p) const
Return nearest point to p on triangle.
int debugSwitch(const char *name, const int defaultValue=0)
Lookup debug switch or add default value.
virtual const labelList & faceOwner() const
Return face owner.
void findTetrahedron(const polyMesh &mesh, const vector &position, const label celli)
Storage and named access for the indices of a tet which is part of the decomposition of a cell...
void findTriangle(const polyMesh &mesh, const vector &position, const label facei)
barycentric pointToBarycentric(const point &pt) const
Calculate the barycentric coordinates from the given point.
prefixOSstream Pout(cout, "Pout")
pointHit nearestPoint(const point &p) const
Return nearest point to p on tetrahedron. Is p itself.
dimensioned< scalar > mag(const dimensioned< Type > &)
Mesh consisting of general polyhedral cells.
scalar distance() const
Return distance to hit.
const scalarField & cellVolumes() const