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;
66 for (
const label fpi :
f)
68 os <<
' ' << fpi + vertI + 1;
81 const bool leavesOnly,
82 const bool writeLinesOnly,
91 if (!leavesOnly || nodeI < 0)
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),
402 if (nodes[nodeI].first() < 0)
404 boundBoxes.append(bbs[nodeI].first());
405 addressing.
append(addr[-(nodes[nodeI].first() + 1)]);
407 if (nodes[nodeI].second() < 0)
409 boundBoxes.append(bbs[nodeI].second());
410 addressing.
append(addr[-(nodes[nodeI].second() + 1)]);
414 boundBoxes_.transfer(boundBoxes);
415 addressing_.transfer(addressing);
421 for (
const auto& box : addressing_)
423 for (
const auto&
id : box)
429 const label unsetSize = checked.count(
false);
433 Info<<
"*** Problem: IDs not set: " << unsetSize <<
endl;
501 reinterpret_cast<const char*
>(&tree.
maxLevel_),
520 >> tree.minLeafSize_;
532 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
streamFormat format() const noexcept
Get the current stream format.
const List< treeBoundBox > & boundBoxes() const
Return the bounding boxes making up the tree.
void set(const bitSet &bitset)
Set specified bits from another bitset.
List< treeBoundBox > boundBoxes_
Bounding boxes making up the tree.
Istream & operator>>(Istream &, directionInfo &)
Ostream & endl(Ostream &os)
Add newline and flush stream.
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.
virtual Ostream & write(const char c)
Write character.
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)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
messageStream Info
Information stream (stdout output on master, null elsewhere)
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.
OBJstream os(runTime.globalPath()/outputName)
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.
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.
void size(const label n)
Older name for setAddressableSize.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
List< labelList > addressing_
Leaf addressing.