49 Pout<<
nl <<
"Foam::cellPointWeight::findTetrahedron" <<
nl 50 <<
"position = " << position <<
nl 51 <<
"celli = " << celli <<
endl;
60 const scalar cellVolume =
mesh.cellVolumes()[celli];
80 && (u + v + w < 1 +
tol)
94 scalar minNearDist = VGREAT;
96 label nearestTetI = -1;
100 const tetIndices& tetIs = cellTets[tetI];
102 scalar nearDist = tetIs.tet(
mesh).nearestPoint(position).distance();
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;
159 const tetIndices& tetIs = faceTets[tetI];
164 tetIs.faceTri(
mesh).pointToBarycentric(position, triWeights);
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];
184 faceVertices_ = tetIs.faceTriIs(
mesh);
193 scalar minNearDist = VGREAT;
195 label nearestTetI = -1;
199 const tetIndices& tetIs = faceTets[tetI];
201 scalar nearDist = tetIs.faceTri(
mesh).nearestPoint(position).distance();
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];
228 tetIs.faceTri(
mesh).pointToBarycentric(position);
232 weights_[1] = triWeights[0];
233 weights_[2] = triWeights[1];
234 weights_[3] = triWeights[2];
236 faceVertices_ = tetIs.faceTriIs(
mesh);
static scalar tol
Tolerance used in calculating barycentric coordinates.
Barycentric2D< scalar > barycentric2D
A scalar version of the templated Barycentric2D.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
triFace faceVertices_
Face vertex indices.
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...
constexpr char nl
The newline '\n' character (0x0a)
int debugSwitch(const char *name, const int deflt=0)
Lookup debug switch or add default value.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensionedScalar det(const dimensionedSphericalTensor &dt)
tetPointRef tet(const polyMesh &mesh) const
The tet geometry for this tet, where point0 is the cell centre.
barycentric weights_
Weights applied to tet vertices.
static List< tetIndices > cellTetIndices(const polyMesh &mesh, label cI)
Return the tet decomposition of the given cell, see.
#define forAll(list, i)
Loop across all elements in list.
cellPointWeight(const polyMesh &mesh, const vector &position, const label celli, const label facei=-1)
Construct from components.
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...
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
int debug
Static debugging option.
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.
const vectorField & faceAreas() const
Mesh consisting of general polyhedral cells.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
triFace faceTriIs(const polyMesh &mesh, const bool warn=true) const
The indices corresponding to the tri on the face for this tet. The normal of the tri points out of th...
static List< tetIndices > faceTetIndices(const polyMesh &mesh, label fI, label cI)
Return the tet decomposition of the given face, with.