Version: 8.3.0
SMESH_OctreeNode Class Reference

#include <SMESH_OctreeNode.hxx>

Inheritance diagram for SMESH_OctreeNode:

Data Structures

struct  Limit
 

Public Types

typedef SMESH_Tree< Bnd_B3d, 8 > TBaseTree
 
typedef Bnd_B3d box_type
 

Public Member Functions

 SMESH_OctreeNode (const TIDSortedNodeSet &theNodes, const int maxLevel=8, const int maxNbNodes=5, const double minBoxSize=0.)
 Constructor : Build all the Octree using Compute() More...
 
virtual ~SMESH_OctreeNode ()
 
virtual const bool isInside (const gp_XYZ &p, const double precision=0.)
 Tells us if Node is inside the current box with the precision "precision". More...
 
void NodesAround (const SMDS_MeshNode *node, std::list< const SMDS_MeshNode * > *result, const double precision=0.)
 Return in Result a list of Nodes potentials to be near Node. More...
 
bool NodesAround (const gp_XYZ &point, std::map< double, const SMDS_MeshNode * > &dist2Nodes, double precision)
 Return in dist2Nodes nodes mapped to their square distance from Node Tries to find a closest node. More...
 
void NodesAround (const gp_XYZ &point, std::vector< const SMDS_MeshNode * > &nodes, double precision)
 Return a list of nodes close to a point. More...
 
void FindCoincidentNodes (TIDSortedNodeSet *nodes, const double theTolerance, std::list< std::list< const SMDS_MeshNode * > > *theGroupsOfNodes)
 Return in theGroupsOfNodes a list of group of nodes close to each other within theTolerance Search for all the nodes in theSetOfNodes. More...
 
void UpdateByMoveNode (const SMDS_MeshNode *node, const gp_Pnt &toPnt)
 Update data according to node movement. More...
 
SMESH_OctreeNodeIteratorPtr GetChildrenIterator ()
 Return iterator over children. More...
 
SMDS_NodeIteratorPtr GetNodeIterator ()
 Return nodes iterator. More...
 
int NbNodes () const
 Return nb nodes in a tree. More...
 
double maxSize () const
 Compute the bigger dimension of my box. More...
 
void compute ()
 
bool isLeaf () const
 
int level () const
 
const box_typegetBox () const
 
int getHeight (const bool full=true) const
 

Static Public Member Functions

static void FindCoincidentNodes (TIDSortedNodeSet &nodes, std::list< std::list< const SMDS_MeshNode * > > *theGroupsOfNodes, const double theTolerance=0.00001, const int maxLevel=-1, const int maxNbNodes=5)
 Return in theGroupsOfNodes a list of group of nodes close to each other within theTolerance Search for all the nodes in theSetOfNodes Static Method : no need to create an SMESH_OctreeNode. More...
 
static int getChildIndex (double x, double y, double z, const gp_XYZ &boxMiddle)
 Return index of a child the given point is in. More...
 
static int nbChildren ()
 

Protected Member Functions

int getMaxNbNodes () const
 Return max number of nodes in a tree leaf. More...
 
 SMESH_OctreeNode ()
 Constructor used to allocate a child. More...
 
virtual Bnd_B3d * buildRootBox ()
 Compute the first bounding box. More...
 
virtual void buildChildrenData ()
 Set the data of the children Shares the father's data with each of his child. More...
 
virtual SMESH_OctreenewChild () const
 Construct an empty SMESH_OctreeNode used by SMESH_Octree::buildChildren() More...
 
void FindCoincidentNodes (const SMDS_MeshNode *Node, TIDSortedNodeSet *SetOfNodes, std::list< const SMDS_MeshNode * > *Result, const double precision)
 Return a list of nodes closed to Node and remove it from SetOfNodes. More...
 
virtual Bnd_B3d * newChildBox (int childIndex) const
 Allocate a bndbox according to childIndex. More...
 
virtual void enlargeByFactor (Bnd_B3d *box, double factor) const
 Change size of a box by a factor; each dimension changes independently of others. More...
 
void buildChildren ()
 

Protected Attributes

TIDSortedNodeSet myNodes
 
SMESH_Tree ** myChildren
 
SMESH_TreemyFather
 
bool myIsLeaf
 
const SMESH_TreeLimitmyLimit
 
box_typemyBox
 
int myLevel
 

Member Typedef Documentation

typedef Bnd_B3d SMESH_Tree< Bnd_B3d , NB_CHILDREN >::box_type
inherited
typedef SMESH_Tree< Bnd_B3d, 8> SMESH_Octree::TBaseTree
inherited

Constructor & Destructor Documentation

SMESH_OctreeNode::SMESH_OctreeNode ( const TIDSortedNodeSet theNodes,
const int  maxLevel = 8,
const int  maxNbNodes = 5,
const double  minBoxSize = 0. 
)

