#include <SMESH_OctreeNode.hxx>
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_type * | getBox () 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_Octree * | newChild () 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_Tree * | myFather |
bool | myIsLeaf |
const SMESH_TreeLimit * | myLimit |
box_type * | myBox |
int | myLevel |
|
inherited |
|
inherited |
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()
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 |
|
protected |
Constructor used to allocate a child.
Referenced by newChild().
|
protectedinherited |
Build the children boxes and call buildChildrenData()
|
protectedvirtual |
Set the data of the children Shares the father's data with each of his child.
Implements SMESH_Tree< Bnd_B3d, 8 >.
References SMESH_Tree< Bnd_B3d, 8 >::getBox(), SMESH_Octree::getChildIndex(), getMaxNbNodes(), SMESH_Tree< Bnd_B3d, 8 >::myChildren, SMESH_Tree< BND_BOX, NB_CHILDREN >::myIsLeaf, myNodes, SMDS_MeshNode::X(), SMDS_MeshNode::Y(), and SMDS_MeshNode::Z().
|
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().
|
inherited |
Compute the Tree.
Referenced by SMESH::Controls::ElementsOnShape::OctreeClassifier::OctreeClassifier(), and SMESH_OctreeNode().
|
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.
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().
|
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.
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().
|
protected |
Return a list of nodes closed to Node and remove it from SetOfNodes.
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().
|
inherited |
References SMESH_Tree< BND_BOX, NB_CHILDREN >::myBox.
Referenced by buildChildrenData(), isInside(), SMESH_Octree::maxSize(), SMESH_Octree::newChildBox(), NodesAround(), and UpdateByMoveNode().
|
staticinherited |
Return index of a child the given point is in.
Referenced by buildChildrenData(), NodesAround(), and UpdateByMoveNode().
SMESH_OctreeNodeIteratorPtr SMESH_OctreeNode::GetChildrenIterator | ( | ) |
Return iterator over children.
References SMESH_Tree< Bnd_B3d, 8 >::isLeaf(), and SMESH_Tree< Bnd_B3d, 8 >::myChildren.
Referenced by SMESH_NodeSearcherImpl::FindClosestTo(), and SMESH_NodeSearcherImpl::SMESH_NodeSearcherImpl().
|
inherited |
Return height of the tree, full or from this level to topest leaf.
|
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 | ( | ) |
|
virtual |
Tells us if Node is inside the current box with the precision "precision".
Node | - Node |
precision | - The box is enlarged with this precision |
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().
|
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().
|
inherited |
References SMESH_Tree< BND_BOX, NB_CHILDREN >::myLevel.
|
virtualinherited |
Compute the bigger dimension of my box.
Implements SMESH_Tree< Bnd_B3d, 8 >.
References SMESH_Tree< Bnd_B3d, 8 >::getBox().
Referenced by SMESH_ElementSearcherImpl::getTolerance(), NodesAround(), and SMESH_NodeSearcherImpl::SMESH_NodeSearcherImpl().
|
staticinherited |
int SMESH_OctreeNode::NbNodes | ( | ) | const |
Return nb nodes in a tree.
Referenced by SMESH_NodeSearcherImpl::FindClosestTo(), and NodesAround().
|
protectedvirtual |
Construct an empty SMESH_OctreeNode used by SMESH_Octree::buildChildren()
Implements SMESH_Tree< Bnd_B3d, 8 >.
References SMESH_OctreeNode().
|
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.
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.
node | - node to find nodes closest to |
dist2Nodes | - map of found nodes and their distances |
precision | - radius of a sphere to check nodes inside |
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.
[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 | ||
) |
Update data according to node movement.
References SMESH_Tree< Bnd_B3d, 8 >::getBox(), SMESH_Octree::getChildIndex(), isInside(), SMESH_Tree< Bnd_B3d, 8 >::isLeaf(), SMESH_Tree< Bnd_B3d, 8 >::myChildren, myNodes, SMDS_MeshNode::X(), SMDS_MeshNode::Y(), and SMDS_MeshNode::Z().
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
Referenced by buildRootBox(), and SMESH::Controls::ElementsOnShape::OctreeClassifier::OctreeClassifier().
|
protectedinherited |
|
protectedinherited |
Referenced by getMaxNbNodes().
|
protected |
Referenced by buildChildrenData(), buildRootBox(), FindCoincidentNodes(), GetNodeIterator(), NodesAround(), and UpdateByMoveNode().