43 Foam::scalar Foam::faceAreaIntersect::tol = 1
e-6;
47 void Foam::faceAreaIntersect::triSliceWithPlane
69 if (
mag(d[i]) < tol*len)
95 || ((nPos == 2) && (nCoPlanar == 1))
96 || ((nPos == 1) && (nCoPlanar == 2))
111 else if ((nPos == 2) && (nCoPlanar == 0))
134 point p01 = planeIntersection(d, tri, i0, i1);
135 point p02 = planeIntersection(d, tri, i0, i2);
139 setTriPoints(tri[i1], tri[i2], p02, nTris, tris);
140 setTriPoints(tri[i1], p02, p01, nTris, tris);
167 point p01 = planeIntersection(d, tri, i1, i0);
168 point p02 = planeIntersection(d, tri, i2, i0);
171 setTriPoints(tri[i0], p01, p02, nTris, tris);
194 point p01 = planeIntersection(d, tri, i1, i0);
199 setTriPoints(tri[i0], p01, tri[i2], nTris, tris);
203 setTriPoints(tri[i0], tri[i2], p01, nTris, tris);
222 Foam::scalar Foam::faceAreaIntersect::triangleIntersect
224 const triPoints& src,
225 const triPoints& tgt,
231 label nWorkTris1 = 0;
234 label nWorkTris2 = 0;
239 scalar t =
sqrt(triArea(src));
246 scalar
s =
mag(tgt[1] - tgt[0]);
247 plane pl0(tgt[0], tgt[1], tgt[1] + s*n);
248 triSliceWithPlane(src, pl0, workTris1, nWorkTris1, t);
261 scalar
s =
mag(tgt[2] - tgt[1]);
262 plane pl1(tgt[1], tgt[2], tgt[2] + s*n);
266 for (
label i = 0; i < nWorkTris1; i++)
268 triSliceWithPlane(workTris1[i], pl1, workTris2, nWorkTris2, t);
282 scalar
s =
mag(tgt[2] - tgt[0]);
283 plane pl2(tgt[2], tgt[0], tgt[0] + s*n);
287 for (
label i = 0; i < nWorkTris2; i++)
289 triSliceWithPlane(workTris2[i], pl2, workTris1, nWorkTris1, t);
300 for (
label i = 0; i < nWorkTris1; i++)
302 area += triArea(workTris1[i]);
344 triangleFan(faceA, trisA);
345 triangleFan(faceB, trisB);
360 "Foam::scalar Foam::faceAreaIntersect::calc" 365 "const triangulationMode&" 367 ) <<
"Unknown triangulation mode enumeration" 373 scalar totalArea = 0.0;
376 triPoints tpA = getTriPoints(pointsA_, trisA[tA],
false);
382 triPoints tpB = getTriPoints(pointsB_, trisB[tB], !reverseB_);
386 totalArea += triangleIntersect(tpA, tpB, n);
dimensionedScalar sqrt(const dimensionedScalar &ds)
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 ))
dimensioned< scalar > mag(const dimensioned< Type > &)
const vector & normal() const
Return plane normal.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A 1D vector of objects of type <T> with a fixed size <Size>.
A face is a list of labels corresponding to mesh vertices.
const double e
Elementary charge.
errorManip< error > abort(error &err)
Initialise the NamedEnum HashTable from the static list of names.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Geometric class that creates a 2D plane and can return the intersection point between a line and the ...
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
faceAreaIntersect(const pointField &pointsA, const pointField &pointsB, const bool reverseB=false)
Construct from components.
const point & refPoint() const
Return or return plane base point.
static const NamedEnum< triangulationMode, 2 > triangulationModeNames_
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
scalar calc(const face &faceA, const face &faceB, const vector &n, const triangulationMode &triMode)
Return area of intersection of faceA with faceB.
label triangles(const pointField &points, label &triI, faceList &triFaces) const
Split into triangles using existing points.