Go to the documentation of this file.
69 <<
"No bounding box for zero-sized pointField" <<
nl;
85 <<
"No bounding box for zero-sized pointField" <<
nl;
95 auto& pts = tpts.ref();
99 pts[octant] = corner(octant);
108 return subBbox(centre(), octant);
121 <<
"octant should be [0..7]"
163 const point& overallStart,
191 for (label i = 0; i < 4; ++i)
198 ptOnFaces = faceBits(pt);
202 if ((ptBits & endBits) != 0)
205 ptOnFaces = faceBits(pt);
209 if (ptBits & LEFTBIT)
214 scalar
s = (
min().x() - overallStart.
x())/overallVec.
x();
216 pt.
y() = overallStart.
y() + overallVec.
y()*
s;
217 pt.
z() = overallStart.
z() + overallVec.
z()*
s;
226 else if (ptBits & RIGHTBIT)
231 scalar
s = (
max().x() - overallStart.
x())/overallVec.
x();
233 pt.
y() = overallStart.
y() + overallVec.
y()*
s;
234 pt.
z() = overallStart.
z() + overallVec.
z()*
s;
241 else if (ptBits & BOTTOMBIT)
246 scalar
s = (
min().y() - overallStart.
y())/overallVec.
y();
247 pt.
x() = overallStart.
x() + overallVec.
x()*
s;
249 pt.
z() = overallStart.
z() + overallVec.
z()*
s;
256 else if (ptBits & TOPBIT)
261 scalar
s = (
max().y() - overallStart.
y())/overallVec.
y();
262 pt.
x() = overallStart.
x() + overallVec.
x()*
s;
264 pt.
z() = overallStart.
z() + overallVec.
z()*
s;
271 else if (ptBits & BACKBIT)
276 scalar
s = (
min().z() - overallStart.
z())/overallVec.
z();
277 pt.
x() = overallStart.
x() + overallVec.
x()*
s;
278 pt.
y() = overallStart.
y() + overallVec.
y()*
s;
286 else if (ptBits & FRONTBIT)
291 scalar
s = (
max().z() - overallStart.
z())/overallVec.
z();
292 pt.
x() = overallStart.
x() + overallVec.
x()*
s;
293 pt.
y() = overallStart.
y() + overallVec.
y()*
s;
316 return intersects(start,
end-start, start,
end, pt, ptBits);
326 if (pt[cmpt] <
min()[cmpt])
330 else if (pt[cmpt] ==
min()[cmpt])
339 if (pt[cmpt] >
max()[cmpt])
343 else if (pt[cmpt] ==
max()[cmpt])
361 if (pt.
x() ==
min().x())
365 else if (pt.
x() ==
max().x())
367 faceBits |= RIGHTBIT;
370 if (pt.
y() ==
min().y())
372 faceBits |= BOTTOMBIT;
374 else if (pt.
y() ==
max().y())
379 if (pt.
z() ==
min().z())
383 else if (pt.
z() ==
max().z())
385 faceBits |= FRONTBIT;
395 if (pt.
x() <
min().x())
399 else if (pt.
x() >
max().x())
404 if (pt.
y() <
min().y())
406 posBits |= BOTTOMBIT;
408 else if (pt.
y() >
max().y())
413 if (pt.
z() <
min().z())
417 else if (pt.
z() >
max().z())
432 scalar nearX, nearY, nearZ;
433 scalar farX, farY, farZ;
468 nearest =
point(nearX, nearY, nearZ);
469 furthest =
point(farX, farY, farZ);
476 calcExtremities(pt, near, far);
492 point nearThis, farThis;
495 calcExtremities(pt, nearThis, farThis);
497 const scalar minDistThis =
498 sqr(nearThis.
x() - pt.
x())
499 +
sqr(nearThis.
y() - pt.
y())
500 +
sqr(nearThis.
z() - pt.
z());
501 const scalar maxDistThis =
502 sqr(farThis.
x() - pt.
x())
503 +
sqr(farThis.
y() - pt.
y())
504 +
sqr(farThis.
z() - pt.
z());
510 point nearOther, farOther;
515 const scalar minDistOther =
516 sqr(nearOther.x() - pt.
x())
517 +
sqr(nearOther.y() - pt.
y())
518 +
sqr(nearOther.z() - pt.
z());
519 const scalar maxDistOther =
520 sqr(farOther.x() - pt.
x())
521 +
sqr(farOther.y() - pt.
y())
522 +
sqr(farOther.z() - pt.
z());
527 if (maxDistThis < minDistOther)
532 else if (minDistThis > maxDistOther)
549 return os << static_cast<const boundBox&>(bb);
555 return is >>
static_cast<boundBox&
>(bb);
const Cmpt & x() const
Access to the vector x component.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.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))
tmp< pointField > points() const
Vertex coordinates. In octant coding.
A class for managing temporary objects.
Standard boundBox with extra functionality for use in octree.
void calcExtremities(const point &pt, point &nearest, point &furthest) const
Calculate nearest and furthest (to point) vertex coords of.
Istream & operator>>(Istream &, directionInfo &)
static const edgeList edges
Edge to point addressing.
const point & max() const
Maximum describing the bounding box.
treeBoundBox()
Construct without any points - an inverted bounding box.
direction faceBits(const point &pt) const
Code position of point on bounding box faces.
const Cmpt & z() const
Access to the vector z component.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
const point & min() const
Minimum describing the bounding box.
treeBoundBox subBbox(const direction octant) const
Sub-box of given octant. Midpoint calculated.
#define forAll(list, i)
Loop across all elements in list.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
direction posBits(const point &pt) const
Position of point relative to bounding box.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
bool intersects(const point &overallStart, const vector &overallVec, const point &start, const point &end, point &pt, direction &ptBits) const
Intersects segment; set point to intersection position and face,.
static const faceList faces
Face to point addressing.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
bool empty() const noexcept
True if the UList is empty (ie, size() is zero)
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
errorManip< error > abort(error &err)
const Cmpt & y() const
Access to the vector y component.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
bool contains(const vector &dir, const point &) const
Contains point (inside or on edge) and moving in direction.
scalar maxDist(const point &pt) const
Returns distance point to furthest away corner.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
static tmp< T > New(Args &&... args)
Construct tmp of T with forwarding arguments.
A bounding box defined in terms of min/max extrema points.
label distanceCmp(const point &pt, const treeBoundBox &other) const
Compare distance to point with other bounding box.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
vector point
Point is a vector.
#define WarningInFunction
Report a warning using Foam::Warning.