37#ifndef indexedOctree_H
38#define indexedOctree_H
74 public indexedOctreeName
102 return is >>
n.bb_ >>
n.parent_ >>
n.subNodes_;
128 static scalar perturbTol_;
154 const scalar nearestDistSqr,
188 static label compactContents
192 const label compactLevel,
201 volumeType calcVolumeType(
const label nodeI)
const;
210 template<
class FindNearestOp>
217 label& nearestShapeI,
221 const FindNearestOp& fnOp
227 const label parentNodeI,
233 static point pushPoint
237 const bool pushInside
242 static point pushPoint
247 const bool pushInside
255 static point pushPointIntoFace
289 template<
class FindIntersectOp>
293 const point& treeStart,
304 const FindIntersectOp& fiOp
308 template<
class FindIntersectOp>
312 const point& treeStart,
313 const point& treeEnd,
314 const label startNodeI,
316 const FindIntersectOp& fiOp,
317 const bool verbose =
false
321 template<
class FindIntersectOp>
327 const FindIntersectOp& fiOp
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);
416 const List<node>&
nodes,
424 const treeBoundBox&
bb,
425 const label maxLevels,
426 const scalar maxLeafRatio,
427 const scalar maxDuplicity
445 const Type&
shapes()
const
471 return nodes_[0].bb_;
529 const scalar nearestDistSqr
537 template<
class FindNearestOp>
541 const scalar nearestDistSqr,
543 const FindNearestOp& fnOp
547 template<
class FindNearestOp>
553 scalar& nearestDistSqr,
554 label& nearestShapeI,
557 const FindNearestOp& fnOp
574 template<
class FindNearestOp>
581 const FindNearestOp& fnOp
599 template<
class FindIntersectOp>
604 const FindIntersectOp& fiOp
608 template<
class FindIntersectOp>
613 const FindIntersectOp& fiOp
626 const scalar radiusSqr
649 const vector& outsideNormal,
659 const scalar nearestDistSqr,
665 template<
class CompareOp>
668 const scalar nearDist,
681 const bool printContents,
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.
const labelListList & contents() const
List of all contents (referenced by those nodes that are.
pointIndexHit findLine(const point &start, const point &end, const FindIntersectOp &fiOp) const
Find nearest intersection of line between start and end.
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.
pointIndexHit findNearest(const point &sample, const scalar nearestDistSqr, const FindNearestOp &fnOp) const
Calculate nearest point on nearest shape.
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.
pointIndexHit findNearest(const linePointRef &ln, treeBoundBox &tightest, point &linePoint, const FindNearestOp &fnOp) const
indexedOctree(const Type &shapes)
Construct null.
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.
autoPtr< indexedOctree< Type > > clone() const
Clone.
const List< node > & nodes() const
List of all nodes.
const Type & shapes() const
Reference to shape.
labelBits findNode(const label nodeI, const point &) const
Find deepest node (as parent+octant) containing point. Starts.
pointIndexHit findLineAny(const point &start, const point &end, const FindIntersectOp &fiOp) const
Find any intersection of line between start and end.
static bool isNode(const labelBits i)
PackedList< 2 > & nodeTypes() const
Per node, per octant whether is fully inside/outside/mixed.
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)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
List< labelList > labelListList
A List of labelList.
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.