Salome HOME
projects
/
modules
/
smesh.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[HYDRO module - Feature #523] river, channel, embankment meshing
[modules/smesh.git]
/
src
/
SMESHUtils
/
SMESH_OctreeNode.cxx
diff --git
a/src/SMESHUtils/SMESH_OctreeNode.cxx
b/src/SMESHUtils/SMESH_OctreeNode.cxx
index 821812340bb57920f4a870b80b1ede124a241022..6225108bd4b952c865e1e74eb98781906e473dfc 100644
(file)
--- a/
src/SMESHUtils/SMESH_OctreeNode.cxx
+++ b/
src/SMESHUtils/SMESH_OctreeNode.cxx
@@
-1,4
+1,4
@@
-// Copyright (C) 2007-201
2
CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-201
5
CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@
-6,7
+6,7
@@
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License
, or (at your option) any later version
.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
@@
-30,6
+30,7
@@
#include "SMESH_OctreeNode.hxx"
#include "SMDS_SetIterator.hxx"
#include "SMESH_OctreeNode.hxx"
#include "SMDS_SetIterator.hxx"
+#include "SMESH_TypeDefs.hxx"
#include <gp_Pnt.hxx>
using namespace std;
#include <gp_Pnt.hxx>
using namespace std;
@@
-167,7
+168,7
@@
void SMESH_OctreeNode::NodesAround (const SMDS_MeshNode * Node,
list<const SMDS_MeshNode*>* Result,
const double precision)
{
list<const SMDS_MeshNode*>* Result,
const double precision)
{
-
gp_XYZ p(Node->X(), Node->Y(), Node->Z()
);
+
SMESH_TNodeXYZ p(Node
);
if (isInside(p, precision))
{
if (isLeaf())
if (isInside(p, precision))
{
if (isLeaf())
@@
-191,7
+192,7
@@
void SMESH_OctreeNode::NodesAround (const SMDS_MeshNode * Node,
* \param node - node to find nodes closest to
* \param dist2Nodes - map of found nodes and their distances
* \param precision - radius of a sphere to check nodes inside
* \param node - node to find nodes closest to
* \param dist2Nodes - map of found nodes and their distances
* \param precision - radius of a sphere to check nodes inside
- * \retval bool - true if an exact overlapping found
+ * \retval bool - true if an exact overlapping found
!!!
*/
//================================================================================
*/
//================================================================================
@@
-204,7
+205,6
@@
bool SMESH_OctreeNode::NodesAround(const gp_XYZ &node,
else if ( precision == 0. )
precision = maxSize() / 2;
else if ( precision == 0. )
precision = maxSize() / 2;
- //gp_XYZ p(node->X(), node->Y(), node->Z());
if (isInside(node, precision))
{
if (!isLeaf())
if (isInside(node, precision))
{
if (!isLeaf())
@@
-223,19
+223,19
@@
bool SMESH_OctreeNode::NodesAround(const gp_XYZ &node,
else if ( NbNodes() > 0 )
{
double minDist = precision * precision;
else if ( NbNodes() > 0 )
{
double minDist = precision * precision;
- gp_Pnt p1 ( node.X(), node.Y(), node.Z() );
TIDSortedNodeSet::iterator nIt = myNodes.begin();
for ( ; nIt != myNodes.end(); ++nIt )
{
TIDSortedNodeSet::iterator nIt = myNodes.begin();
for ( ; nIt != myNodes.end(); ++nIt )
{
-
gp_Pnt p2 ( (*nIt)->X(), (*nIt)->Y(), (*nIt)->Z()
);
- double dist2 =
p1.SquareDistance( p2
);
+
SMESH_TNodeXYZ p2( *nIt
);
+ double dist2 =
( node - p2 ).SquareModulus(
);
if ( dist2 < minDist )
if ( dist2 < minDist )
- dist2Nodes.insert( make_pair( minDist = dist2,
*nIt
));
+ dist2Nodes.insert( make_pair( minDist = dist2,
p2._node
));
}
// if ( dist2Nodes.size() > 1 ) // leave only closest node in dist2Nodes
// dist2Nodes.erase( ++dist2Nodes.begin(), dist2Nodes.end());
}
// if ( dist2Nodes.size() > 1 ) // leave only closest node in dist2Nodes
// dist2Nodes.erase( ++dist2Nodes.begin(), dist2Nodes.end());
- return ( sqrt( minDist) <= precision * 1e-12 );
+ // true if an exact overlapping found
+ return ( sqrt( minDist ) <= precision * 1e-12 );
}
}
return false;
}
}
return false;
@@
-327,29
+327,27
@@
void SMESH_OctreeNode::FindCoincidentNodes ( TIDSortedNodeSet* theSetOfNodes,
* \param precision - Precision used
*/
//======================================================================================
* \param precision - Precision used
*/
//======================================================================================
-void SMESH_OctreeNode::FindCoincidentNodes (const SMDS_MeshNode * Node,
- TIDSortedNodeSet* SetOfNodes,
+void SMESH_OctreeNode::FindCoincidentNodes (const SMDS_MeshNode *
Node,
+ TIDSortedNodeSet*
SetOfNodes,
list<const SMDS_MeshNode*>* Result,
list<const SMDS_MeshNode*>* Result,
- const double precision)
+ const double
precision)
{
{
- gp_
XYZ p
(Node->X(), Node->Y(), Node->Z());
- bool isInsideBool = isInside(
p, precision
);
+ gp_
Pnt p1
(Node->X(), Node->Y(), Node->Z());
+ bool isInsideBool = isInside(
p1.XYZ(), precision
);
if (isInsideBool)
{
// I'm only looking in the leaves, since all the nodes are stored there.
if (isLeaf())
{
if (isInsideBool)
{
// I'm only looking in the leaves, since all the nodes are stored there.
if (isLeaf())
{
- gp_Pnt p1 (Node->X(), Node->Y(), Node->Z());
-
- TIDSortedNodeSet myNodesCopy = myNodes;
- TIDSortedNodeSet::iterator it = myNodesCopy.begin();
- double tol2 = precision * precision;
+ TIDSortedNodeSet::iterator it = myNodes.begin();
+ const double tol2 = precision * precision;
bool squareBool;
bool squareBool;
- while (it != myNodes
Copy
.end())
+ while (it != myNodes.end())
{
const SMDS_MeshNode* n2 = *it;
{
const SMDS_MeshNode* n2 = *it;
+ squareBool = false;
// We're only looking at nodes with a superior Id.
// JFA: Why?
//if (Node->GetID() < n2->GetID())
// We're only looking at nodes with a superior Id.
// JFA: Why?
//if (Node->GetID() < n2->GetID())
@@
-364,14
+362,13
@@
void SMESH_OctreeNode::FindCoincidentNodes (const SMDS_MeshNode * Node,
{
Result->insert(Result->begin(), n2);
SetOfNodes->erase( n2 );
{
Result->insert(Result->begin(), n2);
SetOfNodes->erase( n2 );
- myNodes.erase(
n2 );
+ myNodes.erase(
*it++ ); // it++ goes forward and returns it's previous position
}
}
}
}
- //myNodesCopy.erase( it );
- //it = myNodesCopy.begin();
- it++;
+ if ( !squareBool )
+ it++;
}
}
- if (
Result->size() > 0
)
+ if (
!Result->empty()
)
myNodes.erase(Node); // JFA: for bug 0020185
}
else
myNodes.erase(Node); // JFA: for bug 0020185
}
else