33 template<
class Po
int,
class Po
intRef>
49 template<
class Po
int,
class Po
intRef>
56 a_(points[indices[0]]),
57 b_(points[indices[1]]),
58 c_(points[indices[2]]),
59 d_(points[indices[3]])
63 template<
class Po
int,
class Po
intRef>
72 template<
class Po
int,
class Po
intRef>
79 template<
class Po
int,
class Po
intRef>
86 template<
class Po
int,
class Po
intRef>
93 template<
class Po
int,
class Po
intRef>
100 template<
class Po
int,
class Po
intRef>
128 <<
"index out of range 0 -> 3. facei = " << facei
135 template<
class Po
int,
class Po
intRef>
142 template<
class Po
int,
class Po
intRef>
149 template<
class Po
int,
class Po
intRef>
156 template<
class Po
int,
class Po
intRef>
163 template<
class Po
int,
class Po
intRef>
166 return 0.25*(a_ + b_ + c_ + d_);
170 template<
class Po
int,
class Po
intRef>
173 return (1.0/6.0)*(((b_ - a_) ^ (c_ - a_)) & (d_ - a_));
177 template<
class Po
int,
class Po
intRef>
190 vector num = lambda*ba - mu*ca;
191 scalar denom = (c & ba);
200 return a_ + 0.5*(a + num/denom);
204 template<
class Po
int,
class Po
intRef>
217 vector num = lambda*ba - mu*ca;
218 scalar denom = (c & ba);
230 template<
class Po
int,
class Po
intRef>
237 *
pow3(
min(circumRadius(), GREAT))
243 template<
class Po
int,
class Po
intRef>
268 else if (s + t + u > 1.0)
275 return (1 - s - t - u)*a_ + s*b_ + t*c_ + u*d_;
279 template<
class Po
int,
class Po
intRef>
289 scalar t = rndGen.
sample01<scalar>();
290 scalar u = rndGen.
sample01<scalar>();
304 else if (s + t + u > 1.0)
311 return (1 - s - t - u)*a_ + s*b_ + t*c_ + u*d_;
315 template<
class Po
int,
class Po
intRef>
331 e0.
x(), e1.
x(), e2.
x(),
332 e0.
y(), e1.
y(), e2.
y(),
333 e0.
z(), e1.
z(), e2.
z()
336 scalar detT =
det(t);
354 bary[3] = (1.0 - res.
x() - res.
y() - res.
z());
360 template<
class Po
int,
class Po
intRef>
374 scalar minOutsideDistance = VGREAT;
378 if (((p - b_) & Sa()) >= 0)
385 if (info.
distance() < minOutsideDistance)
389 minOutsideDistance = info.
distance();
393 if (((p - a_) & Sb()) >= 0)
400 if (info.
distance() < minOutsideDistance)
404 minOutsideDistance = info.
distance();
408 if (((p - a_) & Sc()) >= 0)
415 if (info.
distance() < minOutsideDistance)
419 minOutsideDistance = info.
distance();
423 if (((p - a_) & Sd()) >= 0)
430 if (info.
distance() < minOutsideDistance)
434 minOutsideDistance = info.
distance();
442 minOutsideDistance = 0;
455 template<
class Po
int,
class Po
intRef>
477 const point& basePt = b_;
482 if (((pt - basePt) & n) > SMALL)
490 const point& basePt = c_;
495 if (((pt - basePt) & n) > SMALL)
503 const point& basePt = b_;
508 if (((pt - basePt) & n) > SMALL)
516 const point& basePt = b_;
521 if (((pt - basePt) & n) > SMALL)
531 template<
class Po
int,
class Po
intRef>
539 template<
class Po
int,
class Po
intRef>
546 template<
class Po
int,
class Po
intRef>
556 template<
class Po
int,
class Po
intRef>
568 template<
class Po
int,
class Po
intRef>
574 tets_[nTets_++] = tet;
578 template<
class Po
int,
class Po
intRef>
588 (d[posI]*t[negI] - d[negI]*t[posI])
589 / (-d[negI]+d[posI]);
593 template<
class Po
int,
class Po
intRef>
594 template<
class TetOp>
601 op(
tetPoints(points[1], points[3], points[2], points[0]));
602 op(
tetPoints(points[1], points[2], points[3], points[4]));
603 op(
tetPoints(points[4], points[2], points[3], points[5]));
607 template<
class Po
int,
class Po
intRef>
608 template<
class AboveTetOp,
class BelowTetOp>
654 point p01 = planeIntersection(d, tet, i0, i1);
655 point p02 = planeIntersection(d, tet, i0, i2);
656 point p03 = planeIntersection(d, tet, i0, i3);
665 if (i0 == 0 || i0 == 2)
681 decomposePrism(p, aboveOp);
699 decomposePrism(p, aboveOp);
726 const edge posEdge(pos0, pos1);
728 if (posEdge ==
edge(0, 1))
730 point p02 = planeIntersection(d, tet, 0, 2);
731 point p03 = planeIntersection(d, tet, 0, 3);
732 point p12 = planeIntersection(d, tet, 1, 2);
733 point p13 = planeIntersection(d, tet, 1, 3);
744 decomposePrism(p, aboveOp);
755 decomposePrism(p, belowOp);
758 else if (posEdge ==
edge(1, 2))
760 point p01 = planeIntersection(d, tet, 0, 1);
761 point p13 = planeIntersection(d, tet, 1, 3);
762 point p02 = planeIntersection(d, tet, 0, 2);
763 point p23 = planeIntersection(d, tet, 2, 3);
774 decomposePrism(p, aboveOp);
785 decomposePrism(p, belowOp);
788 else if (posEdge ==
edge(2, 0))
790 point p01 = planeIntersection(d, tet, 0, 1);
791 point p03 = planeIntersection(d, tet, 0, 3);
792 point p12 = planeIntersection(d, tet, 1, 2);
793 point p23 = planeIntersection(d, tet, 2, 3);
804 decomposePrism(p, aboveOp);
815 decomposePrism(p, belowOp);
818 else if (posEdge ==
edge(0, 3))
820 point p01 = planeIntersection(d, tet, 0, 1);
821 point p02 = planeIntersection(d, tet, 0, 2);
822 point p13 = planeIntersection(d, tet, 1, 3);
823 point p23 = planeIntersection(d, tet, 2, 3);
834 decomposePrism(p, aboveOp);
845 decomposePrism(p, belowOp);
848 else if (posEdge ==
edge(1, 3))
850 point p01 = planeIntersection(d, tet, 0, 1);
851 point p12 = planeIntersection(d, tet, 1, 2);
852 point p03 = planeIntersection(d, tet, 0, 3);
853 point p23 = planeIntersection(d, tet, 2, 3);
864 decomposePrism(p, aboveOp);
875 decomposePrism(p, belowOp);
878 else if (posEdge ==
edge(2, 3))
880 point p02 = planeIntersection(d, tet, 0, 2);
881 point p12 = planeIntersection(d, tet, 1, 2);
882 point p03 = planeIntersection(d, tet, 0, 3);
883 point p13 = planeIntersection(d, tet, 1, 3);
894 decomposePrism(p, aboveOp);
905 decomposePrism(p, belowOp);
911 <<
"Missed edge:" << posEdge
932 point p01 = planeIntersection(d, tet, i0, i1);
933 point p02 = planeIntersection(d, tet, i0, i2);
934 point p03 = planeIntersection(d, tet, i0, i3);
938 if (i0 == 0 || i0 == 2)
954 decomposePrism(p, belowOp);
972 decomposePrism(p, belowOp);
982 template<
class Po
int,
class Po
intRef>
983 template<
class AboveTetOp,
class BelowTetOp>
991 tetSliceWithPlane(pl,
tetPoints(a_, b_, c_, d_), aboveOp, belowOp);
997 template<
class Po
int,
class Po
intRef>
1005 is >> t.a_ >> t.b_ >> t.c_ >> t.d_;
1006 is.readEnd(
"tetrahedron");
1008 is.check(
"Istream& operator>>(Istream&, tetrahedron&)");
1014 template<
class Po
int,
class Po
intRef>
Istream & readBegin(const char *funcName)
vector Sa() const
Return face normal.
#define forAll(list, i)
Loop across all elements in list.
A triangle primitive used to calculate face normals and swept volumes.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
tetrahedron(const Point &a, const Point &b, const Point &c, const Point &d)
Construct from points.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const point & refPoint() const
Return or return plane base point.
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
const Point & rawPoint() const
Return point with no checking.
scalar circumRadius() const
Return circum-radius.
dimensionedScalar sqrt(const dimensionedScalar &ds)
storeOp(tetIntersectionList &, label &)
dimensionedScalar det(const dimensionedSphericalTensor &dt)
Geometric class that creates a 2D plane and can return the intersection point between a line and the ...
Point randomPoint(Random &rndGen) const
Return a random point in the tetrahedron from a.
scalar quality() const
Return quality: Ratio of tetrahedron and circum-sphere.
const vector & normal() const
Return plane normal.
const Point & a() const
Return vertices.
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
scalar distance() const
Return distance to hit.
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))
Type sample01()
Return a sample whose components lie in the range 0-1.
Point centre() const
Return centre (centroid)
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
triPointRef tri(const label facei) const
Return i-th face.
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
errorManip< error > abort(error &err)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Simple random number generator.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
scalar mag() const
Return volume.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
tetPointRef tet() const
Return the tetrahedron.
A normal distribution model.
const dimensionedScalar mu
Atomic mass unit.
dimensionedScalar pow3(const dimensionedScalar &ds)
void setSize(const label)
Reset size of List.
void sliceWithPlane(const plane &pl, AboveTetOp &aboveOp, BelowTetOp &belowOp) const
Decompose tet into tets above and below plane.
Tet storage. Null constructable (unfortunately tetrahedron<point, point> is not)
bool inside(const point &pt) const
Return true if point is inside tetrahedron.
const dimensionedScalar c
Speed of light in a vacuum.
pointHit nearestPoint(const point &p) const
Return nearest point to p on tetrahedron. Is p itself.
dimensionedScalar lambda(laminarTransport.lookup("lambda"))
scalar barycentric(const point &pt, List< scalar > &bary) const
Calculate the barycentric coordinates of the given.
triangle< point, const point & > triPointRef
dimensioned< scalar > mag(const dimensioned< Type > &)
PointHit< point > pointHit
Point circumCentre() const
Return circum-centre.
A class for managing temporary objects.
scalar scalar01()
Scalar [0..1] (so including 0,1)