}
else if ( tree->NbNodes() ) // put a tree to the treeMap
{
- const Bnd_B3d& box = tree->getBox();
+ const Bnd_B3d& box = *tree->getBox();
double sqDist = thePnt.SquareDistance( 0.5 * ( box.CornerMin() + box.CornerMax() ));
pair<TDistTreeMap::iterator,bool> it_in = treeMap.insert( make_pair( sqDist, tree ));
if ( !it_in.second ) // not unique distance to box center
TDistTreeMap::iterator sqDist_tree = treeMap.begin();
if ( treeMap.size() > 5 ) {
SMESH_OctreeNode* closestTree = sqDist_tree->second;
- const Bnd_B3d& box = closestTree->getBox();
+ const Bnd_B3d& box = *closestTree->getBox();
double limit = sqrt( sqDist_tree->first ) + sqrt ( box.SquareExtent() );
sqLimit = limit * limit;
}
protected:
ElementBndBoxTree():_size(0) {}
- SMESH_Octree* allocateOctreeChild() const { return new ElementBndBoxTree; }
+ SMESH_Octree* newChild() const { return new ElementBndBoxTree; }
void buildChildrenData();
Bnd_B3d* buildRootBox();
private:
//================================================================================
ElementBndBoxTree::ElementBndBoxTree(const SMDS_Mesh& mesh, SMDSAbs_ElementType elemType, SMDS_ElemIteratorPtr theElemIt, double tolerance)
- :SMESH_Octree( new SMESH_Octree::Limit( MaxLevel, /*minSize=*/0. ))
+ :SMESH_Octree( new SMESH_TreeLimit( MaxLevel, /*minSize=*/0. ))
{
int nbElems = mesh.GetMeshInfo().NbElements( elemType );
_elements.reserve( nbElems );
{
for (int j = 0; j < 8; j++)
{
- if ( !_elements[i]->IsOut( myChildren[j]->getBox() ))
+ if ( !_elements[i]->IsOut( *myChildren[j]->getBox() ))
{
_elements[i]->_refCount++;
((ElementBndBoxTree*)myChildren[j])->_elements.push_back( _elements[i]);
void ElementBndBoxTree::getElementsNearPoint( const gp_Pnt& point,
TIDSortedElemSet& foundElems)
{
- if ( getBox().IsOut( point.XYZ() ))
+ if ( getBox()->IsOut( point.XYZ() ))
return;
if ( isLeaf() )
void ElementBndBoxTree::getElementsNearLine( const gp_Ax1& line,
TIDSortedElemSet& foundElems)
{
- if ( getBox().IsOut( line ))
+ if ( getBox()->IsOut( line ))
return;
if ( isLeaf() )
const double radius,
TIDSortedElemSet& foundElems)
{
- if ( getBox().IsOut( center, radius ))
+ if ( getBox()->IsOut( center, radius ))
return;
if ( isLeaf() )
if ( suspectElems.empty() && _ebbTree->maxSize() > 0 )
{
- gp_Pnt boxCenter = 0.5 * ( _ebbTree->getBox().CornerMin() +
- _ebbTree->getBox().CornerMax() );
+ gp_Pnt boxCenter = 0.5 * ( _ebbTree->getBox()->CornerMin() +
+ _ebbTree->getBox()->CornerMax() );
double radius;
- if ( _ebbTree->getBox().IsOut( point.XYZ() ))
+ if ( _ebbTree->getBox()->IsOut( point.XYZ() ))
radius = point.Distance( boxCenter ) - 0.5 * _ebbTree->maxSize();
else
radius = _ebbTree->maxSize() / pow( 2., _ebbTree->getHeight()) / 2;
//purpose : Return list of group of elements built on the same nodes.
// Search among theElements or in the whole mesh if theElements is empty
//=======================================================================
-void SMESH_MeshEditor::FindEqualElements(set<const SMDS_MeshElement*> & theElements,
- TListOfListOfElementsID & theGroupsOfElementsID)
+void SMESH_MeshEditor::FindEqualElements(TIDSortedElemSet & theElements,
+ TListOfListOfElementsID & theGroupsOfElementsID)
{
myLastCreatedElems.Clear();
myLastCreatedNodes.Clear();
- typedef set<const SMDS_MeshElement*> TElemsSet;
typedef map< SortableElement, int > TMapOfNodeSet;
typedef list<int> TGroupOfElems;
- TElemsSet elems;
if ( theElements.empty() )
{ // get all elements in the mesh
SMDS_ElemIteratorPtr eIt = GetMeshDS()->elementsIterator();
while ( eIt->more() )
- elems.insert( elems.end(), eIt->next());
+ theElements.insert( theElements.end(), eIt->next());
}
- else
- elems = theElements;
vector< TGroupOfElems > arrayOfGroups;
TGroupOfElems groupOfElems;
TMapOfNodeSet mapOfNodeSet;
- TElemsSet::iterator elemIt = elems.begin();
- for ( int i = 0, j=0; elemIt != elems.end(); ++elemIt, ++j ) {
+ TIDSortedElemSet::iterator elemIt = theElements.begin();
+ for ( int i = 0, j=0; elemIt != theElements.end(); ++elemIt, ++j ) {
const SMDS_MeshElement* curElem = *elemIt;
SortableElement SE(curElem);
int ind = -1;
void SMESH_MeshEditor::MergeEqualElements()
{
- set<const SMDS_MeshElement*> aMeshElements; /* empty input -
- to merge equal elements in the whole mesh */
+ TIDSortedElemSet aMeshElements; /* empty input ==
+ to merge equal elements in the whole mesh */
TListOfListOfElementsID aGroupsOfElementsID;
FindEqualElements(aMeshElements, aGroupsOfElementsID);
MergeElements(aGroupsOfElementsID);
SMESH_Mesh* theTargetMesh=0);
// Move or copy theElements applying theTrsf to their nodes
-
- typedef std::list< std::list< const SMDS_MeshNode* > > TListOfListOfNodes;
-
- void FindCoincidentNodes (TIDSortedNodeSet & theNodes,
- const double theTolerance,
- TListOfListOfNodes & theGroupsOfNodes);
- // Return list of group of nodes close to each other within theTolerance.
- // Search among theNodes or in the whole mesh if theNodes is empty.
-
/*!
* \brief Return SMESH_NodeSearcher. The caller is responsible for deleteing it
*/
*/
SMESH_ElementSearcher* GetElementSearcher();
SMESH_ElementSearcher* GetElementSearcher( SMDS_ElemIteratorPtr elemIt );
- /*!
- * \brief Return true if the point is IN or ON of the element
- */
- static bool IsOut( const SMDS_MeshElement* element, const gp_Pnt& point, double tol );
- static double GetDistance( const SMDS_MeshFace* face, const gp_Pnt& point );
+ typedef std::list< std::list< const SMDS_MeshNode* > > TListOfListOfNodes;
- int SimplifyFace (const std::vector<const SMDS_MeshNode *> faceNodes,
- std::vector<const SMDS_MeshNode *>& poly_nodes,
- std::vector<int>& quantities) const;
- // Split face, defined by <faceNodes>, into several faces by repeating nodes.
- // Is used by MergeNodes()
+ void FindCoincidentNodes (TIDSortedNodeSet & theNodes,
+ const double theTolerance,
+ TListOfListOfNodes & theGroupsOfNodes);
+ // Return list of group of nodes close to each other within theTolerance.
+ // Search among theNodes or in the whole mesh if theNodes is empty.
void MergeNodes (TListOfListOfNodes & theNodeGroups);
// In each group, the cdr of nodes are substituted by the first one
typedef std::list< std::list< int > > TListOfListOfElementsID;
- void FindEqualElements(std::set<const SMDS_MeshElement*> & theElements,
- TListOfListOfElementsID & theGroupsOfElementsID);
+ void FindEqualElements(TIDSortedElemSet & theElements,
+ TListOfListOfElementsID & theGroupsOfElementsID);
// Return list of group of elements build on the same nodes.
// Search among theElements or in the whole mesh if theElements is empty.
// Remove all but one of elements built on the same nodes.
// Return nb of successfully merged groups.
+ /*!
+ * \brief Return true if the point is IN or ON of the element
+ */
+ static bool IsOut( const SMDS_MeshElement* element, const gp_Pnt& point, double tol );
+
+ static double GetDistance( const SMDS_MeshFace* face, const gp_Pnt& point );
+
+ int SimplifyFace (const std::vector<const SMDS_MeshNode *> faceNodes,
+ std::vector<const SMDS_MeshNode *>& poly_nodes,
+ std::vector<int>& quantities) const;
+ // Split face, defined by <faceNodes>, into several faces by repeating nodes.
+ // Is used by MergeNodes()
+
static bool CheckFreeBorderNodes(const SMDS_MeshNode* theNode1,
const SMDS_MeshNode* theNode2,
const SMDS_MeshNode* theNode3 = 0);