51 Pout<<
nl <<
"Foam::cellPointWeight::findTetrahedron" <<
nl 52 <<
"position = " << position <<
nl 53 <<
"celli = " << celli <<
endl;
62 const scalar cellVolume = mesh.
cellVolumes()[celli];
71 if (
mag(det/cellVolume) > tol)
73 const scalar& u = weights_[0];
74 const scalar& v = weights_[1];
75 const scalar& w = weights_[2];
82 && (u + v + w < 1 + tol)
96 scalar minNearDist = vGreat;
98 label nearestTetI = -1;
106 if (nearDist < minNearDist)
108 minNearDist = nearDist;
116 Pout<<
"cellPointWeight::findTetrahedron" <<
nl 117 <<
" Tetrahedron search failed; using closest tet to point " 125 const tetIndices& tetIs = cellTets[nearestTetI];
145 Pout<<
"\nbool Foam::cellPointWeight::findTriangle" <<
nl 146 <<
"position = " << position <<
nl 147 <<
"facei = " << facei <<
endl;
168 if (0.25*
mag(det)/faceAreaSqr > tol)
170 const scalar& u = triWeights[0];
171 const scalar& v = triWeights[1];
182 weights_[1] = triWeights[0];
183 weights_[2] = triWeights[1];
184 weights_[3] = triWeights[2];
195 scalar minNearDist = vGreat;
197 label nearestTetI = -1;
205 if (nearDist < minNearDist)
207 minNearDist = nearDist;
215 Pout<<
"cellPointWeight::findTriangle" <<
nl 216 <<
" Triangle search failed; using closest tri to point " 223 const tetIndices& tetIs = faceTets[nearestTetI];
234 weights_[1] = triWeights[0];
235 weights_[2] = triWeights[1];
236 weights_[3] = triWeights[2];
257 findTetrahedron(mesh, position, celli);
262 findTriangle(mesh, position, facei);
#define forAll(list, i)
Loop across all elements in list.
static scalar tol
Tolerance used in calculating barycentric co-ordinates.
barycentric2D pointToBarycentric(const point &pt) const
Calculate the barycentric coordinates from the given point.
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.
static List< tetIndices > cellTetIndices(const polyMesh &mesh, label cI)
Return the tet decomposition of the given cell, see.
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.
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...
defineTypeNameAndDebug(combustionModel, 0)
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.
Macro definitions for debug switches.
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
static List< tetIndices > faceTetIndices(const polyMesh &mesh, label fI, label cI)
Return the tet decomposition of the given face, with.