FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

indexedOctree< Type > Class Template Reference

Non-pointer based hierarchical recursive searching. More...

#include <meshTools/indexedOctree.H>


Detailed Description

template<class Type>
class Foam::indexedOctree< Type >

Non-pointer based hierarchical recursive searching.

Source files

Definition at line 69 of file indexedOctree.H.

Inheritance diagram for indexedOctree< Type >:
Collaboration diagram for indexedOctree< Type >:

List of all members.

Classes

class  node

Public Types

enum  volumeType { UNKNOWN = 0, MIXED = 1, INSIDE = 2, OUTSIDE = 3 }
 

volume types

More...

Public Member Functions

 indexedOctree (const Type &shapes)
 Construct null.
 indexedOctree (const Type &shapes, const List< node > &nodes, const labelListList &contents)
 Construct from components.
 indexedOctree (const Type &shapes, const treeBoundBox &bb, const label maxLevels, const scalar maxLeafRatio, const scalar maxDuplicity)
 Construct from shapes.
 indexedOctree (const Type &shapes, Istream &is)
 Construct from Istream.
autoPtr< indexedOctree< Type > >  clone () const
 Clone.
const Type &  shapes () const
 Reference to shape.
const List< node > &  nodes () const
 List of all nodes.
const labelListList &  contents () const
 List of all contents (referenced by those nodes that are.
const treeBoundBox &  bb () const
 Top bounding box.
pointIndexHit  findNearest (const point &sample, const scalar nearestDistSqr) const
 Calculate nearest point on nearest shape. Returns.
void  findNearest (const label nodeI, const point &, scalar &nearestDistSqr, label &nearestShapeI, point &nearestPoint) const
 Low level: calculate nearest starting from subnode.
pointIndexHit  findNearest (const linePointRef &ln, treeBoundBox &tightest, point &linePoint) const
 Find nearest to line. Returns.
pointIndexHit  findLine (const point &start, const point &end) const
 Find nearest intersection of line between start and end.
pointIndexHit  findLineAny (const point &start, const point &end) const
 Find any intersection of line between start and end.
labelList  findBox (const treeBoundBox &bb) const
 Find (in no particular order) indices of all shapes inside or.
labelBits  findNode (const label nodeI, const point &) const
 Find deepest node (as parent+octant) containing point. Starts.
volumeType  getVolumeType (const point &) const
 Determine type (inside/outside/mixed) for point. unknown if.
void  print (prefixOSstream &, const bool printContents, const label) const
 Print tree. Either print all indices (printContent = true) or.
bool  write (Ostream &os) const

Static Public Member Functions

static scalar &  perturbTol ()
 Get the perturbation tolerance.
static bool  isContent (const labelBits i)
static bool  isEmpty (const labelBits i)
static bool  isNode (const labelBits i)
static label  getContent (const labelBits i)
static label  getNode (const labelBits i)
static direction  getOctant (const labelBits i)
static volumeType  getSide (const vector &outsideNormal, const vector &vec)
 Helper function to return the side. Returns outside if.
static bool  overlaps (const point &bbMin, const point &bbMax, const scalar nearestDistSqr, const point &sample)
 Helper: does bb intersect a sphere around sample? Or is any.

Friends

Ostream &  operator (Ostream &, const indexedOctree< Type > &)

Member Enumeration Documentation

enum volumeType

volume types

Enumerator:
UNKNOWN 
MIXED 
INSIDE 
OUTSIDE 

Definition at line 78 of file indexedOctree.H.


Constructor & Destructor Documentation

indexedOctree ( const Type &   shapes  )

Construct null.

Definition at line 2144 of file indexedOctree.C.

indexedOctree ( const Type &   shapes,
const List< node > &   nodes,
const labelListList &   contents  
)

Construct from components.

Definition at line 2155 of file indexedOctree.C.

indexedOctree ( const Type &   shapes,
const treeBoundBox &   bb,
const label   maxLevels,
const scalar   maxLeafRatio,
const scalar   maxDuplicity  
)
indexedOctree ( const Type &   shapes,
Istream &   is  
)

Construct from Istream.

Definition at line 2322 of file indexedOctree.C.


Member Function Documentation

autoPtr<indexedOctree<Type> > clone (  ) const [inline]

Clone.

Definition at line 411 of file indexedOctree.H.

const Type& shapes (  ) const [inline]

Reference to shape.

Definition at line 424 of file indexedOctree.H.

Referenced by patchProbes::findElements(), and meshSearch::findNearestBoundaryFace().

const List<node>& nodes (  ) const [inline]

List of all nodes.

Definition at line 430 of file indexedOctree.H.

const labelListList& contents (  ) const [inline]

List of all contents (referenced by those nodes that are.

contents)

Definition at line 437 of file indexedOctree.H.

const treeBoundBox& bb (  ) const [inline]
static bool isContent ( const labelBits   i  ) [inline, static]

Definition at line 456 of file indexedOctree.H.

Referenced by indexedOctree< treeDataTriSurface >::getContent().

static bool isEmpty ( const labelBits   i  ) [inline, static]

Definition at line 461 of file indexedOctree.H.

static bool isNode ( const labelBits   i  ) [inline, static]

Definition at line 466 of file indexedOctree.H.

Referenced by indexedOctree< treeDataTriSurface >::getNode().

static label getContent ( const labelBits   i  ) [inline, static]

Definition at line 471 of file indexedOctree.H.

static label getNode ( const labelBits   i  ) [inline, static]

Definition at line 481 of file indexedOctree.H.

static direction getOctant ( const labelBits   i  ) [inline, static]

Definition at line 491 of file indexedOctree.H.

Foam::pointIndexHit findNearest ( const point &   sample,
const scalar   nearestDistSqr  
) const

Calculate nearest point on nearest shape. Returns.

  • bool : any point found nearer than nearestDistSqr

label: index in shapes

  • point: actual nearest point found

Definition at line 2345 of file indexedOctree.C.

References Vector< Cmpt >::zero.

void findNearest ( const label   nodeI,
const point &   sample,
scalar &   nearestDistSqr,
label &   nearestShapeI,
point &   nearestPoint  
) const

Low level: calculate nearest starting from subnode.

Definition at line 546 of file indexedOctree.C.

References indexedOctree< Type >::node::bb_, boundBox::max(), boundBox::min(), treeBoundBox::searchOrder(), and indexedOctree< Type >::node::subNodes_.

Foam::pointIndexHit findNearest ( const linePointRef &   ln,
treeBoundBox &   tightest,
point &   linePoint  
) const

Find nearest to line. Returns.

  • bool : any point found?

label: index in shapes

  • point: actual nearest point found sets:
  • linePoint : corresponding nearest point on line

Definition at line 2377 of file indexedOctree.C.

References Vector< Cmpt >::zero.

Foam::pointIndexHit findLine ( const point &   start,
const point &   end  
) const

Find nearest intersection of line between start and end.

Definition at line 2411 of file indexedOctree.C.

Foam::pointIndexHit findLineAny ( const point &   start,
const point &   end  
) const

Find any intersection of line between start and end.

Definition at line 2423 of file indexedOctree.C.

Referenced by triSurfaceMesh::findLineAny().

Foam::labelList findBox ( const treeBoundBox &   bb  ) const

Find (in no particular order) indices of all shapes inside or.

overlapping bounding box (i.e. all shapes not outside box)

Definition at line 2434 of file indexedOctree.C.

Foam::labelBits findNode ( const label   nodeI,
const point &   sample  
) const

Find deepest node (as parent+octant) containing point. Starts.

off from starting index in nodes_ (use 0 to start from top) Use getNode, getOctant to extract info.

Definition at line 2453 of file indexedOctree.C.

References Foam::abort(), indexedOctree< Type >::node::bb_, treeBoundBox::contains(), Foam::FatalError, FatalErrorIn, indexedOctree< Type >::node::subNodes_, and treeBoundBox::subOctant().

Foam::indexedOctree< Type >::volumeType getVolumeType ( const point &   sample  ) const

Determine type (inside/outside/mixed) for point. unknown if.

cannot be determined (e.g. non-manifold surface)

Definition at line 2502 of file indexedOctree.C.

References Foam::abort(), Foam::endl(), Foam::FatalError, FatalErrorIn, forAll, Foam::Pout, and Foam::type().

Foam::indexedOctree< Type >::volumeType getSide ( const vector &   outsideNormal,
const vector &   vec  
) [static]

Helper function to return the side. Returns outside if.

outsideNormal&vec >= 0, inside otherwise

Definition at line 522 of file indexedOctree.C.

Referenced by treeDataFace::getVolumeType().

bool overlaps ( const point &   bbMin,
const point &   bbMax,
const scalar   nearestDistSqr,
const point &   sample  
) [static]

Helper: does bb intersect a sphere around sample? Or is any.

corner point of bb closer than nearestDistSqr to sample.

Definition at line 43 of file indexedOctree.C.

References Foam::mag().

void print ( prefixOSstream &   os,
const bool   printContents,
const label   nodeI  
) const
bool write ( Ostream &   os  ) const

Definition at line 2635 of file indexedOctree.C.

References IOstream::good().


Friends And Related Function Documentation

Ostream& operator ( Ostream &   ,
const indexedOctree< Type > &    
) [friend]

The documentation for this class was generated from the following files: