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])
362 if (pt.
x() ==
min().
x())
366 else if (pt.
x() ==
max().
x())
371 if (pt.
y() ==
min().
y())
375 else if (pt.
y() ==
max().
y())
380 if (pt.
z() ==
min().z())
384 else if (pt.
z() ==
max().z())
397 if (pt.
x() <
min().
x())
401 else if (pt.
x() >
max().
x())
406 if (pt.
y() <
min().
y())
410 else if (pt.
y() >
max().
y())
415 if (pt.
z() <
min().z())
419 else if (pt.
z() >
max().z())
443 nearest[cmpt] =
min()[cmpt];
444 furthest[cmpt] =
max()[cmpt];
448 nearest[cmpt] =
max()[cmpt];
449 furthest[cmpt] =
min()[cmpt];
458 calcExtremities(pt, near, far);
474 point nearThis, farThis;
477 calcExtremities(pt, nearThis, farThis);
479 const scalar minDistThis =
480 sqr(nearThis.
x() - pt.
x())
481 +
sqr(nearThis.
y() - pt.
y())
482 +
sqr(nearThis.
z() - pt.
z());
483 const scalar maxDistThis =
484 sqr(farThis.
x() - pt.
x())
485 +
sqr(farThis.
y() - pt.
y())
486 +
sqr(farThis.
z() - pt.
z());
492 point nearOther, farOther;
497 const scalar minDistOther =
498 sqr(nearOther.
x() - pt.
x())
499 +
sqr(nearOther.
y() - pt.
y())
500 +
sqr(nearOther.
z() - pt.
z());
501 const scalar maxDistOther =
502 sqr(farOther.
x() - pt.
x())
503 +
sqr(farOther.
y() - pt.
y())
504 +
sqr(farOther.
z() - pt.
z());
509 if (maxDistThis < minDistOther)
514 else if (minDistThis > maxDistOther)
531 return os << static_cast<const boundBox&>(bb);
537 return is >>
static_cast<boundBox&
>(bb);
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
bool empty() const noexcept
True if the UList is empty (ie, size() is zero)
const Cmpt & z() const
Access to the vector z component.
const Cmpt & y() const
Access to the vector y component.
const Cmpt & x() const
Access to the vector x component.
A bounding box defined in terms of min/max extrema points.
const point & min() const
Minimum describing the bounding box.
const point & max() const
Maximum describing the bounding box.
static constexpr direction nComponents
Number of components in bool is 1.
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.
label distanceCmp(const point &pt, const treeBoundBox &other) const
Compare distance to point with other bounding box.
static const edgeList edges
Edge to point addressing.
treeBoundBox subBbox(const direction octant) const
Sub-box of given octant. Midpoint calculated.
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,.
direction faceBits(const point &pt) const
Code position of point on bounding box faces.
bool contains(const vector &dir, const point &) const
Contains point (inside or on edge) and moving in direction.
direction posBits(const point &pt) const
Position of point relative to bounding box.
@ TOPHALF
2: positive y-direction
@ RIGHTHALF
1: positive x-direction
@ FRONTHALF
4: positive z-direction
static const faceList faces
Face to point addressing.
treeBoundBox()
Construct without any points - an inverted bounding box.
scalar maxDist(const point &pt) const
Returns distance point to furthest away corner.
tmp< pointField > points() const
Vertex coordinates. In octant coding.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
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))
#define WarningInFunction
Report a warning using Foam::Warning.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Istream & operator>>(Istream &, directionInfo &)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
errorManip< error > abort(error &err)
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.