Constructor : Build all the Octree using Compute()

Parameters
theNodes- Set of nodes, the Octree is built from this nodes
maxLevel- Maximum level for the leaves
maxNbNodes- Maximum number of nodes, a leaf can contain
minBoxSize- Minimal size of the Octree Box

References SMESH_Tree< Bnd_B3d, 8 >::compute().

virtual SMESH_OctreeNode::~SMESH_OctreeNode ( )
virtual
SMESH_OctreeNode::SMESH_OctreeNode ( )
protected

Constructor used to allocate a child.

Referenced by newChild().

Member Function Documentation

void SMESH_Tree< Bnd_B3d , NB_CHILDREN >::buildChildren ( )
protectedinherited

Build the children boxes and call buildChildrenData()

void SMESH_OctreeNode::buildChildrenData ( )
protectedvirtual
Bnd_B3d * SMESH_OctreeNode::buildRootBox ( )
protectedvirtual

Compute the first bounding box.

We take the max/min coord of the nodes

Implements SMESH_Tree< Bnd_B3d, 8 >.

References getMaxNbNodes(), SMESH_Tree< Bnd_B3d, 8 >::myIsLeaf, myNodes, SMDS_MeshNode::X(), SMDS_MeshNode::Y(), and SMDS_MeshNode::Z().

void SMESH_Tree< Bnd_B3d , NB_CHILDREN >::compute ( )
inherited
void SMESH_Octree::enlargeByFactor ( Bnd_B3d *  box,
double  factor 
) const
protectedvirtualinherited

Change size of a box by a factor; each dimension changes independently of others.

Implements SMESH_Tree< Bnd_B3d, 8 >.

void SMESH_OctreeNode::FindCoincidentNodes ( TIDSortedNodeSet theSetOfNodes,
const double  theTolerance,
std::list< std::list< const SMDS_MeshNode * > > *  theGroupsOfNodes 
)

Return in theGroupsOfNodes a list of group of nodes close to each other within theTolerance Search for all the nodes in theSetOfNodes.

Note
The Octree itself is also modified by this method
Parameters
theSetOfNodes- set of nodes we look at, modified during research
theTolerance- Precision used
theGroupsOfNodes- list of nodes closed to each other returned

Referenced by FindCoincidentNodes(), SMESH_MeshEditor::FindCoincidentNodes(), and SMESH::Controls::CoincidentNodes::SetMesh().

void SMESH_OctreeNode::FindCoincidentNodes ( TIDSortedNodeSet theSetOfNodes,
std::list< std::list< const SMDS_MeshNode * > > *  theGroupsOfNodes,
const double  theTolerance = 0.00001,
const int  maxLevel = -1,
const int  maxNbNodes = 5 
)
static

Return in theGroupsOfNodes a list of group of nodes close to each other within theTolerance Search for all the nodes in theSetOfNodes Static Method : no need to create an SMESH_OctreeNode.

Parameters
theSetOfNodes- set of nodes we look at, modified during research
theGroupsOfNodes- list of nodes closed to each other returned
theTolerance- Precision used, default value is 0.00001
maxLevel- Maximum level for SMESH_OctreeNode constructed, default value is -1 (Infinite)
maxNbNodes- maximum Nodes in a Leaf of the SMESH_OctreeNode constructed, default value is 5

References FindCoincidentNodes().

void SMESH_OctreeNode::FindCoincidentNodes ( const SMDS_MeshNode Node,
TIDSortedNodeSet SetOfNodes,
std::list< const SMDS_MeshNode * > *  Result,
const double  precision 
)
protected

Return a list of nodes closed to Node and remove it from SetOfNodes.

Note
The Octree itself is also modified by this method
Parameters
Node- We're searching the nodes next to him.
SetOfNodes- set of nodes in which we erase the found nodes
Result- list of nodes closed to Node
precision- Precision used

References FindCoincidentNodes(), SMDS_MeshElement::GetID(), isInside(), SMESH_Tree< Bnd_B3d, 8 >::isLeaf(), SMESH_Tree< Bnd_B3d, 8 >::myChildren, myNodes, SMDS_MeshNode::X(), SMDS_MeshNode::Y(), and SMDS_MeshNode::Z().

int SMESH_Octree::getChildIndex ( double  x,
double  y,
double  z,
const gp_XYZ &  boxMiddle 
)
staticinherited

Return index of a child the given point is in.

Referenced by buildChildrenData(), NodesAround(), and UpdateByMoveNode().

int SMESH_Tree< Bnd_B3d , NB_CHILDREN >::getHeight ( const bool  full = true) const
inherited

Return height of the tree, full or from this level to topest leaf.

int SMESH_OctreeNode::getMaxNbNodes ( ) const
protected

Return max number of nodes in a tree leaf.

References SMESH_Tree< Bnd_B3d, 8 >::myLimit.

