Go to the documentation of this file.
42 const bool writeLinesOnly,
49 for (
const point& pt : pts)
58 os <<
"l " <<
e[0] + vertI + 1 <<
' ' <<
e[1] + vertI + 1 <<
nl;
68 os <<
' ' << fpi + vertI + 1;
81 const bool leavesOnly,
82 const bool writeLinesOnly,
91 if (!leavesOnly || nodeI < 0)
93 writeOBJ(writeLinesOnly, bb, vertI, os);
104 nodes[nodeI].first(),
115 nodes[nodeI].second(),
128 const bool equalBinSize,
146 scalar maxSpan = span[maxDir];
147 for (
label dirI = 1; dirI < 3; ++dirI)
149 if (span[dirI] > maxSpan)
151 maxSpan = span[dirI];
166 for (
const label objI : objectIDs)
168 const Type& obj = objects[objI];
170 for (
const label pointI : obj)
172 if (isUsedPoint.set(pointI))
192 scalar divMin =
divide + tolerance_*maxSpan;
193 scalar divMax =
divide - tolerance_*maxSpan;
204 for (
const label objI : objectIDs)
206 const Type& obj = objects[objI];
208 bool intoMin =
false;
209 bool intoMax =
false;
211 for (
const label pointI : obj)
214 if (pt[maxDir] < divMin)
218 if (pt[maxDir] > divMax)
228 minBinObjectIDs.append(objI);
233 maxBinObjectIDs.
append(objI);
239 if (minBinObjectIDs.size())
243 if (maxBinObjectIDs.size())
249 maxBinObjectIDs.shrink();
253 if (minBinObjectIDs.size() > minLeafSize_ && level < maxLevel_)
262 minI = -addressing.size() - 1;
263 addressing.
append(minBinObjectIDs);
267 if (maxBinObjectIDs.size() > minLeafSize_ && level < maxLevel_)
276 maxI = -addressing.size() - 1;
277 addressing.
append(maxBinObjectIDs);
336 const bool equalBinSize,
337 const label maxLevel,
338 const label minLeafSize
342 minLeafSize_(minLeafSize),
401 if (nodes[nodeI].first() < 0)
403 boundBoxes.append(bbs[nodeI].first());
404 addressing.
append(addr[nodeI + 1]);
406 if (nodes[nodeI].second() < 0)
408 boundBoxes.append(bbs[nodeI].second());
409 addressing.
append(addr[nodeI + 1]);
413 boundBoxes_.transfer(boundBoxes);
414 addressing_.transfer(addressing);
480 reinterpret_cast<const char*
>(&tree.
maxLevel_),
499 >> tree.minLeafSize_;
511 is >> tree.boundBoxes_
bool overlaps(const boundBox &bb) const
Overlaps other bounding box?
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
tmp< pointField > points() const
Vertex coordinates. In octant coding.
bool pointInside(const point &pt) const
Determine whether a point is inside the bounding boxes.
void inflate(const scalar s)
Inflate box by factor*mag(span) in all dimensions.
Standard boundBox with extra functionality for use in octree.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
bool overlaps(const boundBox &bbIn) const
Determine whether a bounding box overlaps the tree bounding.
streamFormat format() const noexcept
Get the current stream format.
const List< treeBoundBox > & boundBoxes() const
Return the bounding boxes making up the tree.
List< treeBoundBox > boundBoxes_
Bounding boxes making up the tree.
Istream & operator>>(Istream &, directionInfo &)
static const edgeList edges
Edge to point addressing.
void writeOBJ(const bool writeLinesOnly, const treeBoundBox &bb, label &vertI, Ostream &os) const
Write OBJ file of bounding box.
DynamicList< T, SizeMin > & shrink()
Shrink the allocated space to the number of elements used.
const point & min() const
Minimum describing the bounding box.
#define forAll(list, i)
Loop across all elements in list.
void divide(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
Pair< label > labelPair
A pair of labels.
vector span() const
The bounding box span (from minimum to maximum)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
static const faceList faces
Face to point addressing.
DynamicList< T, SizeMin > & append(const T &val)
Append an element to the end of this list.
AABBTree()
Null constructor.
bool empty() const noexcept
True if the UList is empty (ie, size() is zero)
virtual bool check(const char *operation) const
Check IOstream status for given operation.
label maxLevel_
Maximum tree level.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
virtual bool beginRawRead()=0
Start of low-level raw binary read.
bool contains(const vector &dir, const point &) const
Contains point (inside or on edge) and moving in direction.
An ordered pair of two objects of type <T> with first() and second() elements.
const List< labelList > & addressing() const
Return the contents addressing.
Templated tree of axis-aligned bounding boxes (AABB)
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void createBoxes(const bool equalBinSize, const label level, const List< Type > &objects, const pointField &points, const DynamicList< label > &objectIDs, const treeBoundBox &bb, const label nodeI, DynamicList< Pair< treeBoundBox >> &bbs, DynamicList< labelPair > &nodes, DynamicList< labelList > &addressing) const
Create the bounding boxes by interrogating points.
const dimensionedScalar e
Elementary charge.
labelList identity(const label len, label start=0)
Create identity map of the given length with (map[i] == i)
A bounding box defined in terms of min/max extrema points.
void size(const label n) noexcept
Override size to be inconsistent with allocated storage.
label minLeafSize_
Minimum points per leaf.
A face is a list of labels corresponding to mesh vertices.
label readRawLabel(Istream &is)
Read raw label from binary stream.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Ostream & operator<<(Ostream &, const boundaryPatch &)
List< labelList > addressing_
Leaf adressing.