OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

treeBoundBox Class Reference

Standard boundBox + extra functionality for use in octree. More...

Inheritance diagram for treeBoundBox:
Collaboration diagram for treeBoundBox:

List of all members.


Public Types

enum  octantBit { RIGHTHALF = 0x1 << 0, TOPHALF = 0x1 << 1, FRONTHALF = 0x1 << 2 }
 Bits used for octant/point coding. More...
enum  faceId {
  LEFT = 0, RIGHT = 1, BOTTOM = 2, TOP = 3,
  BACK = 4, FRONT = 5
}
 Face codes. More...
enum  faceBit {
  NOFACE = 0, LEFTBIT = 0x1 << LEFT, RIGHTBIT = 0x1 << RIGHT, BOTTOMBIT = 0x1 << BOTTOM,
  TOPBIT = 0x1 << TOP, BACKBIT = 0x1 << BACK, FRONTBIT = 0x1 << FRONT
}
 Bits used for face coding. More...
enum  edgeId {
  E01 = 0, E13 = 1, E23 = 2, E02 = 3,
  E45 = 4, E57 = 5, E67 = 6, E46 = 7,
  E04 = 8, E15 = 9, E37 = 10, E26 = 11
}
 Edges codes. More...

Public Member Functions

 treeBoundBox ()
 Construct null setting points to zero.
 treeBoundBox (const point &min, const point &max)
 Construct from components.
 treeBoundBox (const boundBox &bb)
 Construct from components.
 treeBoundBox (const UList< point > &)
 Construct as the bounding box of the given pointField.
 treeBoundBox (const UList< point > &, const UList< label > &meshPoints)
 Construct as subset of points.
 treeBoundBox (Istream &)
 Construct from Istream.
scalar typDim () const
 Typical dimension length,height,width.
pointField points () const
 vertex coordinates. In octant coding.
point corner (const direction) const
 Corner point given octant.
treeBoundBox subBbox (const direction) const
 Sub box given by octant number. Midpoint calculated.
treeBoundBox subBbox (const point &mid, const direction) const
 Sub box given by octant number. Midpoint provided.
direction subOctant (const point &pt) const
 Returns octant number given point and the calculated midpoint.
direction subOctant (const point &pt, bool &onEdge) const
 Returns octant number given point and the calculated midpoint.
void searchOrder (const point &pt, FixedList< direction, 8 > &octantOrder) const
 Calculates optimal order to look for nearest to point.
bool overlaps (const treeBoundBox &) const
 Overlaps other boundingbox?
bool overlaps (const point &, const scalar radiusSqr) const
 Overlaps boundingSphere (centre + sqr(radius))?
bool intersects (const point &overallStart, const vector &overallVec, const point &start, const point &end, point &pt, direction &ptBits) const
 Intersects segment; set point to intersection position and face,.
bool intersects (const point &start, const point &end, point &pt) const
 Like above but does not return faces point is on.
bool contains (const treeBoundBox &) const
 fully contains other boundingBox?
bool contains (const point &) const
 Contains point? (inside or on edge).
bool contains (const vector &dir, const point &) const
 Contains point (inside or on edge) and moving in direction.
direction faceBits (const point &pt) const
 Code position of pt on bounding box faces.
direction posBits (const point &) const
 Position of point relative to bounding box.
void calcExtremities (const point &pt, point &nearest, point &furthest) const
 Calculate nearest and furthest (to point) vertex coords of.
scalar maxDist (const point &) const
 Returns distance point to furthest away corner.
label distanceCmp (const point &, const treeBoundBox &other) const
 Compare distance to point with other bounding box.
treeBoundBox extend (Random &, const scalar s) const
 Return slightly wider bounding box.

Static Public Member Functions

static direction neighbourFaceBits (const label &)
 Face on which neighbour is.
static direction subOctant (const point &mid, const point &pt)
 Returns octant number given point and midpoint.
static direction subOctant (const point &mid, const point &pt, bool &onEdge)
 Returns octant number given point and midpoint.
static direction subOctant (const point &mid, const vector &dir, const point &pt, bool &onEdge)
 Returns octant number given intersection and midpoint.