Referenced by buildChildrenData(), and buildRootBox().

SMDS_NodeIteratorPtr SMESH_OctreeNode::GetNodeIterator ( )

Return nodes iterator.

References myNodes.

Referenced by SMESH_NodeSearcherImpl::FindClosestTo().

const bool SMESH_OctreeNode::isInside ( const gp_XYZ &  p,
const double  precision = 0. 
)
virtual

Tells us if Node is inside the current box with the precision "precision".

Parameters
Node- Node
precision- The box is enlarged with this precision
Return values
bool- True if Node is in the box within precision

References SMESH_Tree< Bnd_B3d, 8 >::getBox().

Referenced by SMESH_NodeSearcherImpl::FindClosestTo(), FindCoincidentNodes(), NodesAround(), and UpdateByMoveNode().

bool SMESH_Tree< Bnd_B3d , NB_CHILDREN >::isLeaf ( ) const
inherited

Tell if Tree is a leaf or not An inheriting class can influence it via myIsLeaf protected field.

Referenced by FindCoincidentNodes(), GetChildrenIterator(), NodesAround(), and UpdateByMoveNode().

int SMESH_Tree< Bnd_B3d , NB_CHILDREN >::level ( ) const
inherited
double SMESH_Octree::maxSize ( ) const
virtualinherited
static int SMESH_Tree< Bnd_B3d , NB_CHILDREN >::nbChildren ( )
staticinherited
int SMESH_OctreeNode::NbNodes ( ) const

Return nb nodes in a tree.

Referenced by SMESH_NodeSearcherImpl::FindClosestTo(), and NodesAround().

SMESH_Octree * SMESH_OctreeNode::newChild ( ) const
protectedvirtual
Bnd_B3d * SMESH_Octree::newChildBox ( int  childIndex) const
protectedvirtualinherited

Allocate a bndbox according to childIndex.

childIndex is zero based

Implements SMESH_Tree< Bnd_B3d, 8 >.

References SMESH_Tree< Bnd_B3d, 8 >::getBox().

void SMESH_OctreeNode::NodesAround ( const SMDS_MeshNode Node,
std::list< const SMDS_MeshNode * > *  result,
const double  precision = 0. 
)

Return in Result a list of Nodes potentials to be near Node.

Parameters
Node- Node
precision- precision used
Result- list of Nodes potentials to be near Node

References isInside(), SMESH_Tree< Bnd_B3d, 8 >::isLeaf(), SMESH_Tree< Bnd_B3d, 8 >::myChildren, myNodes, and NodesAround().

Referenced by StdMeshers_Import_1D2D::Compute(), SMESH_NodeSearcherImpl::FindClosestTo(), and NodesAround().

bool SMESH_OctreeNode::NodesAround ( const gp_XYZ &  node,
std::map< double, const SMDS_MeshNode * > &  dist2Nodes,
double  precision 
)

Return in dist2Nodes nodes mapped to their square distance from Node Tries to find a closest node.

Parameters
node- node to find nodes closest to
dist2Nodes- map of found nodes and their distances
precision- radius of a sphere to check nodes inside
Return values
bool- true if an exact overlapping found !!!

References SMESH_TNodeXYZ::_node, SMESH_Tree< Bnd_B3d, 8 >::getBox(), SMESH_Octree::getChildIndex(), isInside(), SMESH_Tree< Bnd_B3d, 8 >::isLeaf(), SMESH_Octree::maxSize(), SMESH_Tree< Bnd_B3d, 8 >::myChildren, myNodes, and NbNodes().

void SMESH_OctreeNode::NodesAround ( const gp_XYZ &  point,
std::vector< const SMDS_MeshNode * > &  nodes,
double  precision 
)

Return a list of nodes close to a point.

Parameters
[in]point- point
[out]nodes- found nodes
[in]precision- allowed distance from point

References SMESH_TNodeXYZ::_node, isInside(), SMESH_Tree< Bnd_B3d, 8 >::isLeaf(), SMESH_Tree< Bnd_B3d, 8 >::myChildren, myNodes, NbNodes(), and NodesAround().

void SMESH_OctreeNode::UpdateByMoveNode ( const SMDS_MeshNode node,
const gp_Pnt &  toPnt 
)

Field Documentation

box_type* SMESH_Tree< Bnd_B3d , NB_CHILDREN >::myBox
protectedinherited
SMESH_Tree* SMESH_Tree< Bnd_B3d , NB_CHILDREN >::myFather
protectedinherited
bool SMESH_Tree< Bnd_B3d , NB_CHILDREN >::myIsLeaf
protectedinherited
int SMESH_Tree< Bnd_B3d , NB_CHILDREN >::myLevel
protectedinherited
const SMESH_TreeLimit* SMESH_Tree< Bnd_B3d , NB_CHILDREN >::myLimit
protectedinherited

Referenced by getMaxNbNodes().