44 Foam::scalar Foam::faceAreaIntersect::tol = 1
e-6;
48 void Foam::faceAreaIntersect::triSliceWithPlane
70 if (
mag(d[i]) < tol*len)
96 || ((nPos == 2) && (nCoPlanar == 1))
97 || ((nPos == 1) && (nCoPlanar == 2))
112 else if ((nPos == 2) && (nCoPlanar == 0))
135 point p01 = planeIntersection(d, tri, i0, i1);
136 point p02 = planeIntersection(d, tri, i0, i2);
140 setTriPoints(tri[i1], tri[i2], p02, nTris, tris);
141 setTriPoints(tri[i1], p02, p01, nTris, tris);
168 point p01 = planeIntersection(d, tri, i1, i0);
169 point p02 = planeIntersection(d, tri, i2, i0);
172 setTriPoints(tri[i0], p01, p02, nTris, tris);
195 point p01 = planeIntersection(d, tri, i1, i0);
200 setTriPoints(tri[i0], p01, tri[i2], nTris, tris);
204 setTriPoints(tri[i0], tri[i2], p01, nTris, tris);
223 Foam::scalar Foam::faceAreaIntersect::triangleIntersect
225 const triPoints& src,
226 const triPoints& tgt,
232 label nWorkTris1 = 0;
235 label nWorkTris2 = 0;
240 scalar t =
sqrt(triArea(src));
247 scalar
s =
mag(tgt[1] - tgt[0]);
248 plane pl0(tgt[0], tgt[1], tgt[1] + s*n);
249 triSliceWithPlane(src, pl0, workTris1, nWorkTris1, t);
262 scalar
s =
mag(tgt[2] - tgt[1]);
263 plane pl1(tgt[1], tgt[2], tgt[2] + s*n);
267 for (
label i = 0; i < nWorkTris1; i++)
269 triSliceWithPlane(workTris1[i], pl1, workTris2, nWorkTris2, t);
283 scalar
s =
mag(tgt[2] - tgt[0]);
284 plane pl2(tgt[2], tgt[0], tgt[0] + s*n);
288 for (
label i = 0; i < nWorkTris2; i++)
290 triSliceWithPlane(workTris2[i], pl2, workTris1, nWorkTris1, t);
301 for (
label i = 0; i < nWorkTris1; i++)
303 area += triArea(workTris1[i]);
345 faceTris[i][0] = f[0];
346 faceTris[i][1] = f[i + 1];
347 faceTris[i][2] = f[i + 2];
372 triangulate(faceA, pointsA_, triMode, trisA);
373 triangulate(faceB, pointsB_, triMode, trisB);
376 scalar totalArea = 0.0;
379 triPoints tpA = getTriPoints(pointsA_, trisA[tA],
false);
385 triPoints tpB = getTriPoints(pointsB_, trisB[tB], !reverseB_);
389 totalArea += triangleIntersect(tpA, tpB, n);
#define forAll(list, i)
Loop across all elements in list.
A face is a list of labels corresponding to mesh vertices.
A 1D vector of objects of type <T> with a fixed size <Size>.
dimensionedScalar sqrt(const dimensionedScalar &ds)
Geometric class that creates a 2D plane and can return the intersection point between a line and the ...
static const NamedEnum< triangulationMode, 2 > triangulationModeNames_
void resize(const label)
Alias for setSize(const label)
static void triangulate(const face &f, const pointField &points, const triangulationMode &triMode, triFaceList &faceTris)
Triangulate a face using the given triangulation mode.
Initialise the NamedEnum HashTable from the static list of names.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
faceAreaIntersect(const pointField &pointsA, const pointField &pointsB, const bool reverseB=false)
Construct from components.
const point & refPoint() const
Return or return plane base point.
scalar calc(const face &faceA, const face &faceB, const vector &n, const triangulationMode &triMode)
Return area of intersection of faceA with faceB.
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
const vector & normal() const
Return plane normal.
Triangulation of three-dimensional polygons.
A List with indirect addressing.
dimensioned< scalar > mag(const dimensioned< Type > &)
const doubleScalar e
Elementary charge.
label nTriangles() const
Size of the face's triangulation.
const UList< triFace > & triPoints() const
Get the triangles' points.