Static Public Attributes

static const scalar great
 The great value used for greatBox and invertedBox.
static const treeBoundBox greatBox
 As per boundBox::greatBox, but with GREAT instead of VGREAT.
static const treeBoundBox invertedBox
 As per boundBox::invertedBox, but with GREAT instead of VGREAT.
static const faceList faces
 Face to point addressing.
static const edgeList edges
 Edge to point addressing.
static const FixedList< vector, 6 > faceNormals
 Per face the unit normal.

Friends

bool operator== (const treeBoundBox &, const treeBoundBox &)
bool operator!= (const treeBoundBox &, const treeBoundBox &)
Istream & operator>> (Istream &is, treeBoundBox &)
Ostream & operator<< (Ostream &os, const treeBoundBox &)

Detailed Description

Standard boundBox + extra functionality for use in octree.

Numbering of corner points is according to octant numbering.

On the back plane (z=0):

    Y
    ^
    |
    +--------+
    |2      3|
    |        |
    |        |
    |        |
    |0      1|
    +--------+->X

For the front plane add 4 to the point labels.

Source files

Definition at line 70 of file treeBoundBox.H.


Member Enumeration Documentation

enum octantBit

Bits used for octant/point coding.

Every octant/corner point is the combination of three faces.

Enumerator:
RIGHTHALF 
TOPHALF 
FRONTHALF 

Definition at line 97 of file treeBoundBox.H.

enum faceId

Face codes.

Enumerator:
LEFT 
RIGHT 
BOTTOM 
TOP 
BACK 
FRONT 

Definition at line 105 of file treeBoundBox.H.

enum faceBit

Bits used for face coding.

Enumerator:
NOFACE 
LEFTBIT 
RIGHTBIT 
BOTTOMBIT 
TOPBIT 
BACKBIT 
FRONTBIT 

Definition at line 116 of file treeBoundBox.H.

enum edgeId

Edges codes.

E01 = edge between 0 and 1.

Enumerator:
E01 
E13 
E23 
E02 
E45 
E57 
E67 
E46 
E04 
E15 
E37 
E26 

Definition at line 131 of file treeBoundBox.H.


Constructor & Destructor Documentation

treeBoundBox (  )  [inline]

Construct null setting points to zero.

Definition at line 23 of file treeBoundBoxI.H.

treeBoundBox ( const point &  min,
const point &  max 
) [inline]

Construct from components.

Definition at line 29 of file treeBoundBoxI.H.

treeBoundBox ( const boundBox &  bb  )  [inline]

Construct from components.

Definition at line 35 of file treeBoundBoxI.H.

treeBoundBox ( const UList< point > &  points  ) 

Construct as the bounding box of the given pointField.

Local processor domain only (no reduce as in boundBox)

Definition at line 107 of file treeBoundBox.C.

treeBoundBox ( const UList< point > &  points,
const UList< label > &  meshPoints 
)

Construct as subset of points.

Local processor domain only (no reduce as in boundBox)

Definition at line 135 of file treeBoundBox.C.

References boundBox::max(), Foam::max(), boundBox::min(), and Foam::min().

Here is the call graph for this function:

treeBoundBox ( Istream &  is  ) 

Construct from Istream.

Definition at line 166 of file treeBoundBox.C.

References boundBox::max(), Foam::max(), boundBox::min(), and Foam::min().

Here is the call graph for this function:


Member Function Documentation

static direction neighbourFaceBits ( const label &   )  [static]

Face on which neighbour is.

Foam::scalar typDim (  )  const [inline]

Typical dimension length,height,width.

Definition at line 43 of file treeBoundBoxI.H.

Foam::pointField points (  )  const

vertex coordinates. In octant coding.

Definition at line 174 of file treeBoundBox.C.

Foam::point corner ( const direction  octant  )  const [inline]

Corner point given octant.

Definition at line 49 of file treeBoundBoxI.H.

References boundBox::avgDim().

Referenced by treeBoundBox::subBbox().

Here is the call graph for this function:

Here is the caller graph for this function:

