X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESH%2FSMESH_OctreeNode.hxx;h=951d2bc1444fb29787ea3df6386a7833840978e1;hb=d8f644ca3d4ce62f2ef41d4aacb52f5bb1221df3;hp=70133845d7260d8bdcd47ae7f7d3ae763b4573b6;hpb=79b1ac2b6df9117f16f11d444b1f165d477a1813;p=modules%2Fsmesh.git diff --git a/src/SMESH/SMESH_OctreeNode.hxx b/src/SMESH/SMESH_OctreeNode.hxx index 70133845d..951d2bc14 100644 --- a/src/SMESH/SMESH_OctreeNode.hxx +++ b/src/SMESH/SMESH_OctreeNode.hxx @@ -1,7 +1,6 @@ -// SMESH SMESH_OctreeNode : Octree with Nodes set -// inherites global class SMESH_Octree +// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // // This library is free software; you can redistribute it and/or @@ -18,24 +17,25 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// -// File : SMESH_OctreeNode.hxx -// Created : Tue Jan 16 16:00:00 2007 -// Author : Nicolas Geimer & Aurélien Motteux (OCC) -// Module : SMESH - -using namespace std; +// SMESH SMESH_OctreeNode : Octree with Nodes set +// inherites global class SMESH_Octree +// File : SMESH_OctreeNode.hxx +// Created : Tue Jan 16 16:00:00 2007 +// Author : Nicolas Geimer & Aurélien Motteux (OCC) +// Module : SMESH +// #ifndef _SMESH_OCTREENODE_HXX_ #define _SMESH_OCTREENODE_HXX_ #include "SMESH_Octree.hxx" +#include "SMDS_MeshNode.hxx" #include #include +#include #include "SMDS_ElemIterator.hxx" @@ -43,16 +43,17 @@ using namespace std; class SMDS_MeshNode; class SMESH_OctreeNode; -typedef SMDS_Iterator SMESH_OctreeNodeIterator; -typedef boost::shared_ptr SMESH_OctreeNodeIteratorPtr; +typedef SMDS_Iterator SMESH_OctreeNodeIterator; +typedef boost::shared_ptr SMESH_OctreeNodeIteratorPtr; +typedef std::set< const SMDS_MeshNode*, TIDCompare > TIDSortedNodeSet; -class SMESH_OctreeNode : public SMESH_Octree{ +class SMESH_OctreeNode : public SMESH_Octree { public: // Constructor - SMESH_OctreeNode (const set& theNodes, const int maxLevel = -1, - const int maxNbNodes = 5 , const double minBoxSize = 0.); + SMESH_OctreeNode (const TIDSortedNodeSet& theNodes, const int maxLevel = 8, + const int maxNbNodes = 5, const double minBoxSize = 0.); //============================= /*! @@ -61,28 +62,36 @@ public: //============================= virtual ~SMESH_OctreeNode () {}; - // Tells us if SMESH_OctreeNode is a leaf or not (-1 = not initialiazed) - virtual const bool isLeaf(); - // Tells us if Node is inside the current box with the precision "precision" - virtual const bool isInside(const SMDS_MeshNode * Node, const double precision = 0. ); + virtual const bool isInside(const SMDS_MeshNode * Node, const double precision = 0.); // Return in Result a list of Nodes potentials to be near Node - void NodesAround( const SMDS_MeshNode * Node , list* Result, - const double precision = 0. ); + void NodesAround(const SMDS_MeshNode * Node, + std::list* Result, + const double precision = 0.); + + // Return in dist2Nodes nodes mapped to their square distance from Node + bool NodesAround(const SMDS_MeshNode * Node, + std::map& dist2Nodes, + double precision); // Return in theGroupsOfNodes a list of group of nodes close to each other within theTolerance // Search for all the nodes in nodes - void FindCoincidentNodes ( set* nodes, + void FindCoincidentNodes ( TIDSortedNodeSet* nodes, const double theTolerance, - list< list< const SMDS_MeshNode*> >* theGroupsOfNodes); + std::list< std::list< const SMDS_MeshNode*> >* theGroupsOfNodes); // Static method that return in theGroupsOfNodes a list of group of nodes close to each other within // theTolerance search for all the nodes in nodes - static void FindCoincidentNodes ( set nodes, - list< list< const SMDS_MeshNode*> >* theGroupsOfNodes, - const double theTolerance = 0.00001, const int maxLevel = -1, + 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); + /*! + * \brief Update data according to node movement + */ + void UpdateByMoveNode( const SMDS_MeshNode* node, const gp_Pnt& toPnt ); /*! * \brief Return iterator over children */ @@ -94,39 +103,33 @@ public: /*! * \brief Return nb nodes in a tree */ - int NbNodes() const { return myNbNodes; } + int NbNodes() const { return myNodes.size(); } protected: -//============================= -/*! - * \brief Empty constructor - */ -//============================= - SMESH_OctreeNode (){}; + SMESH_OctreeNode (int maxNbNodes ); + + // Compute the bounding box of the whole set of nodes myNodes + virtual Bnd_B3d* buildRootBox(); // Shares the father's data with each of his child virtual void buildChildrenData(); - // Compute the bounding box of the whole set of nodes myNodes (only used for OctreeNode level 0) - void computeBoxForFather(); - // Construct an empty SMESH_OctreeNode used by SMESH_Octree::buildChildren() - virtual SMESH_Octree* allocateOctreeChild(); + virtual SMESH_Octree* allocateOctreeChild() const; // Return in result a list of nodes closed to Node and remove it from SetOfNodes - void FindCoincidentNodes( const SMDS_MeshNode * Node, - set* SetOfNodes, - list* Result, - const double precision); + void FindCoincidentNodes( const SMDS_MeshNode * Node, + TIDSortedNodeSet* SetOfNodes, + std::list* Result, + const double precision); // The max number of nodes a leaf box can contain - int myMaxNbNodes; + int myMaxNbNodes; // The set of nodes inside the box of the Octree (Empty if Octree is not a leaf) - set myNodes; + TIDSortedNodeSet myNodes; - // The number of nodes I have inside the box - int myNbNodes; }; + #endif