mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-24 16:30:34 +05:00
Bug 0020185: EDF SMESH 967 : Anomaly in Merge Nodes.
This commit is contained in:
parent
7bc441ba31
commit
c113b9f92e
@ -20,11 +20,12 @@
|
|||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
//
|
||||||
// SMESH SMESH_Octree : global Octree implementation
|
// SMESH SMESH_Octree : global Octree implementation
|
||||||
// File : SMESH_Octree.cxx
|
|
||||||
// Created : Tue Jan 16 16:00:00 2007
|
|
||||||
// Author : Nicolas Geimer & Aurélien Motteux(OCC)
|
|
||||||
// Module : SMESH
|
|
||||||
//
|
//
|
||||||
|
// File : SMESH_Octree.cxx
|
||||||
|
// Created : Tue Jan 16 16:00:00 2007
|
||||||
|
// Author : Nicolas Geimer & Aurélien Motteux(OCC)
|
||||||
|
// Module : SMESH
|
||||||
|
|
||||||
#include "SMESH_Octree.hxx"
|
#include "SMESH_Octree.hxx"
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
@ -57,7 +58,7 @@ SMESH_Octree::~SMESH_Octree ()
|
|||||||
{
|
{
|
||||||
for(int i = 0; i<8; i++)
|
for(int i = 0; i<8; i++)
|
||||||
delete myChildren[i];
|
delete myChildren[i];
|
||||||
delete[] myChildren ;
|
delete[] myChildren;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete myBox;
|
delete myBox;
|
||||||
@ -148,10 +149,10 @@ void SMESH_Octree::buildChildren()
|
|||||||
Standard_Real XminChild, YminChild, ZminChild;
|
Standard_Real XminChild, YminChild, ZminChild;
|
||||||
Bnd_B3d* box;
|
Bnd_B3d* box;
|
||||||
gp_XYZ minChild;
|
gp_XYZ minChild;
|
||||||
for (int i =0; i<8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
// We build the eight boxes, we need 2 points to do that.
|
// We build the eight boxes, we need 2 points to do that:
|
||||||
// Min, and Mid
|
// Min and Mid
|
||||||
// In binary, we can write i from 0 to 7
|
// In binary, we can write i from 0 to 7
|
||||||
// For instance :
|
// For instance :
|
||||||
// 5 is 101, it corresponds here in coordinates to ZYX
|
// 5 is 101, it corresponds here in coordinates to ZYX
|
||||||
@ -160,14 +161,14 @@ void SMESH_Octree::buildChildren()
|
|||||||
// Same scheme for X and Z
|
// Same scheme for X and Z
|
||||||
// I need the minChild to build the Bnd_B3d box.
|
// I need the minChild to build the Bnd_B3d box.
|
||||||
|
|
||||||
XminChild= (i%2==0)?min.X():mid.X();
|
XminChild = (i%2==0)?min.X():mid.X();
|
||||||
YminChild= ((i%4)/2==0)?min.Y():mid.Y();
|
YminChild = ((i%4)/2==0)?min.Y():mid.Y();
|
||||||
ZminChild= (i<4)?min.Z():mid.Z();
|
ZminChild = (i<4)?min.Z():mid.Z();
|
||||||
minChild.SetCoord(XminChild, YminChild, ZminChild);
|
minChild.SetCoord(XminChild, YminChild, ZminChild);
|
||||||
|
|
||||||
box = new Bnd_B3d(minChild+childHsize,childHsize);
|
box = new Bnd_B3d(minChild+childHsize,childHsize);
|
||||||
// The child is of the same type than its father (For instance, a SMESH_OctreeNode)
|
// The child is of the same type than its father (For instance, a SMESH_OctreeNode)
|
||||||
// We allocate the memory we need fot the child
|
// We allocate the memory we need for the child
|
||||||
myChildren[i] = allocateOctreeChild();
|
myChildren[i] = allocateOctreeChild();
|
||||||
// and we assign to him its box.
|
// and we assign to him its box.
|
||||||
myChildren[i]->setBox(box);
|
myChildren[i]->setBox(box);
|
||||||
@ -178,6 +179,6 @@ void SMESH_Octree::buildChildren()
|
|||||||
buildChildrenData();
|
buildChildrenData();
|
||||||
|
|
||||||
//After we pass to the next level of the Octree
|
//After we pass to the next level of the Octree
|
||||||
for (int i =0; i<8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
myChildren[i]->Compute();
|
myChildren[i]->Compute();
|
||||||
}
|
}
|
||||||
|
@ -20,11 +20,12 @@
|
|||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
//
|
||||||
// SMESH SMESH_Octree : global Octree implementation
|
// SMESH SMESH_Octree : global Octree implementation
|
||||||
// File : SMESH_Octree.hxx
|
|
||||||
// Created : Tue Jan 16 16:00:00 2007
|
|
||||||
// Author : Nicolas Geimer & Aurélien Motteux (OCC)
|
|
||||||
// Module : SMESH
|
|
||||||
//
|
//
|
||||||
|
// File : SMESH_Octree.hxx
|
||||||
|
// Created : Tue Jan 16 16:00:00 2007
|
||||||
|
// Author : Nicolas Geimer & Aurélien Motteux (OCC)
|
||||||
|
// Module : SMESH
|
||||||
|
|
||||||
#ifndef _SMESH_OCTREE_HXX_
|
#ifndef _SMESH_OCTREE_HXX_
|
||||||
#define _SMESH_OCTREE_HXX_
|
#define _SMESH_OCTREE_HXX_
|
||||||
|
|
||||||
@ -96,4 +97,5 @@ protected:
|
|||||||
// Tell us if the Octree is a leaf or not (-1 if not initialized)
|
// Tell us if the Octree is a leaf or not (-1 if not initialized)
|
||||||
int myIsLeaf;
|
int myIsLeaf;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -21,11 +21,12 @@
|
|||||||
//
|
//
|
||||||
// SMESH SMESH_OctreeNode : Octree with Nodes set
|
// SMESH SMESH_OctreeNode : Octree with Nodes set
|
||||||
// inherites global class SMESH_Octree
|
// inherites global class SMESH_Octree
|
||||||
// File : SMESH_OctreeNode.cxx
|
|
||||||
// Created : Tue Jan 16 16:00:00 2007
|
|
||||||
// Author : Nicolas Geimer & Aurélien Motteux (OCC)
|
|
||||||
// Module : SMESH
|
|
||||||
//
|
//
|
||||||
|
// File : SMESH_OctreeNode.cxx
|
||||||
|
// Created : Tue Jan 16 16:00:00 2007
|
||||||
|
// Author : Nicolas Geimer & Aurélien Motteux (OCC)
|
||||||
|
// Module : SMESH
|
||||||
|
|
||||||
#include "SMESH_OctreeNode.hxx"
|
#include "SMESH_OctreeNode.hxx"
|
||||||
|
|
||||||
#include "SMDS_MeshNode.hxx"
|
#include "SMDS_MeshNode.hxx"
|
||||||
@ -52,7 +53,9 @@ SMESH_OctreeNode::SMESH_OctreeNode (const set<const SMDS_MeshNode*> & theNodes,
|
|||||||
// We need to compute the first bounding box via a special method
|
// We need to compute the first bounding box via a special method
|
||||||
computeBoxForFather();
|
computeBoxForFather();
|
||||||
myNbNodes = myNodes.size();
|
myNbNodes = myNodes.size();
|
||||||
myIsLeaf = (myLevel == myMaxLevel)||(myNbNodes<=myMaxNbNodes)||(myMinBoxSize>=maxSize(myBox));
|
myIsLeaf = ((myLevel == myMaxLevel) ||
|
||||||
|
(myNbNodes <= myMaxNbNodes) ||
|
||||||
|
(maxSize(myBox) <= myMinBoxSize));
|
||||||
// All the children (Boxes and Data) are computed in Compute()
|
// All the children (Boxes and Data) are computed in Compute()
|
||||||
Compute();
|
Compute();
|
||||||
}
|
}
|
||||||
@ -74,19 +77,17 @@ SMESH_Octree* SMESH_OctreeNode::allocateOctreeChild()
|
|||||||
return theOctree;
|
return theOctree;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//======================================
|
//======================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Compute the first bounding box
|
* \brief Compute the first bounding box
|
||||||
*
|
*
|
||||||
* We take the max/min coord of the nodes
|
* We take the max/min coord of the nodes
|
||||||
*/
|
*/
|
||||||
//======================================
|
//======================================
|
||||||
void SMESH_OctreeNode::computeBoxForFather()
|
void SMESH_OctreeNode::computeBoxForFather()
|
||||||
{
|
{
|
||||||
set<const SMDS_MeshNode*>::iterator it=myNodes.begin();
|
set<const SMDS_MeshNode*>::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() );
|
||||||
myBox->Add(p1);
|
myBox->Add(p1);
|
||||||
@ -112,22 +113,21 @@ const bool SMESH_OctreeNode::isLeaf()
|
|||||||
* \retval bool - True if Node is in the box within precision
|
* \retval bool - True if Node is in the box within precision
|
||||||
*/
|
*/
|
||||||
//====================================================================================
|
//====================================================================================
|
||||||
const bool SMESH_OctreeNode::isInside(const SMDS_MeshNode * Node, const double precision )
|
const bool SMESH_OctreeNode::isInside (const SMDS_MeshNode * Node, const double precision)
|
||||||
{
|
{
|
||||||
double X=Node->X();
|
double X = Node->X();
|
||||||
double Y=Node->Y();
|
double Y = Node->Y();
|
||||||
double Z=Node->Z();
|
double Z = Node->Z();
|
||||||
bool Out = 1 ;
|
bool Out = 1 ;
|
||||||
if (precision<=0.)
|
if (precision <= 0.)
|
||||||
return !(myBox->IsOut(gp_XYZ(X,Y,Z)));
|
return !(myBox->IsOut(gp_XYZ(X,Y,Z)));
|
||||||
Bnd_B3d BoxWithPrecision;
|
Bnd_B3d BoxWithPrecision;
|
||||||
getBox(BoxWithPrecision);
|
getBox(BoxWithPrecision);
|
||||||
BoxWithPrecision.Enlarge(precision);
|
BoxWithPrecision.Enlarge(precision);
|
||||||
Out=BoxWithPrecision.IsOut(gp_XYZ(X,Y,Z));
|
Out = BoxWithPrecision.IsOut(gp_XYZ(X,Y,Z));
|
||||||
return !(Out);
|
return !(Out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//================================================
|
//================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Set the data of the children
|
* \brief Set the data of the children
|
||||||
@ -140,22 +140,24 @@ void SMESH_OctreeNode::buildChildrenData()
|
|||||||
gp_XYZ max = myBox->CornerMax();
|
gp_XYZ max = myBox->CornerMax();
|
||||||
gp_XYZ mid = (min + max)/2.;
|
gp_XYZ mid = (min + max)/2.;
|
||||||
|
|
||||||
set<const SMDS_MeshNode*>::iterator it=myNodes.begin();
|
set<const SMDS_MeshNode*>::iterator it = myNodes.begin();
|
||||||
int ChildBoxNum;
|
int ChildBoxNum;
|
||||||
while( it!=myNodes.end())
|
while (it != myNodes.end())
|
||||||
{
|
{
|
||||||
const SMDS_MeshNode* n1 = *it;
|
const SMDS_MeshNode* n1 = *it;
|
||||||
ChildBoxNum= (n1->X()>mid.X()) + (n1->Y()>mid.Y())*2 + (n1->Z()>mid.Z())*4;
|
ChildBoxNum = (n1->X() > mid.X()) + (n1->Y() > mid.Y())*2 + (n1->Z() > mid.Z())*4;
|
||||||
SMESH_OctreeNode* myChild = dynamic_cast<SMESH_OctreeNode*> (myChildren[ChildBoxNum]);
|
SMESH_OctreeNode* myChild = dynamic_cast<SMESH_OctreeNode*> (myChildren[ChildBoxNum]);
|
||||||
myChild->myNodes.insert(myChild->myNodes.end(),n1);
|
myChild->myNodes.insert(myChild->myNodes.end(),n1);
|
||||||
myNodes.erase( it );
|
myNodes.erase( it );
|
||||||
it=myNodes.begin();
|
it = myNodes.begin();
|
||||||
}
|
}
|
||||||
for (int i = 0; i<8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
SMESH_OctreeNode* myChild = dynamic_cast<SMESH_OctreeNode*> (myChildren[i]);
|
SMESH_OctreeNode* myChild = dynamic_cast<SMESH_OctreeNode*> (myChildren[i]);
|
||||||
myChild->myNbNodes = (myChild->myNodes).size();
|
myChild->myNbNodes = (myChild->myNodes).size();
|
||||||
myChild->myIsLeaf = (myChild->myLevel == myMaxLevel)||(myChild->myNbNodes<=myMaxNbNodes)||(myMinBoxSize>=maxSize(myChild->myBox));
|
myChild->myIsLeaf = ((myChild->myLevel == myMaxLevel) ||
|
||||||
|
(myChild->myNbNodes <= myMaxNbNodes) ||
|
||||||
|
(maxSize(myChild->myBox) <= myMinBoxSize));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,80 +169,81 @@ void SMESH_OctreeNode::buildChildrenData()
|
|||||||
* \param Result - list of Nodes potentials to be near Node
|
* \param Result - list of Nodes potentials to be near Node
|
||||||
*/
|
*/
|
||||||
//====================================================================
|
//====================================================================
|
||||||
void SMESH_OctreeNode::NodesAround( const SMDS_MeshNode * Node,
|
void SMESH_OctreeNode::NodesAround (const SMDS_MeshNode * Node,
|
||||||
list<const SMDS_MeshNode*>* Result, const double precision)
|
list<const SMDS_MeshNode*>* Result,
|
||||||
|
const double precision)
|
||||||
{
|
{
|
||||||
if (isInside(Node,precision))
|
if (isInside(Node,precision))
|
||||||
{
|
{
|
||||||
if (myIsLeaf)
|
if (myIsLeaf)
|
||||||
{
|
{
|
||||||
Result->insert( Result->end(), myNodes.begin(), myNodes.end() );
|
Result->insert(Result->end(), myNodes.begin(), myNodes.end());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(int i=0;i<8;i++)
|
for (int i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
SMESH_OctreeNode* myChild = dynamic_cast<SMESH_OctreeNode*> (myChildren[i]);
|
SMESH_OctreeNode* myChild = dynamic_cast<SMESH_OctreeNode*> (myChildren[i]);
|
||||||
myChild->NodesAround( Node, Result, precision);
|
myChild->NodesAround(Node, Result, precision);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=============================
|
//=============================
|
||||||
/*!
|
/*!
|
||||||
* \brief Return in theGroupsOfNodes a list of group of nodes close to each other within theTolerance
|
* \brief 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 theSetOfNodes
|
||||||
* Static Method : no need to create an SMESH_OctreeNode
|
* Static Method : no need to create an SMESH_OctreeNode
|
||||||
* \param nodes - set of nodes we look at, modified during research
|
* \param theSetOfNodes - set of nodes we look at, modified during research
|
||||||
* \param theGroupsOfNodes - list of nodes closed to each other returned
|
* \param theGroupsOfNodes - list of nodes closed to each other returned
|
||||||
* \param theTolerance - Precision used, default value is 0.00001
|
* \param theTolerance - Precision used, default value is 0.00001
|
||||||
* \param maxLevel - Maximum level for SMESH_OctreeNode constructed, default value is -1 (Infinite)
|
* \param maxLevel - Maximum level for SMESH_OctreeNode constructed, default value is -1 (Infinite)
|
||||||
* \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*> nodes,
|
void SMESH_OctreeNode::FindCoincidentNodes (set<const SMDS_MeshNode*> theSetOfNodes,
|
||||||
list< list< const SMDS_MeshNode*> >* theGroupsOfNodes,
|
list< list< const SMDS_MeshNode*> >* theGroupsOfNodes,
|
||||||
const double theTolerance, const int maxLevel,
|
const double theTolerance,
|
||||||
const int maxNbNodes)
|
const int maxLevel,
|
||||||
|
const int maxNbNodes)
|
||||||
{
|
{
|
||||||
SMESH_OctreeNode* theOctreeNode = new SMESH_OctreeNode(nodes, maxLevel, maxNbNodes, theTolerance);
|
SMESH_OctreeNode* theOctreeNode = new SMESH_OctreeNode(theSetOfNodes, maxLevel, maxNbNodes, theTolerance);
|
||||||
theOctreeNode->FindCoincidentNodes (&nodes, theTolerance, theGroupsOfNodes);
|
theOctreeNode->FindCoincidentNodes (&theSetOfNodes, theTolerance, theGroupsOfNodes);
|
||||||
delete theOctreeNode;
|
delete theOctreeNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=============================
|
//=============================
|
||||||
/*!
|
/*!
|
||||||
* \brief Return in theGroupsOfNodes a list of group of nodes close to each other within theTolerance
|
* \brief 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 theSetOfNodes
|
||||||
* \param nodes - set of nodes we look at, modified during research
|
* \note The Octree itself is also modified by this method
|
||||||
|
* \param theSetOfNodes - set of nodes we look at, modified during research
|
||||||
* \param theTolerance - Precision used
|
* \param theTolerance - Precision used
|
||||||
* \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*>* nodes,
|
void SMESH_OctreeNode::FindCoincidentNodes ( set<const SMDS_MeshNode*>* 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 = nodes->begin();
|
set<const SMDS_MeshNode*>::iterator it1 = theSetOfNodes->begin();
|
||||||
list<const SMDS_MeshNode*>::iterator it2;
|
list<const SMDS_MeshNode*>::iterator it2;
|
||||||
|
|
||||||
while (it1 != nodes->end())
|
while (it1 != theSetOfNodes->end())
|
||||||
{
|
{
|
||||||
const SMDS_MeshNode * n1 = *it1;
|
const SMDS_MeshNode * n1 = *it1;
|
||||||
|
|
||||||
list<const SMDS_MeshNode*> ListofCoincidentNodes;// Initialize the lists via a declaration, it's enough
|
list<const SMDS_MeshNode*> ListOfCoincidentNodes;// Initialize the lists via a declaration, it's enough
|
||||||
|
|
||||||
list<const SMDS_MeshNode*> * groupPtr = 0;
|
list<const SMDS_MeshNode*> * groupPtr = 0;
|
||||||
|
|
||||||
// Searching for Nodes around n1 and put them in ListofCoincidentNodes
|
// Searching for Nodes around n1 and put them in ListofCoincidentNodes.
|
||||||
FindCoincidentNodes(n1, nodes, &ListofCoincidentNodes, theTolerance);
|
// Found nodes are also erased from theSetOfNodes
|
||||||
|
FindCoincidentNodes(n1, theSetOfNodes, &ListOfCoincidentNodes, theTolerance);
|
||||||
|
|
||||||
// We build a list {n1 + his neigbours} and add this list in theGroupsOfNodes
|
// We build a list {n1 + his neigbours} and add this list in theGroupsOfNodes
|
||||||
for (it2=ListofCoincidentNodes.begin();it2 != ListofCoincidentNodes.end(); it2++)
|
for (it2 = ListOfCoincidentNodes.begin(); it2 != ListOfCoincidentNodes.end(); it2++)
|
||||||
{
|
{
|
||||||
const SMDS_MeshNode* n2 = *it2;
|
const SMDS_MeshNode* n2 = *it2;
|
||||||
if ( !groupPtr )
|
if ( !groupPtr )
|
||||||
@ -249,29 +252,30 @@ void SMESH_OctreeNode::FindCoincidentNodes ( set<const SMDS_MeshNode*>* nodes,
|
|||||||
groupPtr = & theGroupsOfNodes->back();
|
groupPtr = & theGroupsOfNodes->back();
|
||||||
groupPtr->push_back( n1 );
|
groupPtr->push_back( n1 );
|
||||||
}
|
}
|
||||||
if(groupPtr->front()>n2)
|
if (groupPtr->front() > n2)
|
||||||
groupPtr->push_front( n2 );
|
groupPtr->push_front( n2 );
|
||||||
else
|
else
|
||||||
groupPtr->push_back( n2 );
|
groupPtr->push_back( n2 );
|
||||||
}
|
}
|
||||||
if(groupPtr != 0)
|
if (groupPtr != 0)
|
||||||
groupPtr->sort();
|
groupPtr->sort();
|
||||||
|
|
||||||
nodes->erase(it1);
|
theSetOfNodes->erase(it1);
|
||||||
it1=nodes->begin();
|
it1 = theSetOfNodes->begin();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//======================================================================================
|
//======================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Return a list of nodes closed to Node and remove it from SetOfNodes
|
* \brief Return a list of nodes closed to Node and remove it from SetOfNodes
|
||||||
|
* \note The Octree itself is also modified by this method
|
||||||
* \param Node - We're searching the nodes next to him.
|
* \param Node - We're searching the nodes next to him.
|
||||||
* \param SetOfNodes - set of nodes in which we erase the found nodes
|
* \param SetOfNodes - set of nodes in which we erase the found nodes
|
||||||
* \param Result - list of nodes closed to Node
|
* \param Result - list of nodes closed to Node
|
||||||
* \param precision - Precision used
|
* \param precision - Precision used
|
||||||
*/
|
*/
|
||||||
//======================================================================================
|
//======================================================================================
|
||||||
void SMESH_OctreeNode::FindCoincidentNodes( const SMDS_MeshNode * Node,
|
void SMESH_OctreeNode::FindCoincidentNodes (const SMDS_MeshNode * Node,
|
||||||
set<const SMDS_MeshNode*>* SetOfNodes,
|
set<const SMDS_MeshNode*>* SetOfNodes,
|
||||||
list<const SMDS_MeshNode*>* Result,
|
list<const SMDS_MeshNode*>* Result,
|
||||||
const double precision)
|
const double precision)
|
||||||
@ -283,7 +287,7 @@ void SMESH_OctreeNode::FindCoincidentNodes( const SMDS_MeshNode * Node,
|
|||||||
// I'm only looking in the leaves, since all the nodes are stored there.
|
// I'm only looking in the leaves, since all the nodes are stored there.
|
||||||
if (myIsLeaf)
|
if (myIsLeaf)
|
||||||
{
|
{
|
||||||
gp_Pnt p1( Node->X(), Node->Y(), Node->Z() );
|
gp_Pnt p1 (Node->X(), Node->Y(), Node->Z());
|
||||||
|
|
||||||
set<const SMDS_MeshNode*> myNodesCopy = myNodes;
|
set<const SMDS_MeshNode*> myNodesCopy = myNodes;
|
||||||
set<const SMDS_MeshNode*>::iterator it = myNodesCopy.begin();
|
set<const SMDS_MeshNode*>::iterator it = myNodesCopy.begin();
|
||||||
@ -294,32 +298,36 @@ void SMESH_OctreeNode::FindCoincidentNodes( const SMDS_MeshNode * Node,
|
|||||||
{
|
{
|
||||||
const SMDS_MeshNode* n2 = *it;
|
const SMDS_MeshNode* n2 = *it;
|
||||||
// We're only looking at nodes with a superior Id.
|
// We're only looking at nodes with a superior Id.
|
||||||
if(Node->GetID() < n2->GetID())
|
// JFA: Why?
|
||||||
|
//if (Node->GetID() < n2->GetID())
|
||||||
|
if (Node->GetID() != n2->GetID()) // JFA: for bug 0020185
|
||||||
{
|
{
|
||||||
gp_Pnt p2( n2->X(), n2->Y(), n2->Z() );
|
gp_Pnt p2 (n2->X(), n2->Y(), n2->Z());
|
||||||
// Distance optimized computation
|
// Distance optimized computation
|
||||||
squareBool = (p1.SquareDistance( p2 ) <= tol2);
|
squareBool = (p1.SquareDistance( p2 ) <= tol2);
|
||||||
|
|
||||||
// If n2 inside the SquareDistance, we add it in Result and remove it from SetOfNodes and myNodes
|
// If n2 inside the SquareDistance, we add it in Result and remove it from SetOfNodes and myNodes
|
||||||
if(squareBool)
|
if (squareBool)
|
||||||
{
|
{
|
||||||
Result->insert(Result->begin(), n2);
|
Result->insert(Result->begin(), n2);
|
||||||
SetOfNodes->erase( n2 );
|
SetOfNodes->erase( n2 );
|
||||||
myNodes.erase( n2 );
|
myNodes.erase( n2 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
myNodesCopy.erase( it );
|
//myNodesCopy.erase( it );
|
||||||
it = myNodesCopy.begin();
|
//it = myNodesCopy.begin();
|
||||||
|
it++;
|
||||||
}
|
}
|
||||||
|
if (Result->size() > 0)
|
||||||
|
myNodes.erase(Node); // JFA: for bug 0020185
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// If I'm not a leaf, I'm going to see my children !
|
// If I'm not a leaf, I'm going to see my children !
|
||||||
for(int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
SMESH_OctreeNode* myChild = dynamic_cast<SMESH_OctreeNode*> (myChildren[i]);
|
SMESH_OctreeNode* myChild = dynamic_cast<SMESH_OctreeNode*> (myChildren[i]);
|
||||||
myChild->FindCoincidentNodes(Node, SetOfNodes, Result, precision);
|
myChild->FindCoincidentNodes(Node, SetOfNodes, Result, precision);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -330,7 +338,6 @@ void SMESH_OctreeNode::FindCoincidentNodes( const SMDS_MeshNode * Node,
|
|||||||
* \brief Return iterator over children
|
* \brief Return iterator over children
|
||||||
*/
|
*/
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
|
||||||
SMESH_OctreeNodeIteratorPtr SMESH_OctreeNode::GetChildrenIterator()
|
SMESH_OctreeNodeIteratorPtr SMESH_OctreeNode::GetChildrenIterator()
|
||||||
{
|
{
|
||||||
return SMESH_OctreeNodeIteratorPtr
|
return SMESH_OctreeNodeIteratorPtr
|
||||||
@ -343,7 +350,6 @@ SMESH_OctreeNodeIteratorPtr SMESH_OctreeNode::GetChildrenIterator()
|
|||||||
* \brief Return nodes iterator
|
* \brief Return nodes iterator
|
||||||
*/
|
*/
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
|
||||||
SMDS_NodeIteratorPtr SMESH_OctreeNode::GetNodeIterator()
|
SMDS_NodeIteratorPtr SMESH_OctreeNode::GetNodeIterator()
|
||||||
{
|
{
|
||||||
return SMDS_NodeIteratorPtr
|
return SMDS_NodeIteratorPtr
|
||||||
|
@ -21,11 +21,12 @@
|
|||||||
//
|
//
|
||||||
// SMESH SMESH_OctreeNode : Octree with Nodes set
|
// SMESH SMESH_OctreeNode : Octree with Nodes set
|
||||||
// inherites global class SMESH_Octree
|
// 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
|
|
||||||
//
|
//
|
||||||
|
// 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_
|
#ifndef _SMESH_OCTREENODE_HXX_
|
||||||
#define _SMESH_OCTREENODE_HXX_
|
#define _SMESH_OCTREENODE_HXX_
|
||||||
|
|
||||||
@ -49,7 +50,7 @@ public:
|
|||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
SMESH_OctreeNode (const std::set<const SMDS_MeshNode*>& theNodes, const int maxLevel = -1,
|
SMESH_OctreeNode (const std::set<const SMDS_MeshNode*>& theNodes, const int maxLevel = -1,
|
||||||
const int maxNbNodes = 5 , const double minBoxSize = 0.);
|
const int maxNbNodes = 5, const double minBoxSize = 0.);
|
||||||
|
|
||||||
//=============================
|
//=============================
|
||||||
/*!
|
/*!
|
||||||
@ -62,11 +63,12 @@ public:
|
|||||||
virtual const bool isLeaf();
|
virtual const bool isLeaf();
|
||||||
|
|
||||||
// Tells us if Node is inside the current box with the precision "precision"
|
// 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
|
// Return in Result a list of Nodes potentials to be near Node
|
||||||
void NodesAround( const SMDS_MeshNode * Node , std::list<const SMDS_MeshNode*>* Result,
|
void NodesAround(const SMDS_MeshNode * Node,
|
||||||
const double precision = 0. );
|
std::list<const SMDS_MeshNode*>* Result,
|
||||||
|
const double precision = 0.);
|
||||||
|
|
||||||
// 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
|
||||||
@ -126,4 +128,5 @@ protected:
|
|||||||
// The number of nodes I have inside the box
|
// The number of nodes I have inside the box
|
||||||
int myNbNodes;
|
int myNbNodes;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user