Version: 9.12.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 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 AllNodesAround (const SMDS_MeshNode *node, std::vector< 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, TListOfNodeLists *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...
 
size_t NbNodes () const
 Return nb nodes in a tree. More...
 
double maxSize () const
 Compute the bigger dimension of my box. More...
 
void compute ()
 Compute the Tree. More...
 
bool isLeaf () const
 Tell if Tree is a leaf or not An inheriting class can influence it via myIsLeaf protected field. More...
 
int level () const
 
const box_typegetBox () const
 
int getHeight (const bool full=true) const
 Return height of the tree, full or from this level to topest leaf. More...
 

Static Public Member Functions

static void FindCoincidentNodes (TIDSortedNodeSet &nodes, TListOfNodeLists *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::vector< 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 ()
 Build the children boxes and call buildChildrenData() More...
 

Protected Attributes

std::vector< const SMDS_MeshNode * > myNodes
 
SMESH_Tree ** myChildren
 
SMESH_TreemyFather
 
bool myIsLeaf
 
const SMESH_TreeLimitmyLimit
 
box_typemyBox
 
int myLevel
 

Member Typedef Documentation

◆ box_type

typedef Bnd_B3d SMESH_Tree< Bnd_B3d , NB_CHILDREN >::box_type
inherited

◆ TBaseTree

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

Constructor & Destructor Documentation

◆ SMESH_OctreeNode() [1/2]

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().

◆ ~SMESH_OctreeNode()

virtual SMESH_OctreeNode::~SMESH_OctreeNode ( )
virtual

◆ SMESH_OctreeNode() [2/2]

SMESH_OctreeNode::SMESH_OctreeNode ( )
protected

Constructor used to allocate a child.

Referenced by newChild().

Member Function Documentation

◆ AllNodesAround()

void SMESH_OctreeNode::AllNodesAround ( const SMDS_MeshNode Node,
std::vector< 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 AllNodesAround(), isInside(), SMESH_Tree< Bnd_B3d, 8 >::isLeaf(), SMESH_Tree< Bnd_B3d, 8 >::myChildren, myNodes, and Node.

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

◆ buildChildren()

void SMESH_Tree< Bnd_B3d , NB_CHILDREN >::buildChildren
protectedinherited

Build the children boxes and call buildChildrenData()

◆ buildChildrenData()

void SMESH_OctreeNode::buildChildrenData ( )
protectedvirtual

◆ buildRootBox()

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, and myNodes.

◆ compute()

void SMESH_Tree< Bnd_B3d , NB_CHILDREN >::compute
inherited

Compute the Tree.

◆ enlargeByFactor()

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 >.

◆ findCoincidentNodes()

void SMESH_OctreeNode::findCoincidentNodes ( const SMDS_MeshNode Node,
TIDSortedNodeSet SetOfNodes,
std::vector< 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(), isInside(), SMESH_Tree< Bnd_B3d, 8 >::isLeaf(), SMESH_Tree< Bnd_B3d, 8 >::myChildren, myNodes, Node, and SMESH_TNodeXYZ::SquareDistance().

Referenced by findCoincidentNodes(), and FindCoincidentNodes().

◆ FindCoincidentNodes() [1/2]

void SMESH_OctreeNode::FindCoincidentNodes ( TIDSortedNodeSet theSetOfNodes,
TListOfNodeLists 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().

◆ FindCoincidentNodes() [2/2]

void SMESH_OctreeNode::FindCoincidentNodes ( TIDSortedNodeSet theSetOfNodes,
const double  theTolerance,
TListOfNodeLists 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

References SMESHUtils::elemSetIterator(), findCoincidentNodes(), SMDS_MeshElement::isMarked(), SMESH_MeshAlgos::MarkElems(), and SMDS_MeshElement::setIsMarked().

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

◆ getBox()

const box_type* SMESH_Tree< Bnd_B3d , NB_CHILDREN >::getBox ( ) const
inherited

◆ getChildIndex()

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().

◆ GetChildrenIterator()

◆ getHeight()

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.

◆ getMaxNbNodes()

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().

◆ GetNodeIterator()

SMDS_NodeIteratorPtr SMESH_OctreeNode::GetNodeIterator ( )

Return nodes iterator.

References myNodes.

Referenced by SMESH_NodeSearcherImpl::FindClosestTo().

◆ isInside()

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 AllNodesAround(), SMESH_NodeSearcherImpl::FindClosestTo(), findCoincidentNodes(), NodesAround(), and UpdateByMoveNode().

◆ isLeaf()

bool SMESH_Tree< Bnd_B3d , NB_CHILDREN >::isLeaf
inherited

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

◆ level()

int SMESH_Tree< Bnd_B3d , NB_CHILDREN >::level ( ) const
inherited

◆ maxSize()

◆ nbChildren()

static int SMESH_Tree< Bnd_B3d , NB_CHILDREN >::nbChildren ( )
staticinherited

◆ NbNodes()

size_t SMESH_OctreeNode::NbNodes ( ) const

Return nb nodes in a tree.

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

◆ newChild()

SMESH_Octree * SMESH_OctreeNode::newChild ( ) const
protectedvirtual

◆ newChildBox()

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().

◆ NodesAround() [1/2]

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_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().

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

◆ NodesAround() [2/2]

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 isInside(), SMESH_Tree< Bnd_B3d, 8 >::isLeaf(), SMESH_Tree< Bnd_B3d, 8 >::myChildren, myNodes, NbNodes(), and NodesAround().

◆ UpdateByMoveNode()

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

Field Documentation

◆ myBox

box_type* SMESH_Tree< Bnd_B3d , NB_CHILDREN >::myBox
protectedinherited

◆ myChildren

SMESH_Tree** SMESH_Tree< Bnd_B3d , NB_CHILDREN >::myChildren
protectedinherited

◆ myFather

SMESH_Tree* SMESH_Tree< Bnd_B3d , NB_CHILDREN >::myFather
protectedinherited

◆ myIsLeaf

bool SMESH_Tree< Bnd_B3d , NB_CHILDREN >::myIsLeaf
protectedinherited

◆ myLevel

int SMESH_Tree< Bnd_B3d , NB_CHILDREN >::myLevel
protectedinherited

◆ myLimit

const SMESH_TreeLimit* SMESH_Tree< Bnd_B3d , NB_CHILDREN >::myLimit
protectedinherited

◆ myNodes

std::vector< const SMDS_MeshNode* > SMESH_OctreeNode::myNodes
protected