octree< Type > Class Template Reference
Octree, templated on type of shapes it refers to.
More...
List of all members.
|
Classes |
| class | const_iterator |
| | An STL const_iterator for octree. More...
|
| class | iterator |
| | An STL iterator for octree. More...
|
Public Types |
| enum | volumeType { UNKNOWN,
MIXED,
INSIDE,
OUTSIDE
} |
| | volume types More...
|
Public Member Functions |
| | octree (const treeBoundBox &octreeBb, const Type &shapes, const label minNLevels, const scalar maxLeafRatio, const scalar maxShapeRatio) |
| | Construct from components.
|
| | ~octree () |
| const Type & | shapes () const |
| const treeBoundBox & | octreeBb () const |
| scalar | maxShapeRatio () const |
| scalar | maxLeafRatio () const |
| label | minNLevels () const |
| treeNode< Type > * | topNode () const |
| label | deepestLevel () const |
| label | nEntries () const |
| label | nNodes () const |
| label | nLeaves () const |
| void | setEntries (const label n) |
| void | setNodes (const label n) |
| void | setLeaves (const label n) |
| label | getSampleType (const point &sample) const |
| | Returns type of sample with respect to nearest shape.
|
| label | find (const point &sample) const |
| | Find shape containing point in tree.
|
| bool | findTightest (const point &sample, treeBoundBox &tightest) const |
| | Calculate tightest fitting bounding box. Uses.
|
| label | findNearest (const point &sample, treeBoundBox &tightest, scalar &tightestDist) const |
| | Find nearest shape. Returns index of shape or -1 if not found.
|
| label | findNearest (const linePointRef &ln, treeBoundBox &tightest, point &linePoint, point &shapePoint) const |
| | Find nearest to line. Returns -1 or index of shape and.
|
| labelList | findBox (const boundBox &bb) const |
| | Find (in no particular order) indices of all shapes inside or.
|
| pointIndexHit | findLine (const point &start, const point &end) const |
| | Find intersected shape along line. pointIndexHit contains index.
|
| pointIndexHit | findLineAny (const point &start, const point &end) const |
| | Like above but just tests whether line hits anything. So.
|
| const treeLeaf< Type > * | findLeafLine (const point &start, const point &end, point &leafIntPoint) const |
| | Find leaf along line. Set leafIntPoint to leave point of.
|
| void | writeOBJ (Ostream &os, label &vertNo) const |
| | Dump graphical representation in .obj format.
|
| void | printStats (Ostream &os) const |
| | Print some stats on octree.
|
| iterator | begin () |
| | iterator set to the begining of the octree
|
| const iterator & | end () |
| | iterator set to beyond the end of the octree
|
| const_iterator | begin () const |
| | const_iterator set to the begining of the octree
|
| const_iterator | cbegin () const |
| const const_iterator & | end () const |
| | const_iterator set to beyond the end of the octree
|
| const const_iterator & | cend () const |
Static Public Member Functions |
| static string | volType (const label) |
| | for debugging:return printable representation of volumeType
|
| static label | getVolType (const vector &geomNormal, const vector &vec) |
| | Code the vector with respect to the geometry. geomNormal guaranteed.
|
Friends |
| class | iterator |
| class | const_iterator |
| Ostream & | operator (Ostream &, const octree< Type > &) |
Detailed Description
template<class Type>
class Foam::octree< Type >
Octree, templated on type of shapes it refers to.
Uses the octreeData class, which is a list of 1D, 2D or 3D shapes. Various implementations of octreeData which know about cell&meshes, patches&meshes and points.
The octree can be used to
- find the "nearest" shape to a point
- find the shape which contains a point (only sensible for 3D shapes)
- find intersections of line with shapes
The tree consists of
The data is stored purely as a list of indices into octreeData.
The construction on the depth of the tree is:
- one can specify a minimum depth (though the tree will never be refined if all leaves contain <=1 shapes)
- after the minimum depth two statistics are used to decide further refinement:
- average number of entries per leaf (leafRatio). Since inside a leaf most algorithms are n or n^2 this value has to be small.
- average number of leaves a shape is in. Because of bounding boxes, a single shape can be in multiple leaves. If the bbs are large compared to the leaf size this multiplicity can become extremely large and will become larger with more levels.
Note: the octree gets constructed with an overall bounding box. If your mesh is regular it is a good idea to make this overall bb a bit wider than the bb of the shapes itself. Otherwise lots of shapes end up exactly on the edge of a bb and hence go into more than one subcube.
E.g. octree of face centres of lid driven cavity.
- bb exact -> total 1457 leaves (every point in 7.1 leaves)
- bb.max incremented by 1% -> total 80 leaves (every point in exactly 1 leaf)
- Ideas for parallel implementation:
The data inserted into the
octree (the 'octreeData') has to be local to the processor. The data to be looked for (usually a sample
point) can be global to the domain. The algorithm:
- search for all my points
- collect results which have to do with a processor patch
- global sum all these. If 0 exit.
- exchange data on all processor patches
- start again
So data transfers one processor per iteration. One could think of having an extra search mechanism one level above which does an initial search knowing the average shape of a processor distribution (square/cube for most decomposition methods) and can assign sample points to the (almost) correct processor at once.
- Source files
-
Definition at line 122 of file octree.H.
Member Enumeration Documentation
volume types
- Enumerator:
-
| UNKNOWN |
|
| MIXED |
|
| INSIDE |
|
| OUTSIDE |
|
Definition at line 181 of file octree.H.
Constructor & Destructor Documentation
Construct from components.
Definition at line 85 of file octree.C.
Member Function Documentation
Code the vector with respect to the geometry. geomNormal guaranteed.
to point outside.
Definition at line 63 of file octree.C.
| const Type& shapes |
( |
|
) |
const [inline] |
| scalar maxShapeRatio |
( |
|
) |
const [inline] |
| scalar maxLeafRatio |
( |
|
) |
const [inline] |
| label minNLevels |
( |
|
) |
const [inline] |
| label deepestLevel |
( |
|
) |
const [inline] |
| label nEntries |
( |
|
) |
const [inline] |
| label nNodes |
( |
|
) |
const [inline] |
| label nLeaves |
( |
|
) |
const [inline] |
| void setEntries |
( |
const label |
n |
) |
[inline] |
| void setNodes |
( |
const label |
n |
) |
[inline] |
| void setLeaves |
( |
const label |
n |
) |
[inline] |
Returns type of sample with respect to nearest shape.
Meaning of type is determined by shapes.getSampleType(). Normally based on outwards pointing normal. For e.g. octreeDataFace returns one of inside : on other side of normal on nearest face outside : on same side as normal on nearest face unknown : not above nearest face; surface probably not closed. mixed : should never happen
Definition at line 235 of file octree.C.
Find shape containing point in tree.
Returns -1 if not in found. Uses Type::contains.
Definition at line 242 of file octree.C.
Calculate tightest fitting bounding box. Uses.
Type::findTightest.
Definition at line 250 of file octree.C.
Find nearest to line. Returns -1 or index of shape and.
sets:
- tightest (is both input and output).
- linePoint : point on line (-GREAT,-GREAT,-GREAT if not found)
- shapePoint : point on shape (GREAT, GREAT, GREAT if not found) Uses Type::calcNearest.
Definition at line 306 of file octree.C.
Find (in no particular order) indices of all shapes inside or.
overlapping bounding box (i.e. all shapes not outside box)
Definition at line 333 of file octree.C.
Like above but just tests whether line hits anything. So.
returns first intersection found, not nessecarily nearest.
Definition at line 427 of file octree.C.
| void writeOBJ |
( |
Ostream & |
os, |
|
|
label & |
vertNo | |
|
) |
| | const [inline] |
Dump graphical representation in .obj format.
Definition at line 560 of file octree.C.
| void printStats |
( |
Ostream & |
os |
) |
const [inline] |
Friends And Related Function Documentation
The documentation for this class was generated from the following files:
Copyright © 2000-2009 OpenCFD Ltd