38#ifndef dynamicIndexedOctree_H
39#define dynamicIndexedOctree_H
60template<
class Type>
Ostream&
operator<<
83 public dynamicIndexedOctreeName
111 return is >>
n.bb_ >>
n.parent_ >>
n.subNodes_;
137 static scalar perturbTol_;
147 const label maxLevels_;
152 const scalar maxLeafRatio_;
154 const label minSize_;
156 const scalar maxDuplicity_;
176 const scalar nearestDistSqr,
196 const label contentI,
197 const label parentNodeIndex,
198 const label octantToBeDivided
202 void recursiveSubDivision
205 const label contentI,
206 const label parentIndex,
213 volumeType calcVolumeType(
const label nodeI)
const;
228 label& nearestShapeI,
236 const label parentNodeI,
242 static point pushPoint
246 const bool pushInside
251 static point pushPoint
256 const bool pushInside
261 static point pushPointIntoFace
299 const point& treeStart,
315 const point& treeStart,
316 const point& treeEnd,
317 const label startNodeI,
319 const bool verbose =
false
344 const scalar radiusSqr,
349 template<
class CompareOp>
352 const scalar nearDist,
367 label countElements(
const labelBits index)
const;
370 void writeOBJ(
const label nodeI,
const direction octant)
const;
383 static labelBits nodePlusOctant
389 return labelBits(i + 1, octant);
393 static labelBits emptyPlusOctant
398 return labelBits(0, octant);
413 const treeBoundBox&
bb,
414 const label maxLevels,
415 const scalar maxLeafRatio,
416 const scalar maxDuplicity
432 const Type&
shapes()
const
458 return nodes_[0].bb_;
515 const scalar nearestDistSqr
524 scalar& nearestDistSqr,
525 label& nearestShapeI,
567 const scalar radiusSqr
590 const vector& outsideNormal,
600 const scalar nearestDistSqr,
606 template<
class CompareOp>
609 const scalar nearDist,
618 bool insert(label startIndex, label endIndex);
622 const label nodIndex,
628 bool remove(
const label index);
630 label
removeIndex(
const label nodIndex,
const label index);
640 const bool printContents,
651 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:
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
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>...
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
bool empty() const noexcept
True if the UList is empty (ie, size() is zero)
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Tree node. Has up pointer and down pointers.
friend Ostream & operator<<(Ostream &os, const node &n)
FixedList< labelBits, 8 > subNodes_
IDs of the 8 nodes on all sides of the mid point.
label parent_
Parent node (index into nodes_ of tree)
friend bool operator!=(const node &a, const node &b)
friend Istream & operator>>(Istream &is, node &n)
treeBoundBox bb_
Bounding box of this node.
friend bool operator==(const node &a, const node &b)
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.
static bool isEmpty(const labelBits i)
const labelList & findIndices(const point &) const
Find the shape indices that occupy the result of findNode.
static label getNode(const labelBits i)
static direction getOctant(const labelBits i)
static scalar & perturbTol()
Get the perturbation tolerance.
static bool isContent(const labelBits i)
static label getContent(const labelBits i)
const treeBoundBox & bb() const
Top bounding box.
label removeIndex(const label nodIndex, const label index)
const contentListList & contents() const
List of all contents (referenced by those nodes that are.
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.
const List< node > & nodes() const
List of all nodes.
bool insert(label startIndex, label endIndex)
Insert a new object into the tree.
const Type & shapes() const
Reference to shape.
labelBits findNode(const label nodeI, const point &) const
Find deepest node (as parent+octant) containing point. Starts.
static bool isNode(const labelBits i)
void writeTreeInfo() const
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.
A 29bits label and 3bits direction packed into single label.
Version of OSstream that prints a prefix on each line.
Standard boundBox with extra functionality for use in octree.
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 TemplateName(TemplateNameString)
Add typeName information from argument TypeNameString to a.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
label facePoint(const int facei, const block &block, const label i, const label j)
DynamicList< autoPtr< DynamicList< label > > > contentListList
errorManip< error > abort(error &err)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
bool ln(const fileName &src, const fileName &dst)
Create a softlink. dst should not exist. Returns true if successful.