vector< TOldNewGroup* > orderedOldNewGroups; // in order of old groups
// group names
set< string > groupNames;
-
+
SMESH_Mesh::GroupIteratorPtr groupIt = GetMesh()->GetGroups();
if ( !groupIt->more() ) return newGroupIDs;
}
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() )
* \brief Find elements of given type where the given point is IN or ON.
* Returns nb of found elements and elements them-selves.
*
- * 'ALL' type means elements of any type excluding nodes, balls and 0D elements
+ * 'ALL' type means elements of any type excluding nodes, balls and 0D elements
*/
//=======================================================================
}
TIDSortedElemSet suspectElems;
_ebbTree->getElementsNearPoint( point, suspectElems );
-
+
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;
POS_ALL = POS_LEFT | POS_RIGHT | POS_VERTEX };
struct PointPos
{
- PositionName _name;
+ PositionName _name;
int _index; // index of vertex or segment
PointPos( PositionName n, int i=-1 ): _name(n), _index(i) {}
//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);
groupDS = group->GetGroupDS();
if ( !groupDS || groupDS->IsEmpty() ) continue;
std::string grpName = group->GetName();
+ //MESSAGE("grpName=" << grpName);
if (grpName == groupName)
break;
+ else
+ groupDS = 0;
}
bool isNodeGroup = false;
if (nodesCoords.size() > 0)
isNodeCoords = true; // a list o nodes given by their coordinates
+ //MESSAGE("---" << isNodeGroup << " " << isNodeCoords);
// --- define groups to build