Go to the documentation of this file.
38 #ifndef dynamicIndexedOctree_H
39 #define dynamicIndexedOctree_H
60 template<
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>
bool insert(label startIndex, label endIndex)
Insert a new object into the tree.
label findInside(const point &) const
Find shape containing point. Only implemented for certain.
A class for handling words, derived from Foam::string.
friend bool operator!=(const node &a, const node &b)
A 29bits label and 3bits direction packed into single label.
static bool isContent(const labelBits i)
static direction getOctant(const labelBits i)
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
static label getContent(const labelBits i)
Standard boundBox with extra functionality for use in octree.
friend Ostream & operator<<(Ostream &os, const node &n)
Non-pointer based hierarchical recursive searching. Storage is dynamic, so elements can be deleted.
label facePoint(const int facei, const block &block, const label i, const label j)
Version of OSstream that prints a prefix on each line.
bool remove(const label index)
Remove an object from the tree.
This class describes the interaction of (usually) a face and a point. It carries the info of a succes...
label removeIndex(const label nodIndex, const label index)
An enumeration wrapper for classification of a location as being inside/outside of a volume.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
friend Istream & operator>>(Istream &is, node &n)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
TemplateName(blendedSchemeBase)
const Type & shapes() const
Reference to shape.
static scalar & perturbTol()
Get the perturbation tolerance.
dynamicIndexedOctree(const Type &shapes, const treeBoundBox &bb, const label maxLevels, const scalar maxLeafRatio, const scalar maxDuplicity)
Construct from shapes.
static bool isEmpty(const labelBits i)
OBJstream os(runTime.globalPath()/outputName)
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
const List< node > & nodes() const
List of all nodes.
errorManip< error > abort(error &err)
autoPtr< dynamicIndexedOctree< Type > > clone() const
Clone.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
labelBits findNode(const label nodeI, const point &) const
Find deepest node (as parent+octant) containing point. Starts.
friend bool operator==(const node &a, const node &b)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void writeTreeInfo() const
treeBoundBox bb_
Bounding box of this node.
Tree node. Has up pointer and down pointers.
bool insertIndex(const label nodIndex, const label index, label &nLevels)
FixedList< labelBits, 8 > subNodes_
IDs of the 8 nodes on all sides of the mid point.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
label parent_
Parent node (index into nodes_ of tree)
A 1D vector of objects of type <T> with a fixed length <N>.
const treeBoundBox & bb() const
Top bounding box.
bool ln(const fileName &src, const fileName &dst)
Create a softlink. dst should not exist. Returns true if successful.
DynamicList< autoPtr< DynamicList< label > > > contentListList
bool write(Ostream &os) const
const labelList & findIndices(const point &) const
Find the shape indices that occupy the result of findNode.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
static volumeType getSide(const vector &outsideNormal, const vector &vec)
Helper function to return the side. Returns outside if.
pointIndexHit findLineAny(const point &start, const point &end) const
Find any intersection of line between start and end.
static label getNode(const labelBits i)
static bool isNode(const labelBits i)
Minimal example by using system/controlDict.functions:
const contentListList & contents() const
List of all contents (referenced by those nodes that are.
void print(prefixOSstream &, const bool printContents, const label) const
Print tree. Either print all indices (printContent = true) or.