mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-02-07 18:54:17 +05:00
Use TIDSortedNodeSet instead of set< const SMDS_MeshNode*> when looking for coincident nodes
+typedef std::set< const SMDS_MeshNode*, TIDCompare > TIDSortedNodeSet;
This commit is contained in:
parent
20db1a650f
commit
b166f12b58
@ -5883,24 +5883,21 @@ SMESH_MeshEditor::generateGroups(const SMESH_SequenceOfElemPtr& nodeGens,
|
|||||||
*/
|
*/
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
|
||||||
void SMESH_MeshEditor::FindCoincidentNodes (set<const SMDS_MeshNode*> & theNodes,
|
void SMESH_MeshEditor::FindCoincidentNodes (TIDSortedNodeSet & theNodes,
|
||||||
const double theTolerance,
|
const double theTolerance,
|
||||||
TListOfListOfNodes & theGroupsOfNodes)
|
TListOfListOfNodes & theGroupsOfNodes)
|
||||||
{
|
{
|
||||||
myLastCreatedElems.Clear();
|
myLastCreatedElems.Clear();
|
||||||
myLastCreatedNodes.Clear();
|
myLastCreatedNodes.Clear();
|
||||||
|
|
||||||
set<const SMDS_MeshNode*> nodes;
|
|
||||||
if ( theNodes.empty() )
|
if ( theNodes.empty() )
|
||||||
{ // get all nodes in the mesh
|
{ // get all nodes in the mesh
|
||||||
SMDS_NodeIteratorPtr nIt = GetMeshDS()->nodesIterator();
|
SMDS_NodeIteratorPtr nIt = GetMeshDS()->nodesIterator(/*idInceasingOrder=*/true);
|
||||||
while ( nIt->more() )
|
while ( nIt->more() )
|
||||||
nodes.insert( nodes.end(),nIt->next());
|
theNodes.insert( theNodes.end(),nIt->next());
|
||||||
}
|
}
|
||||||
else
|
|
||||||
nodes=theNodes;
|
|
||||||
|
|
||||||
SMESH_OctreeNode::FindCoincidentNodes ( nodes, &theGroupsOfNodes, theTolerance);
|
SMESH_OctreeNode::FindCoincidentNodes ( theNodes, &theGroupsOfNodes, theTolerance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -5920,9 +5917,9 @@ struct SMESH_NodeSearcherImpl: public SMESH_NodeSearcher
|
|||||||
{
|
{
|
||||||
myMesh = ( SMESHDS_Mesh* ) theMesh;
|
myMesh = ( SMESHDS_Mesh* ) theMesh;
|
||||||
|
|
||||||
set<const SMDS_MeshNode*> nodes;
|
TIDSortedNodeSet nodes;
|
||||||
if ( theMesh ) {
|
if ( theMesh ) {
|
||||||
SMDS_NodeIteratorPtr nIt = theMesh->nodesIterator();
|
SMDS_NodeIteratorPtr nIt = theMesh->nodesIterator(/*idInceasingOrder=*/true);
|
||||||
while ( nIt->more() )
|
while ( nIt->more() )
|
||||||
nodes.insert( nodes.end(), nIt->next() );
|
nodes.insert( nodes.end(), nIt->next() );
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,7 @@ typedef std::map<const SMDS_MeshNode*, const SMDS_MeshNode*> TNodeNodeMap;
|
|||||||
|
|
||||||
//!< Set of elements sorted by ID, to be used to assure predictability of edition
|
//!< Set of elements sorted by ID, to be used to assure predictability of edition
|
||||||
typedef std::set< const SMDS_MeshElement*, TIDCompare > TIDSortedElemSet;
|
typedef std::set< const SMDS_MeshElement*, TIDCompare > TIDSortedElemSet;
|
||||||
|
typedef std::set< const SMDS_MeshNode*, TIDCompare > TIDSortedNodeSet;
|
||||||
|
|
||||||
typedef pair< const SMDS_MeshNode*, const SMDS_MeshNode* > NLink;
|
typedef pair< const SMDS_MeshNode*, const SMDS_MeshNode* > NLink;
|
||||||
|
|
||||||
@ -408,7 +409,7 @@ public:
|
|||||||
|
|
||||||
typedef std::list< std::list< const SMDS_MeshNode* > > TListOfListOfNodes;
|
typedef std::list< std::list< const SMDS_MeshNode* > > TListOfListOfNodes;
|
||||||
|
|
||||||
void FindCoincidentNodes (std::set<const SMDS_MeshNode*> & theNodes,
|
void FindCoincidentNodes (TIDSortedNodeSet & theNodes,
|
||||||
const double theTolerance,
|
const double theTolerance,
|
||||||
TListOfListOfNodes & theGroupsOfNodes);
|
TListOfListOfNodes & theGroupsOfNodes);
|
||||||
// Return list of group of nodes close to each other within theTolerance.
|
// Return list of group of nodes close to each other within theTolerance.
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
//
|
//
|
||||||
#include "SMESH_OctreeNode.hxx"
|
#include "SMESH_OctreeNode.hxx"
|
||||||
|
|
||||||
#include "SMDS_MeshNode.hxx"
|
|
||||||
#include "SMDS_SetIterator.hxx"
|
#include "SMDS_SetIterator.hxx"
|
||||||
#include <gp_Pnt.hxx>
|
#include <gp_Pnt.hxx>
|
||||||
|
|
||||||
@ -44,7 +43,7 @@ using namespace std;
|
|||||||
* \param minBoxSize - Minimal size of the Octree Box
|
* \param minBoxSize - Minimal size of the Octree Box
|
||||||
*/
|
*/
|
||||||
//================================================================
|
//================================================================
|
||||||
SMESH_OctreeNode::SMESH_OctreeNode (const set<const SMDS_MeshNode*> & theNodes, const int maxLevel,
|
SMESH_OctreeNode::SMESH_OctreeNode (const TIDSortedNodeSet & theNodes, const int maxLevel,
|
||||||
const int maxNbNodes , const double minBoxSize )
|
const int maxNbNodes , const double minBoxSize )
|
||||||
:SMESH_Octree( new SMESH_Octree::Limit( maxLevel,minBoxSize)),
|
:SMESH_Octree( new SMESH_Octree::Limit( maxLevel,minBoxSize)),
|
||||||
myMaxNbNodes(maxNbNodes),
|
myMaxNbNodes(maxNbNodes),
|
||||||
@ -86,7 +85,7 @@ SMESH_Octree* SMESH_OctreeNode::allocateOctreeChild() const
|
|||||||
Bnd_B3d* SMESH_OctreeNode::buildRootBox()
|
Bnd_B3d* SMESH_OctreeNode::buildRootBox()
|
||||||
{
|
{
|
||||||
Bnd_B3d* box = new Bnd_B3d;
|
Bnd_B3d* box = new Bnd_B3d;
|
||||||
set<const SMDS_MeshNode*>::iterator it = myNodes.begin();
|
TIDSortedNodeSet::iterator it = myNodes.begin();
|
||||||
for (; it != myNodes.end(); it++) {
|
for (; it != myNodes.end(); it++) {
|
||||||
const SMDS_MeshNode* n1 = *it;
|
const SMDS_MeshNode* n1 = *it;
|
||||||
gp_XYZ p1( n1->X(), n1->Y(), n1->Z() );
|
gp_XYZ p1( n1->X(), n1->Y(), n1->Z() );
|
||||||
@ -129,7 +128,7 @@ void SMESH_OctreeNode::buildChildrenData()
|
|||||||
gp_XYZ max = getBox().CornerMax();
|
gp_XYZ max = getBox().CornerMax();
|
||||||
gp_XYZ mid = (min + max)/2.;
|
gp_XYZ mid = (min + max)/2.;
|
||||||
|
|
||||||
set<const SMDS_MeshNode*>::iterator it = myNodes.begin();
|
TIDSortedNodeSet::iterator it = myNodes.begin();
|
||||||
while (it != myNodes.end())
|
while (it != myNodes.end())
|
||||||
{
|
{
|
||||||
const SMDS_MeshNode* n1 = *it;
|
const SMDS_MeshNode* n1 = *it;
|
||||||
@ -214,7 +213,7 @@ bool SMESH_OctreeNode::NodesAround(const SMDS_MeshNode * node,
|
|||||||
{
|
{
|
||||||
double minDist = precision * precision;
|
double minDist = precision * precision;
|
||||||
gp_Pnt p1 ( node->X(), node->Y(), node->Z() );
|
gp_Pnt p1 ( node->X(), node->Y(), node->Z() );
|
||||||
set<const SMDS_MeshNode*>::iterator nIt = myNodes.begin();
|
TIDSortedNodeSet::iterator nIt = myNodes.begin();
|
||||||
for ( ; nIt != myNodes.end(); ++nIt )
|
for ( ; nIt != myNodes.end(); ++nIt )
|
||||||
{
|
{
|
||||||
gp_Pnt p2 ( (*nIt)->X(), (*nIt)->Y(), (*nIt)->Z() );
|
gp_Pnt p2 ( (*nIt)->X(), (*nIt)->Y(), (*nIt)->Z() );
|
||||||
@ -243,7 +242,7 @@ bool SMESH_OctreeNode::NodesAround(const SMDS_MeshNode * node,
|
|||||||
* \param maxNbNodes - maximum Nodes in a Leaf of the SMESH_OctreeNode constructed, default value is 5
|
* \param maxNbNodes - maximum Nodes in a Leaf of the SMESH_OctreeNode constructed, default value is 5
|
||||||
*/
|
*/
|
||||||
//=============================
|
//=============================
|
||||||
void SMESH_OctreeNode::FindCoincidentNodes (set<const SMDS_MeshNode*>& theSetOfNodes,
|
void SMESH_OctreeNode::FindCoincidentNodes (TIDSortedNodeSet& theSetOfNodes,
|
||||||
list< list< const SMDS_MeshNode*> >* theGroupsOfNodes,
|
list< list< const SMDS_MeshNode*> >* theGroupsOfNodes,
|
||||||
const double theTolerance,
|
const double theTolerance,
|
||||||
const int maxLevel,
|
const int maxLevel,
|
||||||
@ -263,11 +262,11 @@ void SMESH_OctreeNode::FindCoincidentNodes (set<const SMDS_MeshNode*>& theSetOfN
|
|||||||
* \param theGroupsOfNodes - list of nodes closed to each other returned
|
* \param theGroupsOfNodes - list of nodes closed to each other returned
|
||||||
*/
|
*/
|
||||||
//=============================
|
//=============================
|
||||||
void SMESH_OctreeNode::FindCoincidentNodes ( set<const SMDS_MeshNode*>* theSetOfNodes,
|
void SMESH_OctreeNode::FindCoincidentNodes ( TIDSortedNodeSet* theSetOfNodes,
|
||||||
const double theTolerance,
|
const double theTolerance,
|
||||||
list< list< const SMDS_MeshNode*> >* theGroupsOfNodes)
|
list< list< const SMDS_MeshNode*> >* theGroupsOfNodes)
|
||||||
{
|
{
|
||||||
set<const SMDS_MeshNode*>::iterator it1 = theSetOfNodes->begin();
|
TIDSortedNodeSet::iterator it1 = theSetOfNodes->begin();
|
||||||
list<const SMDS_MeshNode*>::iterator it2;
|
list<const SMDS_MeshNode*>::iterator it2;
|
||||||
|
|
||||||
while (it1 != theSetOfNodes->end())
|
while (it1 != theSetOfNodes->end())
|
||||||
@ -316,7 +315,7 @@ void SMESH_OctreeNode::FindCoincidentNodes ( set<const SMDS_MeshNode*>* theSetOf
|
|||||||
*/
|
*/
|
||||||
//======================================================================================
|
//======================================================================================
|
||||||
void SMESH_OctreeNode::FindCoincidentNodes (const SMDS_MeshNode * Node,
|
void SMESH_OctreeNode::FindCoincidentNodes (const SMDS_MeshNode * Node,
|
||||||
set<const SMDS_MeshNode*>* SetOfNodes,
|
TIDSortedNodeSet* SetOfNodes,
|
||||||
list<const SMDS_MeshNode*>* Result,
|
list<const SMDS_MeshNode*>* Result,
|
||||||
const double precision)
|
const double precision)
|
||||||
{
|
{
|
||||||
@ -329,8 +328,8 @@ void SMESH_OctreeNode::FindCoincidentNodes (const SMDS_MeshNode * Node,
|
|||||||
{
|
{
|
||||||
gp_Pnt p1 (Node->X(), Node->Y(), Node->Z());
|
gp_Pnt p1 (Node->X(), Node->Y(), Node->Z());
|
||||||
|
|
||||||
set<const SMDS_MeshNode*> myNodesCopy = myNodes;
|
TIDSortedNodeSet myNodesCopy = myNodes;
|
||||||
set<const SMDS_MeshNode*>::iterator it = myNodesCopy.begin();
|
TIDSortedNodeSet::iterator it = myNodesCopy.begin();
|
||||||
double tol2 = precision * precision;
|
double tol2 = precision * precision;
|
||||||
bool squareBool;
|
bool squareBool;
|
||||||
|
|
||||||
@ -383,7 +382,7 @@ void SMESH_OctreeNode::UpdateByMoveNode( const SMDS_MeshNode* node, const gp_Pnt
|
|||||||
{
|
{
|
||||||
if ( isLeaf() )
|
if ( isLeaf() )
|
||||||
{
|
{
|
||||||
set<const SMDS_MeshNode*>::iterator pNode = myNodes.find( node );
|
TIDSortedNodeSet::iterator pNode = myNodes.find( node );
|
||||||
bool nodeInMe = ( pNode != myNodes.end() );
|
bool nodeInMe = ( pNode != myNodes.end() );
|
||||||
|
|
||||||
SMDS_MeshNode pointNode( toPnt.X(), toPnt.Y(), toPnt.Z() );
|
SMDS_MeshNode pointNode( toPnt.X(), toPnt.Y(), toPnt.Z() );
|
||||||
@ -430,6 +429,6 @@ SMESH_OctreeNodeIteratorPtr SMESH_OctreeNode::GetChildrenIterator()
|
|||||||
SMDS_NodeIteratorPtr SMESH_OctreeNode::GetNodeIterator()
|
SMDS_NodeIteratorPtr SMESH_OctreeNode::GetNodeIterator()
|
||||||
{
|
{
|
||||||
return SMDS_NodeIteratorPtr
|
return SMDS_NodeIteratorPtr
|
||||||
( new SMDS_SetIterator< SMDS_pNode, set< SMDS_pNode >::const_iterator >
|
( new SMDS_SetIterator< SMDS_pNode, TIDSortedNodeSet::const_iterator >
|
||||||
( myNodes.begin(), myNodes.size() ? myNodes.end() : myNodes.begin()));
|
( myNodes.begin(), myNodes.size() ? myNodes.end() : myNodes.begin()));
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#define _SMESH_OCTREENODE_HXX_
|
#define _SMESH_OCTREENODE_HXX_
|
||||||
|
|
||||||
#include "SMESH_Octree.hxx"
|
#include "SMESH_Octree.hxx"
|
||||||
|
#include "SMDS_MeshNode.hxx"
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <set>
|
#include <set>
|
||||||
@ -44,13 +45,14 @@ class SMESH_OctreeNode;
|
|||||||
|
|
||||||
typedef SMDS_Iterator<SMESH_OctreeNode*> SMESH_OctreeNodeIterator;
|
typedef SMDS_Iterator<SMESH_OctreeNode*> SMESH_OctreeNodeIterator;
|
||||||
typedef boost::shared_ptr<SMESH_OctreeNodeIterator> SMESH_OctreeNodeIteratorPtr;
|
typedef boost::shared_ptr<SMESH_OctreeNodeIterator> SMESH_OctreeNodeIteratorPtr;
|
||||||
|
typedef std::set< const SMDS_MeshNode*, TIDCompare > TIDSortedNodeSet;
|
||||||
|
|
||||||
class SMESH_OctreeNode : public SMESH_Octree {
|
class SMESH_OctreeNode : public SMESH_Octree {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
SMESH_OctreeNode (const std::set<const SMDS_MeshNode*>& theNodes, const int maxLevel = 8,
|
SMESH_OctreeNode (const TIDSortedNodeSet& theNodes, const int maxLevel = 8,
|
||||||
const int maxNbNodes = 5, const double minBoxSize = 0.);
|
const int maxNbNodes = 5, const double minBoxSize = 0.);
|
||||||
|
|
||||||
//=============================
|
//=============================
|
||||||
@ -75,13 +77,13 @@ public:
|
|||||||
|
|
||||||
// Return in theGroupsOfNodes a list of group of nodes close to each other within theTolerance
|
// Return in theGroupsOfNodes a list of group of nodes close to each other within theTolerance
|
||||||
// Search for all the nodes in nodes
|
// Search for all the nodes in nodes
|
||||||
void FindCoincidentNodes ( std::set<const SMDS_MeshNode*>* nodes,
|
void FindCoincidentNodes ( TIDSortedNodeSet* nodes,
|
||||||
const double theTolerance,
|
const double theTolerance,
|
||||||
std::list< std::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
|
// 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
|
// theTolerance search for all the nodes in nodes
|
||||||
static void FindCoincidentNodes ( std::set<const SMDS_MeshNode*>& nodes,
|
static void FindCoincidentNodes ( TIDSortedNodeSet& nodes,
|
||||||
std::list< std::list< const SMDS_MeshNode*> >* theGroupsOfNodes,
|
std::list< std::list< const SMDS_MeshNode*> >* theGroupsOfNodes,
|
||||||
const double theTolerance = 0.00001,
|
const double theTolerance = 0.00001,
|
||||||
const int maxLevel = -1,
|
const int maxLevel = -1,
|
||||||
@ -118,7 +120,7 @@ protected:
|
|||||||
|
|
||||||
// Return in result a list of nodes closed to Node and remove it from SetOfNodes
|
// Return in result a list of nodes closed to Node and remove it from SetOfNodes
|
||||||
void FindCoincidentNodes( const SMDS_MeshNode * Node,
|
void FindCoincidentNodes( const SMDS_MeshNode * Node,
|
||||||
std::set<const SMDS_MeshNode*>* SetOfNodes,
|
TIDSortedNodeSet* SetOfNodes,
|
||||||
std::list<const SMDS_MeshNode*>* Result,
|
std::list<const SMDS_MeshNode*>* Result,
|
||||||
const double precision);
|
const double precision);
|
||||||
|
|
||||||
@ -126,7 +128,7 @@ protected:
|
|||||||
int myMaxNbNodes;
|
int myMaxNbNodes;
|
||||||
|
|
||||||
// The set of nodes inside the box of the Octree (Empty if Octree is not a leaf)
|
// The set of nodes inside the box of the Octree (Empty if Octree is not a leaf)
|
||||||
std::set<const SMDS_MeshNode*> myNodes;
|
TIDSortedNodeSet myNodes;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user