27 const Vec3 e1 = b - a, e2 = c - a, e3 = d - a, r = x - a;
28 const scalar det = (e1 ^ e2) & e3;
32 w[1] = w[2] = w[3] =
scalar(0);
35 w[1] = ((r ^ e2) & e3) / det;
36 w[2] = ((e1 ^ r) & e3) / det;
37 w[3] = ((e1 ^ e2) & r) / det;
38 w[0] =
scalar(1) - w[1] - w[2] - w[3];
57template<
typename ValueType>
69 label bestPts[3] = {-1, -1, -1};
73 for (
localIdx k = faceStart; k < faceEnd && !found; k++)
80 for (
label tetPt = 1; tetPt < n - 1; tetPt++)
83 label facePt = (tetPt + base) % n;
84 label otherPt = (facePt + 1) % n;
87 const label t = facePt;
101 const scalar wMin = Kokkos::fmin(Kokkos::fmin(w[0], w[1]), Kokkos::fmin(w[2], w[3]));
105 for (
int j = 0; j < 4; j++)
113 if (wMin + tol >
scalar(0))
122 return cellValues[c];
124 return best[0] * cellValues[c] + best[1] * pointValues[bestPts[0]]
125 + best[2] * pointValues[bestPts[1]] + best[3] * pointValues[bestPts[2]];
View< ValueType > values
A View with the values.
KOKKOS_INLINE_FUNCTION Kokkos::pair< IndexType, IndexType > bounds(localIdx segI) const
Get the bounds of a segment.
A class for the representation of a 3D Vec3.
Integer types used throughout NeoN.
KOKKOS_INLINE_FUNCTION scalar pointToBarycentric(const Vec3 &x, const Vec3 &a, const Vec3 &b, const Vec3 &c, const Vec3 &d, scalar w[4])
Barycentric coordinates w of x in the tetrahedron (a, b, c, d).
KOKKOS_INLINE_FUNCTION ValueType interpolateCellPoint(const TrackingMeshView &m, const View< const ValueType > &cellValues, const View< const ValueType > &pointValues, const label c, const Vec3 &x)
Interpolate a field at x in cell c from cell and point values, as OpenFOAM's interpolationCellPoint.
Read-only views of a TrackingMesh, captured by value inside kernels.
SegmentedVectorView< const label, const localIdx > cellFaces
all faces of every cell
View< const Vec3 > cellCenters
View< const Vec3 > points
mesh points, on the executor
View< const label > faceOwners
View< const scalar > cellVolumes
SegmentedVectorView< const label, const localIdx > facePoints
points of every face
View< const label > faceBasePt
tet base point of every face (local index)