Foam::treeBoundBox subBbox ( const direction  octant  )  const

Sub box given by octant number. Midpoint calculated.

Definition at line 186 of file treeBoundBox.C.

References treeBoundBox::corner().

Referenced by treeBoundBox::subBbox().

Here is the call graph for this function:

Here is the caller graph for this function:

Foam::treeBoundBox subBbox ( const point &  mid,
const direction  octant 
) const

Sub box given by octant number. Midpoint provided.

Definition at line 194 of file treeBoundBox.C.

References boundBox::midpoint(), and treeBoundBox::subBbox().

Here is the call graph for this function:

Foam::direction subOctant ( const point &  pt  )  const [inline]

Returns octant number given point and the calculated midpoint.

Definition at line 61 of file treeBoundBoxI.H.

Referenced by treeBoundBox::subOctant().

Here is the caller graph for this function:

Foam::direction subOctant ( const point &  mid,
const point &  pt 
) [inline, static]

Returns octant number given point and midpoint.

Definition at line 70 of file treeBoundBoxI.H.

References boundBox::midpoint(), and treeBoundBox::subOctant().

Here is the call graph for this function:

Foam::direction subOctant ( const point &  pt,
bool &  onEdge 
) const [inline]

Returns octant number given point and the calculated midpoint.

onEdge set if the point is on edge of subOctant

Definition at line 99 of file treeBoundBoxI.H.

Foam::direction subOctant ( const point &  mid,
const point &  pt,
bool &  onEdge 
) [inline, static]

Returns octant number given point and midpoint.

onEdge set if the point is on edge of subOctant

Definition at line 111 of file treeBoundBoxI.H.

References boundBox::midpoint(), and treeBoundBox::subOctant().

Here is the call graph for this function:

Foam::direction subOctant ( const point &  mid,
const vector &  dir,
const point &  pt,
bool &  onEdge 
) [inline, static]

Returns octant number given intersection and midpoint.

onEdge set if the point is on edge of subOctant If onEdge, the direction vector determines which octant to use (acc. to which octant the point would be if it were moved along dir)

Definition at line 156 of file treeBoundBoxI.H.

void searchOrder ( const point &  pt,
FixedList< direction, 8 > &  octantOrder 
) const [inline]

Calculates optimal order to look for nearest to point.

First will be the octant containing the point, second the octant with boundary nearest to the point etc.

Definition at line 212 of file treeBoundBoxI.H.

Referenced by indexedOctree< Type >::findNearest().

Here is the caller graph for this function:

bool overlaps ( const treeBoundBox &  bb  )  const [inline]

Overlaps other boundingbox?

Definition at line 303 of file treeBoundBoxI.H.

Referenced by treeBoundBox::contains(), octreeDataEdges::contains(), octreeDataCell::contains(), octreeDataFaceList::contains(), and treeLeaf< Type >::findNearest().

Here is the caller graph for this function:

bool overlaps ( const point &  centre,
const scalar  radiusSqr 
) const

Overlaps boundingSphere (centre + sqr(radius))?

Definition at line 245 of file treeBoundBox.C.

bool intersects ( const point &  overallStart,
const vector &  overallVec,
const point &  start,
const point &  end,
point &  pt,
direction &  ptBits 
) const

Intersects segment; set point to intersection position and face,.

return true if intersection found. (pt argument used during calculation even if not intersecting). Calculates intersections from outside supplied vector (overallStart, overallVec). This is so when e.g. tracking through lots of consecutive boxes (typical octree) we're not accumulating truncation errors. Set to start, (end-start) if not used.

Definition at line 302 of file treeBoundBox.C.

References treeBoundBox::BACKBIT, treeBoundBox::BOTTOMBIT, treeBoundBox::faceBits(), treeBoundBox::FRONTBIT, treeBoundBox::LEFTBIT, Foam::mag(), boundBox::max(), boundBox::min(), treeBoundBox::posBits(), treeBoundBox::RIGHTBIT, and treeBoundBox::TOPBIT.

Referenced by treeBoundBox::contains().

Here is the call graph for this function:

Here is the caller graph for this function:

bool intersects ( const point &  start,
const point &  end,
point &  pt 
) const

Like above but does not return faces point is on.

Definition at line 429 of file treeBoundBox.C.

References boundBox::max().

Here is the call graph for this function:

bool contains ( const treeBoundBox &  bb  )  const [inline]

fully contains other boundingBox?

Definition at line 441 of file treeBoundBox.C.

References treeBoundBox::intersects().

Referenced by treeBoundBox::contains(), octreeDataPoint::contains(), treeBoundBox::extend(), and treeDataPoint::findNearest().

Here is the call graph for this function:

Here is the caller graph for this function:

bool contains ( const point &  pt  )  const [inline]

Contains point? (inside or on edge).

Reimplemented from boundBox.

Definition at line 309 of file treeBoundBoxI.H.

References treeBoundBox::overlaps().

Here is the call graph for this function:

bool contains ( const vector &  dir,
const point &  pt 
) const

Contains point (inside or on edge) and moving in direction.

dir would cause it to go inside.

Definition at line 447 of file treeBoundBox.C.

References treeBoundBox::contains(), boundBox::max(), and boundBox::min().

Here is the call graph for this function:

Foam::direction faceBits ( const point &  pt  )  const

Code position of pt on bounding box faces.

Definition at line 487 of file treeBoundBox.C.

Referenced by treeBoundBox::intersects().

Here is the caller graph for this function:

Foam::direction posBits ( const point &  pt  )  const

Position of point relative to bounding box.

Definition at line 521 of file treeBoundBox.C.

References treeBoundBox::FRONTBIT.

Referenced by treeBoundBox::intersects().

Here is the caller graph for this function:

void calcExtremities ( const point &  pt,
point &  nearest,
point &  furthest 
) const

Calculate nearest and furthest (to point) vertex coords of.

bounding box

Definition at line 558 of file treeBoundBox.C.

Foam::scalar maxDist ( const point &  pt  )  const

Returns distance point to furthest away corner.

Definition at line 605 of file treeBoundBox.C.

Foam::label distanceCmp ( const point &  pt,
const treeBoundBox &  other 
) const

Compare distance to point with other bounding box.

return: -1 : all vertices of my bounding box are nearer than any of other +1 : all vertices of my bounding box are further away than any of other 0 : none of the above.

Definition at line 618 of file treeBoundBox.C.

Foam::treeBoundBox extend ( Random &  rndGen,
const scalar  s 
) const [inline]

Return slightly wider bounding box.

Extends all dimensions with s*span*Randomscalar01() and guarantees in any direction s*mag(span) minimum width

Definition at line 317 of file treeBoundBoxI.H.

References treeBoundBox::contains().

Here is the call graph for this function:


Friends And Related Function Documentation

bool operator== ( const treeBoundBox &  ,
const treeBoundBox &   
) [friend]

bool operator!= ( const treeBoundBox &  ,
const treeBoundBox &   
) [friend]

Istream& operator>> ( Istream &  is,
treeBoundBox &   
) [friend]

Ostream& operator<< ( Ostream &  os,
const treeBoundBox &   
) [friend]


Member Data Documentation

const Foam::scalar great [static]

The great value used for greatBox and invertedBox.

Reimplemented from boundBox.

Definition at line 85 of file treeBoundBox.H.

const Foam::treeBoundBox greatBox [static]

As per boundBox::greatBox, but with GREAT instead of VGREAT.

Reimplemented from boundBox.

Definition at line 88 of file treeBoundBox.H.

As per boundBox::invertedBox, but with GREAT instead of VGREAT.

Reimplemented from boundBox.

Definition at line 91 of file treeBoundBox.H.

const Foam::faceList faces [static]

Face to point addressing.

Definition at line 150 of file treeBoundBox.H.

const Foam::edgeList edges [static]

Edge to point addressing.

Definition at line 153 of file treeBoundBox.H.

Per face the unit normal.

Definition at line 156 of file treeBoundBox.H.


The documentation for this class was generated from the following files:
Copyright © 2000-2009 OpenCFD Ltd