- TGroupNamesMap aGroupNames = myReader.GetGroupNamesMap();
- aGroup->InitSubGroupsIterator();
- while (aGroup->MoreSubGroups())
- {
- SMDS_MeshGroup* aSubGroup = (SMDS_MeshGroup*) aGroup->NextSubGroup();
- string aName = aGroupNames[aSubGroup];
- int aId;
- if ( SMESH_Group* aSMESHGroup = AddGroup( aSubGroup->GetType(), aName.c_str(), aId ))
- {
- SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( aSMESHGroup->GetGroupDS() );
- if ( aGroupDS ) {
- aGroupDS->SetStoreName(aName.c_str());
- aSubGroup->InitIterator();
- const SMDS_MeshElement* aElement = 0;
- while ( aSubGroup->More() )
- if (( aElement = aSubGroup->Next() ))
- aGroupDS->SMDSGroup().Add( aElement );
-
- if (aElement)
- aGroupDS->SetType( aElement->GetType() );
- }
- }
- }
+ SMDS_MeshGroup* aGroup = gr2names->first;
+ const std::string& aName = gr2names->second;
+ SMESHDS_Group* aGroupDS = new SMESHDS_Group( anId++, _myMeshDS, aGroup->GetType() );
+ aGroupDS->SMDSGroup() = std::move( *aGroup );
+ aGroupDS->SetStoreName( aName.c_str() );
+ AddGroup( aGroupDS );