36 vector(-great, -great, -great),
37 vector(great, great, great)
43 vector(great, great, great),
44 vector(-great, -great, -great)
110 FixedList<vector, 6> normals;
111 normals[faceId::left] =
vector(-1, 0, 0);
112 normals[faceId::right] =
vector( 1, 0, 0);
113 normals[faceId::bottom] =
vector( 0, -1, 0);
114 normals[faceId::top] =
vector( 0, 1, 0);
115 normals[faceId::back] =
vector( 0, 0, -1);
116 normals[faceId::front] =
vector( 0, 0, 1);
130 <<
"cannot find bounding box for zero-sized pointField, "
131 <<
"returning zero" <<
endl;
149 <<
"cannot find bounding box for zero-sized pointField, "
150 <<
"returning zero" <<
endl;
166 points[octant] = corner(octant);
175 return subBbox(midpoint(), octant);
188 <<
"octant should be [0..7]"
197 if (octant & octantBit::rightHalf)
206 if (octant & octantBit::topHalf)
215 if (octant & octantBit::frontHalf)
230 const point& overallStart,
258 for (
label i = 0; i < 4; ++i)
265 ptOnFaces = faceBits(pt);
269 if ((ptBits & endBits) != 0)
272 ptOnFaces = faceBits(pt);
276 if (ptBits & faceBit::left)
281 scalar
s = (
min().x() - overallStart.
x())/overallVec.
x();
283 pt.
y() = overallStart.
y() + overallVec.
y()*
s;
284 pt.
z() = overallStart.
z() + overallVec.
z()*
s;
293 else if (ptBits & faceBit::right)
298 scalar
s = (
max().x() - overallStart.
x())/overallVec.
x();
300 pt.
y() = overallStart.
y() + overallVec.
y()*
s;
301 pt.
z() = overallStart.
z() + overallVec.
z()*
s;
308 else if (ptBits & faceBit::bottom)
313 scalar
s = (
min().y() - overallStart.
y())/overallVec.
y();
314 pt.
x() = overallStart.
x() + overallVec.
x()*
s;
316 pt.
z() = overallStart.
z() + overallVec.
z()*
s;
323 else if (ptBits & faceBit::top)
328 scalar
s = (
max().y() - overallStart.
y())/overallVec.
y();
329 pt.
x() = overallStart.
x() + overallVec.
x()*
s;
331 pt.
z() = overallStart.
z() + overallVec.
z()*
s;
338 else if (ptBits & faceBit::back)
343 scalar
s = (
min().z() - overallStart.
z())/overallVec.
z();
344 pt.
x() = overallStart.
x() + overallVec.
x()*
s;
345 pt.
y() = overallStart.
y() + overallVec.
y()*
s;
353 else if (ptBits & faceBit::front)
358 scalar
s = (
max().z() - overallStart.
z())/overallVec.
z();
359 pt.
x() = overallStart.
x() + overallVec.
x()*
s;
360 pt.
y() = overallStart.
y() + overallVec.
y()*
s;
383 return intersects(start, end-start, start, end, pt, ptBits);
393 if (pt[cmpt] <
min()[cmpt])
397 else if (pt[cmpt] ==
min()[cmpt])
406 if (pt[cmpt] >
max()[cmpt])
410 else if (pt[cmpt] ==
max()[cmpt])
428 if (pt.
x() ==
min().
x())
430 faceBits |= faceBit::left;
432 else if (pt.
x() ==
max().
x())
434 faceBits |= faceBit::right;
437 if (pt.
y() ==
min().
y())
439 faceBits |= faceBit::bottom;
441 else if (pt.
y() ==
max().
y())
443 faceBits |= faceBit::top;
446 if (pt.
z() ==
min().z())
448 faceBits |= faceBit::back;
450 else if (pt.
z() ==
max().z())
452 faceBits |= faceBit::front;
462 if (pt.
x() <
min().
x())
464 posBits |= faceBit::left;
466 else if (pt.
x() >
max().
x())
468 posBits |= faceBit::right;
471 if (pt.
y() <
min().
y())
473 posBits |= faceBit::bottom;
475 else if (pt.
y() >
max().
y())
477 posBits |= faceBit::top;
480 if (pt.
z() <
min().z())
482 posBits |= faceBit::back;
484 else if (pt.
z() >
max().z())
486 posBits |= faceBit::front;
499 scalar nearX, nearY, nearZ;
500 scalar farX, farY, farZ;
535 nearest =
point(nearX, nearY, nearZ);
536 furthest =
point(farX, farY, farZ);
543 calcExtremities(pt, near, far);
559 point nearThis, farThis;
562 calcExtremities(pt, nearThis, farThis);
564 const scalar minDistThis =
565 sqr(nearThis.
x() - pt.
x())
566 +
sqr(nearThis.
y() - pt.
y())
567 +
sqr(nearThis.
z() - pt.
z());
568 const scalar maxDistThis =
569 sqr(farThis.
x() - pt.
x())
570 +
sqr(farThis.
y() - pt.
y())
571 +
sqr(farThis.
z() - pt.
z());
577 point nearOther, farOther;
582 const scalar minDistOther =
583 sqr(nearOther.
x() - pt.
x())
584 +
sqr(nearOther.
y() - pt.
y())
585 +
sqr(nearOther.
z() - pt.
z());
586 const scalar maxDistOther =
587 sqr(farOther.
x() - pt.
x())
588 +
sqr(farOther.
y() - pt.
y())
589 +
sqr(farOther.
z() - pt.
z());
594 if (maxDistThis < minDistOther)
599 else if (minDistThis > maxDistOther)
616 Info<<
"Dumping bounding box " << *
this <<
" as lines to obj file "
623 const point& pt = bbPoints[i];
625 str<<
"v " << pt.
x() <<
' ' << pt.
y() <<
' ' << pt.
z() <<
endl;
632 str<<
"l " <<
e[0]+1 <<
' ' <<
e[1]+1 <<
nl;
659 return os << static_cast<const boundBox&>(bb);
665 return is >>
static_cast<boundBox&
>(bb);
Various functions to operate on Lists.
#define forAll(list, i)
Loop across all elements in list.
A 1D vector of objects of type <T> with a fixed size <Size>.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
const fileName & name() const
Return the name of the stream.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
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
Return true if the UList is empty (ie, size() is zero)
A bounding box defined in terms of the points at its extremities.
const point & min() const
Minimum point defining the bounding box.
const point & max() const
Maximum point defining the bounding box.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
A class for handling file names.
A class for managing temporary objects.
T & ref() const
Return non-const reference or generate a fatal error.
Standard boundBox + extra functionality for use in octree.
void writeOBJ(const fileName &fName) const
void calcExtremities(const point &pt, point &nearest, point &furthest) const
Calculate nearest and furthest (to point) vertex coords of.
scalar maxDist(const point &) const
Returns distance point to furthest away corner.
label distanceCmp(const point &, const treeBoundBox &other) const
Compare distance to point with other bounding box.
direction faceBits(const point &) const
Code position of point on bounding box faces.
treeBoundBox subBbox(const direction) const
Sub box given by octant number. Midpoint calculated.
static const scalar great
The great value used for greatBox and invertedBox.
static const edgeList edges
Edge to point addressing.
bool contains(const point &) const
Contains point or other bounding box?
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 treeBoundBox invertedBox
As per boundBox::invertedBox, but with great instead of vGreat.
static const treeBoundBox greatBox
As per boundBox::greatBox, but with great instead of vGreat.
static const FixedList< vector, 6 > faceNormals
Per face the unit normal.
static const faceList faces
Face to point addressing.
direction posBits(const point &) const
Position of point relative to bounding box.
treeBoundBox()
Construct null setting points to zero.
tmp< pointField > points() const
Vertex coordinates. In octant coding.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
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.name(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
#define WarningInFunction
Report a warning using Foam::Warning.
bool operator!=(const particle &, const particle &)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
vectorField pointField
pointField is a vectorField.
vector point
Point is a vector.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
Vector< scalar > vector
A scalar version of the templated Vector.
Istream & operator>>(Istream &, pistonPointEdgeData &)
dimensioned< scalar > mag(const dimensioned< Type > &)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)
const Foam::label edgesArray[12][2]
const Foam::label facesArray[6][4]