Loading...
Searching...
No Matches
indexedOctree.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::indexedOctree
29
30Description
31 Non-pointer based hierarchical recursive searching
32
33SourceFiles
34 indexedOctree.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef Foam_indexedOctree_H
39#define Foam_indexedOctree_H
40
41#include "treeBoundBox.H"
42#include "pointIndexHit.H"
43#include "FixedList.H"
44#include "Ostream.H"
45#include "HashSet.H"
46#include "labelBits.H"
47#include "PackedList.H"
48#include "volumeType.H"
49
50// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51
52namespace Foam
53{
54
55// Forward Declarations
56template<class Type> class indexedOctree;
57template<class Type> Ostream& operator<<(Ostream&, const indexedOctree<Type>&);
58
59
60/*---------------------------------------------------------------------------*\
61 Class indexedOctreeBase Declaration
62\*---------------------------------------------------------------------------*/
63
64//- Template invariant parts for indexedOctree
65// The internal node bookkeeping is encoded follows:
66// - 0: empty
67// - +ve: parent
68// - -ve: leaf
70{
71public:
72
73 // Public Data Types
74
75 //- Tree node. Has up pointer and down pointers.
76 class node
77 {
78 public:
79
80 //- Has exactly 8 sub-nodes (octants)
81 static constexpr direction nChildren = 8;
82
83 //- Bounding box of this node
85
86 //- Parent node (index into flat list addressing for tree)
87 label parent_ = -1;
89 //- IDs of the 8 nodes on all sides of the mid point
91
92
93 // Operators
94
95 friend bool operator==(const node& a, const node& b)
96 {
97 return
98 (
99 a.parent_ == b.parent_
100 && a.subNodes_ == b.subNodes_
101 && a.bb_ == b.bb_
102 );
104
105 friend bool operator!=(const node& a, const node& b)
106 {
107 return !(a == b);
108 }
109
110 friend Ostream& operator<< (Ostream& os, const node& n)
111 {
112 return os << n.bb_ << token::SPACE
113 << n.parent_ << token::SPACE << n.subNodes_;
114 }
115
116 friend Istream& operator>> (Istream& is, node& n)
117 {
118 return is >> n.bb_ >> n.parent_ >> n.subNodes_;
119 }
120 };
121
122
123 // Static Functions
125 // Tests for node handling
126 // (0: empty, +ve: parent, -ve: leaf)
127
128 //- An empty node - no content
129 static bool isEmpty(labelBits i) noexcept
130 {
131 return (i.val() == 0);
132 }
133
134 //- Node with content (leaf)
135 static bool isContent(labelBits i) noexcept
136 {
137 return (i.val() < 0);
138 }
140 //- A parent node
141 static bool isNode(labelBits i) noexcept
142 {
143 return (i.val() > 0);
144 }
145
146
147 // Decode/retrieve node addressing
148
149 //- Return real (dereferenced) index for a content node
150 static label getContent(labelBits i)
151 {
152 if (!isContent(i))
153 {
156 }
157 return (-i.val()-1);
158 }
159
160 //- Return real (dereferenced) index for a parent node
161 static label getNode(const labelBits i)
162 {
163 if (!isNode(i))
164 {
167 }
168 return (i.val()-1);
169 }
170
171 //- Return sub-node direction/octant
172 static direction getOctant(labelBits i) noexcept
173 {
174 return i.bits();
175 }
176
177
178protected:
180 // Static Data
181
182 //- Relative perturbation tolerance.
183 // Determines when point is considered to be close to face/edge
184 // of bb of node.
185 // The tolerance is relative to the bounding box of the smallest
186 // node.
187 static scalar perturbTol_;
188
189
190 // Protected Member Functions
191
192 // Encode node addressing
193 // (only used when building)
194
195 //- From empty to subNodes_ entry
196 static labelBits emptyPlusOctant(direction octant)
197 {
198 return labelBits(0, octant);
199 }
200
201 //- From index into contents_ to subNodes_ entry
202 static labelBits contentPlusOctant(label i, direction octant)
203 {
204 return labelBits(-i-1, octant);
205 }
206
207 //- From index into nodes_ to subNodes_ entry
208 static labelBits nodePlusOctant(label i, direction octant)
209 {
210 return labelBits(i+1, octant);
211 }
212
213
214public:
215
216 //- Get the perturbation tolerance
217 static scalar& perturbTol() noexcept { return perturbTol_; }
218
219 //- Set the perturbation tolerance, return the old value
220 static scalar perturbTol(scalar tol) noexcept
222 scalar old(perturbTol_);
223 perturbTol_ = tol;
224 return old;
225 }
226
227
228 //- Runtime type information
229 ClassName("indexedOctree");
230
231
232 // Constructors
233
234 //- Default construct
235 indexedOctreeBase() = default;
236
238 // Output Helpers
239
240 //- Write treeBoundBox in OBJ format
241 static void writeOBJ
242 (
243 Ostream& os,
244 const treeBoundBox& bb,
245 label& vertIndex,
246 const bool writeLinesOnly = false
247 );
249
250
251/*---------------------------------------------------------------------------*\
252 Class indexedOctree Declaration
253\*---------------------------------------------------------------------------*/
254
255template<class Type>
256class indexedOctree
257:
258 public indexedOctreeBase
259{
260 // Private Data
261
262 //- Underlying shapes for geometric queries.
263 const Type shapes_;
265 //- List of all nodes
266 List<node> nodes_;
267
268 //- List of all contents (referenced by those nodes that are contents)
269 List<labelList> contents_;
270
271 //- Per node per octant whether is fully inside/outside/mixed.
272 mutable PackedList<2> nodeTypes_;
273
274
275 // Private Member Functions
276
277 // Construction
278
279 //- Split list of indices into 8 bins
280 // according to where they are in relation to mid.
281 void divide
282 (
283 const labelUList& indices,
284 const treeBoundBox& bb,
285 FixedList<labelList, 8>& dividedIndices
286 ) const;
287
288 //- Subdivide the contents node at position contentI.
289 // Appends to contents.
291 (
292 const treeBoundBox& bb,
294 label contentIndex
295 ) const;
296
297 //- Split any contents node with more than minSize elements.
298 void splitNodes
299 (
300 const label minSize,
303 ) const;
304
305 //- Reorder contents to be in same order as nodes.
306 // Returns number of nodes on the compactLevel.
307 static label compactContents
308 (
311 const label compactLevel,
312 const label nodeI,
313 const label level,
314 List<labelList>& compactedContents,
315 label& compactI
316 );
317
318 //- Determine inside/outside per node (mixed if cannot be
319 // determined). Only valid for closed shapes.
320 volumeType calcVolumeType(const label nodeI) const;
321
322 //- Search cached volume type.
323 volumeType getVolumeType(const label nodeI, const point&) const;
324
325
326 // Query
327
328 //- Find nearest point to line.
329 template<class FindNearestOp>
330 void findNearest
331 (
332 const label nodeI,
333 const linePointRef& ln,
334
335 treeBoundBox& tightest,
336 label& nearestShapeI,
337 point& linePoint,
338 point& nearestPoint,
339
340 const FindNearestOp& fnOp
341 ) const;
342
343 //- Return bbox of octant
344 treeBoundBox subBbox
345 (
346 const label parentNodeI,
347 const direction octant
348 ) const;
349
350 //- Helper: take a point on/close to face of bb and push it
351 // inside or outside of bb.
352 static point pushPoint
353 (
354 const treeBoundBox&,
355 const point&,
356 const bool pushInside
357 );
358
359 //- Helper: take a point on face of bb and push it
360 // inside or outside of bb.
361 static point pushPoint
362 (
363 const treeBoundBox&,
364 const direction,
365 const point&,
366 const bool pushInside
367 );
368
369 //- Helper: take point on face(s) of bb and push it away from
370 // edges of face.
371 // Guarantees that if pt is on a face it gets perturbed
372 // so it is away from the face edges.
373 // If pt is not on a face does nothing.
374 static point pushPointIntoFace
375 (
376 const treeBoundBox& bb,
377 const vector& dir, // end-start
378 const point& pt
379 );
380
381 //- Walk to parent of node+octant.
382 bool walkToParent
383 (
384 const label nodeI,
385 const direction octant,
386
387 label& parentNodeI,
388 label& parentOctant
389 ) const;
390
391 //- Walk tree to neighbouring node. Return false if edge of tree
392 // hit.
393 bool walkToNeighbour
394 (
395 const point& facePoint,
396 const direction faceID, // direction to walk in
397 label& nodeI,
398 direction& octant
399 ) const;
400
401 //- Debug: return verbose the bounding box faces
402 static word faceString(const direction faceID);
403
404 //- Traverse a node. If intersects a triangle return first
405 // intersection point.
406 // findAny=true : return any intersection
407 // findAny=false: return nearest (to start) intersection
408 template<class FindIntersectOp>
409 void traverseNode
410 (
411 const bool findAny,
412 const point& treeStart,
413 const vector& treeVec,
414
415 const point& start,
416 const point& end,
417 const label nodeI,
418 const direction octantI,
419
420 pointIndexHit& hitInfo,
421 direction& faceID,
422
423 const FindIntersectOp& fiOp
424 ) const;
425
426 //- Find any or nearest intersection
427 template<class FindIntersectOp>
428 pointIndexHit findLine
429 (
430 const bool findAny,
431 const point& treeStart,
432 const point& treeEnd,
433 const label startNodeI,
434 const direction startOctantI,
435 const FindIntersectOp& fiOp,
436 const bool verbose = false
437 ) const;
438
439 //- Find any or nearest intersection of line between start and end.
440 template<class FindIntersectOp>
441 pointIndexHit findLine
442 (
443 const bool findAny,
444 const point& start,
445 const point& end,
446 const FindIntersectOp& fiOp
447 ) const;
448
449 //- Find elements intersecting box
450 // Store all results in elements (if non-null), or early exit
451 bool findBox
452 (
453 const label nodeI,
454 const treeBoundBox& searchBox,
455 labelHashSet* elements
456 ) const;
457
458 //- Find elements intersecting sphere.
459 // Store all results in elements (if non-null), or early exit
460 bool findSphere
461 (
462 const label nodeI,
463 const point& centre,
464 const scalar radiusSqr,
465 labelHashSet* elements
466 ) const;
467
468
469 template<class CompareOp>
470 static void findNear
471 (
472 const scalar nearDist,
473 const bool okOrder,
474 const indexedOctree<Type>& tree1,
475 const labelBits index1,
476 const treeBoundBox& bb1,
477 const indexedOctree<Type>& tree2,
478 const labelBits index2,
479 const treeBoundBox& bb2,
480 CompareOp& cop
481 );
482
483
484 // Other
485
486 //- Count number of elements on this and sublevels
487 label countElements(const labelBits index) const;
488
489 //- Number of leafs below given node
490 label countLeafs(const label nodeI) const;
491
492 //- Write node treeBoundBoxes in OBJ format
493 void writeOBJ
494 (
495 const label nodeI,
496 Ostream& os,
497 label& vertIndex,
498 const bool leavesOnly,
499 const bool writeLinesOnly = false
500 ) const;
501
502 //- Dump node+octant to an obj file
503 void writeOBJ(const label nodeI, const direction octant) const;
504
505
506public:
507
508 // Constructors
509
510 //- Construct null
511 indexedOctree(const Type& shapes);
512
513 //- Construct from components
515 (
516 const Type& shapes,
517 const List<node>& nodes,
519 );
520
521 //- Construct from shapes
523 (
524 const Type& shapes,
525 const treeBoundBox& bb,
526 const label maxLevels, // maximum number of levels
527 const scalar maxLeafRatio, // how many elements per leaf
528 const scalar maxDuplicity // in how many leaves is a shape on
529 // average
530 );
531
532 //- Construct from Istream
533 indexedOctree(const Type& shapes, Istream& is);
534
535 //- Clone
537 {
539 }
540
541
542 // Member Functions
543
544 // Access
545
546 //- Reference to shape
547 const Type& shapes() const noexcept { return shapes_; }
548
549 //- List of all nodes
550 const List<node>& nodes() const noexcept { return nodes_; }
551
552 //- List of all contents
553 //- (referenced by those nodes that are contents)
554 const List<labelList>& contents() const noexcept
555 {
556 return contents_;
557 }
558
559 //- Per node, per octant whether is fully inside/outside/mixed.
560 PackedList<2>& nodeTypes() const noexcept
561 {
562 return nodeTypes_;
563 }
564
565 //- Top bounding box
566 const treeBoundBox& bb() const
567 {
568 if (nodes_.empty())
569 {
570 return treeBoundBox::null();
571 }
572 return nodes_[0].bb_;
573 }
574
575 //- Return the number of leaf nodes
576 label nLeafs() const;
577
578
579 // Queries
580
581 pointIndexHit findNearest
582 (
583 const point& sample,
584 const scalar nearestDistSqr
585 ) const;
586
587 //- Calculate nearest point on nearest shape.
588 // Returns
589 // - bool : any point found nearer than nearestDistSqr
590 // - label: index in shapes
591 // - point: actual nearest point found
592 template<class FindNearestOp>
593 pointIndexHit findNearest
594 (
595 const point& sample,
596 const scalar nearestDistSqr,
597
598 const FindNearestOp& fnOp
599 ) const;
600
601 //- Low level: calculate nearest starting from subnode.
602 template<class FindNearestOp>
603 void findNearest
604 (
605 const label nodeI,
606 const point&,
607
608 scalar& nearestDistSqr,
609 label& nearestShapeI,
610 point& nearestPoint,
611
612 const FindNearestOp& fnOp
613 ) const;
614
615 //- Find nearest to line.
616 // Returns
617 // - bool : any point found?
618 // - label: index in shapes
619 // - point: actual nearest point found
620 // sets:
621 // - linePoint : corresponding nearest point on line
622 pointIndexHit findNearest
623 (
624 const linePointRef& ln,
625 treeBoundBox& tightest,
626 point& linePoint
627 ) const;
628
629 template<class FindNearestOp>
630 pointIndexHit findNearest
631 (
633 treeBoundBox& tightest,
634 point& linePoint,
635
636 const FindNearestOp& fnOp
637 ) const;
638
639 //- Find nearest intersection of line between start and end.
640 pointIndexHit findLine
641 (
642 const point& start,
643 const point& end
644 ) const;
646 //- Find any intersection of line between start and end.
648 (
649 const point& start,
650 const point& end
651 ) const;
652
653 //- Find nearest intersection of line between start and end.
654 template<class FindIntersectOp>
655 pointIndexHit findLine
656 (
657 const point& start,
658 const point& end,
659 const FindIntersectOp& fiOp
660 ) const;
661
662 //- Find any intersection of line between start and end.
663 template<class FindIntersectOp>
665 (
666 const point& start,
667 const point& end,
668 const FindIntersectOp& fiOp
669 ) const;
670
671 //- True if any shapes overlap the bounding box
672 bool overlaps(const treeBoundBox& bb) const;
673
674 //- Find indices of all shapes inside or overlapping
675 //- a bounding box (i.e. all shapes not outside box)
676 // \returns the indices (in no particular order)
677 labelList findBox
678 (
679 const treeBoundBox& bb
680 ) const;
681
682 //- Find indices of all shapes inside or overlapping
683 //- a bounding box (i.e. all shapes not outside box)
684 // \returns the number of elements found
685 label findBox
686 (
687 const treeBoundBox& bb,
688 labelHashSet& elements
689 ) const;
691 //- True if any shapes overlap the bounding sphere
692 bool overlaps
693 (
694 const point& centre,
695 const scalar radiusSqr
696 ) const;
697
698 //- Find indices of all shapes inside or overlapping
699 //- a bounding sphere (i.e. all shapes not outside a sphere)
700 // \returns the indices (in no particular order)
701 labelList findSphere
703 const point& centre,
704 const scalar radiusSqr
705 ) const;
706
707 //- Find indices of all shapes inside or overlapping
708 //- a bounding sphere (i.e. all shapes not outside sphere)
709 // \returns the number of elements found
710 label findSphere
711 (
712 const point& centre,
713 const scalar radiusSqr,
714 labelHashSet& elements
715 ) const;
716
717
718 //- Find deepest node (as parent+octant) containing point. Starts
719 // off from starting index in nodes_ (use 0 to start from top)
720 // Use getNode and getOctant to extract info, or call findIndices.
721 labelBits findNode(const label nodeI, const point&) const;
723 //- Find shape containing point. Only implemented for certain
724 // shapes.
725 label findInside(const point&) const;
726
727 //- Find the shape indices that occupy the result of findNode
728 const labelList& findIndices(const point&) const;
729
730 //- Determine type (inside/outside/mixed) for point. unknown if
731 // cannot be determined (e.g. non-manifold surface)
732 volumeType getVolumeType(const point&) const;
733
734 //- Helper function to return the side. Returns outside if
735 // outsideNormal&vec >= 0, inside otherwise
736 static volumeType getSide
737 (
738 const vector& outsideNormal,
739 const vector& vec
740 );
741
742 //- Find near pairs and apply CompareOp to them.
743 // tree2 can be *this or different tree.
744 template<class CompareOp>
745 void findNear
746 (
747 const scalar nearDist,
748 const indexedOctree<Type>& tree2,
749 CompareOp& cop
750 ) const;
751
752
753 // Write
754
755 //- Write (non-empty) tree boxes in OBJ format
756 void writeOBJ(Ostream& os) const;
757
758 //- Print tree. Either print all indices (printContent = true) or
759 // just size of contents nodes.
760 void print
761 (
763 const bool printContents,
764 const label
765 ) const;
766
767 bool write(Ostream& os) const;
768
769
770 // IOstream Operators
771
772 friend Ostream& operator<< <Type>(Ostream&, const indexedOctree<Type>&);
773};
774
775
776// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
777
778} // End namespace Foam
779
780// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
781
782#ifdef NoRepository
783 #include "indexedOctree.C"
784#endif
786// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
787
788#endif
789
790// ************************************************************************* //
label n
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition DynamicList.H:68
A 1D vector of objects of type <T> with a fixed length <N>.
Definition FixedList.H:73
Minimal example by using system/controlDict.functions:
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
A dynamic list of packed unsigned integers, with the number of bits per item specified by the <Width>...
Definition PackedList.H:146
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
Tree node. Has up pointer and down pointers.
static constexpr direction nChildren
Has exactly 8 sub-nodes (octants).
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 flat list addressing for 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)
static labelBits contentPlusOctant(label i, direction octant)
From index into contents_ to subNodes_ entry.
static label getNode(const labelBits i)
Return real (dereferenced) index for a parent node.
static bool isNode(labelBits i) noexcept
A parent node.
static scalar perturbTol(scalar tol) noexcept
Set the perturbation tolerance, return the old value.
indexedOctreeBase()=default
Default construct.
ClassName("indexedOctree")
Runtime type information.
static labelBits nodePlusOctant(label i, direction octant)
From index into nodes_ to subNodes_ entry.
static scalar & perturbTol() noexcept
Get the perturbation tolerance.
static direction getOctant(labelBits i) noexcept
Return sub-node direction/octant.
static labelBits emptyPlusOctant(direction octant)
From empty to subNodes_ entry.
static void writeOBJ(Ostream &os, const treeBoundBox &bb, label &vertIndex, const bool writeLinesOnly=false)
Write treeBoundBox in OBJ format.
static bool isContent(labelBits i) noexcept
Node with content (leaf).
static scalar perturbTol_
Relative perturbation tolerance.
static bool isEmpty(labelBits i) noexcept
An empty node - no content.
static label getContent(labelBits i)
Return real (dereferenced) index for a content node.
Non-pointer based hierarchical recursive searching.
labelList findSphere(const point &centre, const scalar radiusSqr) const
Find indices of all shapes inside or overlapping a bounding sphere (i.e. all shapes not outside a sph...
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.
void writeOBJ(Ostream &os) const
Write (non-empty) tree boxes in OBJ format.
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.
pointIndexHit findNearest(const point &sample, const scalar nearestDistSqr, const FindNearestOp &fnOp) const
Calculate nearest point on nearest shape.
const treeDataIndirectTriSurface & shapes() const noexcept
pointIndexHit findNearest(const point &sample, const scalar nearestDistSqr) const
volumeType getVolumeType(const point &) const
Determine type (inside/outside/mixed) for point. unknown if.
labelList findBox(const treeBoundBox &bb) const
Find indices of all shapes inside or overlapping a bounding box (i.e. all shapes not outside box).
void findNear(const scalar nearDist, const indexedOctree< Type > &tree2, CompareOp &cop) const
Find near pairs and apply CompareOp to them.
const treeBoundBox & bb() const
Top bounding box.
bool overlaps(const treeBoundBox &bb) const
True if any shapes overlap the bounding box.
indexedOctree(const Type &shapes, const List< node > &nodes, const List< labelList > &contents)
Construct from components.
pointIndexHit findNearest(const linePointRef &ln, treeBoundBox &tightest, point &linePoint, const FindNearestOp &fnOp) const
indexedOctree(const Type &shapes, const treeBoundBox &bb, const label maxLevels, const scalar maxLeafRatio, const scalar maxDuplicity)
Construct from shapes.
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.
bool write(Ostream &os) const
label findSphere(const point &centre, const scalar radiusSqr, labelHashSet &elements) const
Find indices of all shapes inside or overlapping a bounding sphere (i.e. all shapes not outside spher...
const List< labelList > & contents() const noexcept
List of all contents (referenced by those nodes that are contents).
pointIndexHit findLine(const point &start, const point &end) const
Find nearest intersection of line between start and end.
autoPtr< indexedOctree< Type > > clone() const
Clone.
bool overlaps(const point &centre, const scalar radiusSqr) const
True if any shapes overlap the bounding sphere.
void findNearest(const label nodeI, const point &, scalar &nearestDistSqr, label &nearestShapeI, point &nearestPoint, const FindNearestOp &fnOp) const
Low level: calculate nearest starting from subnode.
indexedOctree(const Type &shapes, Istream &is)
Construct from Istream.
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.
PackedList< 2 > & nodeTypes() const noexcept
Per node, per octant whether is fully inside/outside/mixed.
label findBox(const treeBoundBox &bb, labelHashSet &elements) const
Find indices of all shapes inside or overlapping a bounding box (i.e. all shapes not outside box).
pointIndexHit findNearest(const linePointRef &ln, treeBoundBox &tightest, point &linePoint) const
Find nearest to line.
label nLeafs() const
Return the number of leaf nodes.
pointIndexHit findLineAny(const point &start, const point &end) const
Find any intersection of line between start and end.
A 29bits (or 61bits) integer label with 3bits direction (eg, octant) packed into single label.
Definition labelBits.H:49
label val() const noexcept
Return the integer value.
Definition labelBits.H:137
Version of OSstream that prints a prefix on each line.
@ SPACE
Space [isspace].
Definition token.H:144
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.
Definition volumeType.H:56
A class for handling words, derived from Foam::string.
Definition word.H:66
#define ClassName(TypeNameString)
Add typeName information from argument TypeNameString to a class.
Definition className.H:74
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition error.H:600
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
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.
Definition List.H:62
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
Definition HashSet.H:85
label facePoint(const int facei, const block &block, const label i, const label j)
void divide(DimensionedField< Type, GeoMesh > &result, const DimensionedField< Type, GeoMesh > &f1, const DimensionedField< scalar, GeoMesh > &f2)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
line< point, const point & > linePointRef
A line using referred points.
Definition line.H:66
errorManip< error > abort(error &err)
Definition errorManip.H:139
uint8_t direction
Definition direction.H:49
vector point
Point is a vector.
Definition point.H:37
const direction noexcept
Definition scalarImpl.H:265
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
Vector< scalar > vector
Definition vector.H:57
PointIndexHit< point > pointIndexHit
A PointIndexHit with a 3D point.
UList< label > labelUList
A UList of labels.
Definition UList.H:75
bool ln(const fileName &src, const fileName &dst)
Create a softlink. dst should not exist. Returns true if successful.
Definition POSIX.C:1239
runTime write()
volScalarField & b