X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH%2FSMESH_OctreeNode.cxx;h=16fb784fb791811c74f6a599e4c2e2f9e38147c4;hp=52f1e3071799bb048975583044fe08ad98c4b7b5;hb=358f8ddd54e7ed553eecc22ca665575e4019e3a0;hpb=82decf21b02b9ab50c26308cd477078a92aeab3f diff --git a/src/SMESH/SMESH_OctreeNode.cxx b/src/SMESH/SMESH_OctreeNode.cxx index 52f1e3071..16fb784fb 100644 --- a/src/SMESH/SMESH_OctreeNode.cxx +++ b/src/SMESH/SMESH_OctreeNode.cxx @@ -28,8 +28,10 @@ // Module : SMESH #include "SMESH_OctreeNode.hxx" + +#include "SMDS_MeshNode.hxx" +#include "SMDS_SetIterator.hxx" #include -#include using namespace std; @@ -42,7 +44,7 @@ using namespace std; * \param minBoxSize - Minimal size of the Octree Box */ //================================================================ -SMESH_OctreeNode::SMESH_OctreeNode (set theNodes, const int maxLevel, +SMESH_OctreeNode::SMESH_OctreeNode (const set & theNodes, const int maxLevel, const int maxNbNodes , const double minBoxSize ) :SMESH_Octree(maxLevel,minBoxSize), myMaxNbNodes(maxNbNodes), @@ -119,11 +121,10 @@ const bool SMESH_OctreeNode::isInside(const SMDS_MeshNode * Node, const double p bool Out = 1 ; if (precision<=0.) return !(myBox->IsOut(gp_XYZ(X,Y,Z))); - Bnd_B3d * BoxWithPrecision = new Bnd_B3d(); + Bnd_B3d BoxWithPrecision; getBox(BoxWithPrecision); - BoxWithPrecision->Enlarge(precision); - Out=BoxWithPrecision->IsOut(gp_XYZ(X,Y,Z)); - delete BoxWithPrecision; + BoxWithPrecision.Enlarge(precision); + Out=BoxWithPrecision.IsOut(gp_XYZ(X,Y,Z)); return !(Out); } @@ -325,3 +326,28 @@ void SMESH_OctreeNode::FindCoincidentNodes( const SMDS_MeshNode * Node, } } +//================================================================================ +/*! + * \brief Return iterator over children + */ +//================================================================================ + +SMESH_OctreeNodeIteratorPtr SMESH_OctreeNode::GetChildrenIterator() +{ + return SMESH_OctreeNodeIteratorPtr + ( new SMDS_SetIterator< SMESH_OctreeNode*, SMESH_Octree** > + ( myChildren, ( isLeaf() ? myChildren : &myChildren[ 8 ] ))); +} + +//================================================================================ +/*! + * \brief Return nodes iterator + */ +//================================================================================ + +SMDS_NodeIteratorPtr SMESH_OctreeNode::GetNodeIterator() +{ + return SMDS_NodeIteratorPtr + ( new SMDS_SetIterator< SMDS_pNode, set< SMDS_pNode >::const_iterator > + ( myNodes.begin(), myNodes.end() )); +}