39#ifndef Foam_dynamicIndexedOctree_H
40#define Foam_dynamicIndexedOctree_H
98 const label maxLevels_;
103 const scalar maxLeafRatio_;
105 const label minSize_;
107 const scalar maxDuplicity_;
138 const label parentNodeIndex,
139 const label octantToBeDivided
143 void recursiveSubDivision
146 const label contentI,
147 const label parentIndex,
154 volumeType calcVolumeType(
const label nodeI)
const;
169 label& nearestShapeI,
177 const label parentNodeI,
183 static point pushPoint
187 const bool pushInside
192 static point pushPoint
197 const bool pushInside
202 static point pushPointIntoFace
240 const point& treeStart,
256 const point& treeStart,
257 const point& treeEnd,
258 const label startNodeI,
260 const bool verbose =
false
286 const scalar radiusSqr,
291 template<
class CompareOp>
294 const scalar nearDist,
309 label countElements(
const labelBits index)
const;
317 const bool leavesOnly,
318 const bool writeLinesOnly =
false
322 void writeOBJ(
const label nodeI,
const direction octant)
const;
334 const label maxLevels,
335 const scalar maxLeafRatio,
336 const scalar maxDuplicity
371 const treeBoundBox&
bb()
const
377 return nodes_[0].bb_;
391 const scalar nearestDistSqr
400 scalar& nearestDistSqr,
401 label& nearestShapeI,
457 const scalar radiusSqr
466 const scalar radiusSqr
475 const scalar radiusSqr,
500 const vector& outsideNormal,
506 template<
class CompareOp>
509 const scalar nearDist,
518 bool insert(label startIndex, label endIndex);
522 const label nodIndex,
528 bool remove(
const label index);
530 label
removeIndex(
const label nodIndex,
const label index);
543 const bool printContents,
554 friend Ostream& operator<< <Type>
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
A 1D vector of objects of type <T> with a fixed length <N>.
Minimal example by using system/controlDict.functions:
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A dynamic list of packed unsigned integers, with the number of bits per item specified by the <Width>...
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
ClassName("dynamicIndexedOctree")
Runtime type information.
dynamicIndexedOctreeBase()=default
Default construct.
indexedOctreeBase::node node
Document that we are using the same types of node.
Non-pointer based hierarchical recursive searching. Storage is dynamic, so elements can be deleted.
label findInside(const point &) const
Find shape containing point. Only implemented for certain.
const List< node > & nodes() const noexcept
List of all nodes.
const labelList & findIndices(const point &) const
Find the shape indices that occupy the result of findNode.
const Type & shapes() const noexcept
Reference to shape.
const treeBoundBox & bb() const
Top bounding box.
label removeIndex(const label nodIndex, const label index)
bool overlaps(const treeBoundBox &bb) const
True if any shapes overlap the bounding box.
autoPtr< dynamicIndexedOctree< Type > > clone() const
Clone.
void print(prefixOSstream &, const bool printContents, const label) const
Print tree. Either print all indices (printContent = true) or.
static volumeType getSide(const vector &outsideNormal, const vector &vec)
Helper function to return the side. Returns outside if.
dynamicIndexedOctree(const Type &shapes, const treeBoundBox &bb, const label maxLevels, const scalar maxLeafRatio, const scalar maxDuplicity)
Construct from shapes.
bool remove(const label index)
Remove an object from the tree.
labelBits findNode(const label nodeI, const point &) const
Find deepest node (as parent+octant) containing point. Starts.
PackedList< 2 > & nodeTypes() const noexcept
Per node, per octant whether is fully inside/outside/mixed.
void writeTreeInfo() const
const DynamicList< DynamicList< label > > & contents() const noexcept
List of all contents (referenced by those nodes that are contents).
bool insertIndex(const label nodIndex, const label index, label &nLevels)
pointIndexHit findLineAny(const point &start, const point &end) const
Find any intersection of line between start and end.
Tree node. Has up pointer and down pointers.
indexedOctreeBase()=default
Default construct.
A 29bits (or 61bits) integer label with 3bits direction (eg, octant) packed into single label.
Version of OSstream that prints a prefix on each line.
Standard boundBox with extra functionality for use in octree.
static const treeBoundBox & null() noexcept
The null treeBoundBox is the same as an inverted box.
An enumeration wrapper for classification of a location as being inside/outside of a volume.
A class for handling words, derived from Foam::string.
#define ClassName(TypeNameString)
Add typeName information from argument TypeNameString to a class.
OBJstream os(runTime.globalPath()/outputName)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
List< label > labelList
A List of labels.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
label facePoint(const int facei, const block &block, const label i, const label j)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
line< point, const point & > linePointRef
A line using referred points.
vector point
Point is a vector.
PointIndexHit< point > pointIndexHit
A PointIndexHit with a 3D point.
UList< label > labelUList
A UList of labels.
bool ln(const fileName &src, const fileName &dst)
Create a softlink. dst should not exist. Returns true if successful.
nonInt insert("surfaceSum(((S|magSf)*S)")