0021801: EDF 2143 SMESH: random order of groups returned by ExtrusionSweepObject2D

+  SMESH_Group* AddGroup (SMESHDS_GroupBase* groupDS)
This commit is contained in:
eap 2012-08-21 14:13:23 +00:00
parent a22deee34c
commit 110067df8c
2 changed files with 32 additions and 1 deletions

View File

@ -1651,6 +1651,35 @@ SMESH_Group* SMESH_Mesh::AddGroup (const SMDSAbs_ElementType theType,
return aGroup;
}
//================================================================================
/*!
* \brief Creates a group based on an existing SMESHDS group. Group ID should be unique
*/
//================================================================================
SMESH_Group* SMESH_Mesh::AddGroup (SMESHDS_GroupBase* groupDS) throw(SALOME_Exception)
{
if ( !groupDS )
throw SALOME_Exception(LOCALIZED ("SMESH_Mesh::AddGroup(): NULL SMESHDS_GroupBase"));
map <int, SMESH_Group*>::iterator i_g = _mapGroup.find( groupDS->GetID() );
if ( i_g != _mapGroup.end() && i_g->second )
{
if ( i_g->second->GetGroupDS() == groupDS )
return i_g->second;
else
throw SALOME_Exception(LOCALIZED ("SMESH_Mesh::AddGroup() wrong ID of SMESHDS_GroupBase"));
}
SMESH_Group* aGroup = new SMESH_Group (groupDS);
_mapGroup[ groupDS->GetID() ] = aGroup;
GetMeshDS()->AddGroup( aGroup->GetGroupDS() );
_groupId = 1 + _mapGroup.rbegin()->first;
return aGroup;
}
//================================================================================
/*!
* \brief Creates SMESH_Groups for not wrapped SMESHDS_Groups

View File

@ -288,6 +288,8 @@ public:
const TopoDS_Shape& theShape=TopoDS_Shape(),
const SMESH_PredicatePtr& thePredicate=SMESH_PredicatePtr());
SMESH_Group* AddGroup (SMESHDS_GroupBase* groupDS) throw(SALOME_Exception);
typedef boost::shared_ptr< SMDS_Iterator<SMESH_Group*> > GroupIteratorPtr;
GroupIteratorPtr GetGroups() const;