42 const bool writeLinesOnly,
49 for (
const point& pt : pts)
51 meshTools::writeOBJ(
os, pt);
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)
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())
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)
407 if (nodes[nodeI].second() < 0)
423 for (
const auto&
id : box)
429 const label unsetSize = checked.
count(
false);
433 Info<<
"*** Problem: IDs not set: " << unsetSize <<
endl;
475 if (bb.overlaps(bbIn))
501 reinterpret_cast<const char*
>(&tree.
maxLevel_),
520 >> tree.minLeafSize_;
532 is >> tree.boundBoxes_
Templated tree of axis-aligned bounding boxes (AABB)
label minLeafSize_
Minimum points per leaf.
AABBTree()
Null constructor.
const List< labelList > & addressing() const
Return the contents addressing.
label maxLevel_
Maximum tree level.
bool pointInside(const point &pt) const
Determine whether a point is inside the bounding boxes.
void writeOBJ(const bool writeLinesOnly, const treeBoundBox &bb, label &vertI, Ostream &os) const
Write OBJ file of bounding box.
List< labelList > addressing_
Leaf addressing.
const List< treeBoundBox > & boundBoxes() const
Return the bounding boxes making up the tree.
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.
List< treeBoundBox > boundBoxes_
Bounding boxes making up the tree.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
DynamicList< T, SizeMin > & shrink()
Shrink the allocated space to the number of elements used.
void append(const T &val)
Copy append an element to the end of this list.
streamFormat format() const noexcept
Get the current stream format.
virtual bool check(const char *operation) const
Check IOstream status for given operation.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
virtual bool beginRawRead()=0
Start of low-level raw binary read.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void transfer(List< T > &list)
void append(const T &val)
Append an element at the end of the list.
virtual Ostream & write(const char c)
Write character.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
int overlaps
Flag to control which overlap calculations are performed.
An ordered pair of two objects of type <T> with first() and second() elements.
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)
void size(const label n)
Older name for setAddressableSize.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
unsigned int count(const bool on=true) const
Count number of bits set.
void set(const bitSet &bitset)
Set specified bits from another bitset.
A bounding box defined in terms of min/max extrema points.
const point & min() const
Minimum describing the bounding box.
void add(const boundBox &bb)
Extend to include the second box.
void inflate(const scalar s)
Inflate box by factor*mag(span) in all dimensions.
vector span() const
The bounding box span (from minimum to maximum)
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
A face is a list of labels corresponding to mesh vertices.
Standard boundBox with extra functionality for use in octree.
static const edgeList edges
Edge to point addressing.
static const faceList faces
Face to point addressing.
tmp< pointField > points() const
Vertex coordinates. In octant coding.
OBJstream os(runTime.globalPath()/outputName)
Pair< label > labelPair
A pair of labels.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i)
void component(FieldField< Field, typename FieldField< Field, Type >::cmptType > &sf, const FieldField< Field, Type > &f, const direction d)
messageStream Info
Information stream (stdout output on master, null elsewhere)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Istream & operator>>(Istream &, directionInfo &)
label readRawLabel(Istream &is)
Read raw label from binary stream.
void sort(UList< T > &list)
Sort the list.
void divide(FieldField< Field, Type > &f, const FieldField< Field, Type > &f1, const FieldField< Field, scalar > &f2)
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.