Go to the documentation of this file.
49 Pout<<
nl <<
"Foam::cellPointWeight::findTetrahedron" <<
nl
50 <<
"position = " << position <<
nl
51 <<
"celli = " << celli <<
endl;
60 const scalar cellVolume =
mesh.cellVolumes()[celli];
69 if (
mag(
det/cellVolume) > tol)
71 const scalar& u = weights_[0];
72 const scalar& v = weights_[1];
73 const scalar& w = weights_[2];
80 && (u + v + w < 1 + tol)
94 scalar minNearDist = VGREAT;
96 label nearestTetI = -1;
104 if (nearDist < minNearDist)
106 minNearDist = nearDist;
114 Pout<<
"cellPointWeight::findTetrahedron" <<
nl
115 <<
" Tetrahedron search failed; using closest tet to point "
123 const tetIndices& tetIs = cellTets[nearestTetI];
143 Pout<<
"\nbool Foam::cellPointWeight::findTriangle" <<
nl
144 <<
"position = " << position <<
nl
145 <<
"facei = " << facei <<
endl;
152 mesh.faceOwner()[facei]
155 const scalar faceAreaSqr =
magSqr(
mesh.faceAreas()[facei]);
166 if (0.25*
mag(
det)/faceAreaSqr > tol)
168 const scalar& u = triWeights[0];
169 const scalar& v = triWeights[1];
180 weights_[1] = triWeights[0];
181 weights_[2] = triWeights[1];
182 weights_[3] = triWeights[2];
193 scalar minNearDist = VGREAT;
195 label nearestTetI = -1;
203 if (nearDist < minNearDist)
205 minNearDist = nearDist;
213 Pout<<
"cellPointWeight::findTriangle" <<
nl
214 <<
" Triangle search failed; using closest tri to point "
221 const tetIndices& tetIs = faceTets[nearestTetI];
232 weights_[1] = triWeights[0];
233 weights_[2] = triWeights[1];
234 weights_[3] = triWeights[2];
255 findTetrahedron(
mesh, position, celli);
260 findTriangle(
mesh, position, facei);
int debug
Static debugging option.
void findTriangle(const polyMesh &mesh, const vector &position, const label facei)
pointHit nearestPoint(const point &p) const
Return nearest point to p on tetrahedron. Is p itself.
tetPointRef tet(const polyMesh &mesh) const
Return the geometry corresponding to this tet.
static scalar tol
Tolerance used in calculating barycentric coordinates.
int debugSwitch(const char *name, const int deflt=0)
Lookup debug switch or add default value.
Templated 2D Barycentric derived from VectorSpace. Has 3 components, one of which is redundant.
Ostream & endl(Ostream &os)
Add newline and flush stream.
prefixOSstream Pout
An Ostream wrapper for parallel output to std::cout.
Mesh consisting of general polyhedral cells.
#define forAll(list, i)
Loop across all elements in list.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
static int debug
Debug switch.
scalar distance() const
Return distance to hit.
triPointRef faceTri(const polyMesh &mesh) const
Return the geometry corresponding to the tri on the face for.
cellPointWeight(const polyMesh &mesh, const vector &position, const label celli, const label facei=-1)
Construct from components.
triFace faceTriIs(const polyMesh &mesh, const bool warn=true) const
Return the indices corresponding to the tri on the face for.
barycentric pointToBarycentric(const point &pt) const
Calculate the barycentric coordinates from the given point.
Storage and named access for the indices of a tet which is part of the decomposition of a cell.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
pointHit nearestPoint(const point &p) const
Return nearest point to p on triangle.
dimensionedScalar det(const dimensionedSphericalTensor &dt)
barycentric2D pointToBarycentric(const point &pt) const
Calculate the barycentric coordinates from the given point.
void findTetrahedron(const polyMesh &mesh, const vector &position, const label celli)