if ( ( theMakeGroups && theCopy ) ||
( theMakeGroups && theTargetMesh ) )
- newGroupIDs = generateGroups( srcNodes, srcElems, groupPostfix, theTargetMesh );
+ newGroupIDs = generateGroups( srcNodes, srcElems, groupPostfix, theTargetMesh, false );
return newGroupIDs;
}
//=======================================================================
/*!
* \brief Create groups of elements made during transformation
- * \param nodeGens - nodes making corresponding myLastCreatedNodes
- * \param elemGens - elements making corresponding myLastCreatedElems
- * \param postfix - to append to names of new groups
+ * \param nodeGens - nodes making corresponding myLastCreatedNodes
+ * \param elemGens - elements making corresponding myLastCreatedElems
+ * \param postfix - to append to names of new groups
+ * \param targetMesh - mesh to create groups in
+ * \param topPresent - is there "top" elements that are created by sweeping
*/
//=======================================================================
SMESH_MeshEditor::generateGroups(const SMESH_SequenceOfElemPtr& nodeGens,
const SMESH_SequenceOfElemPtr& elemGens,
const std::string& postfix,
- SMESH_Mesh* targetMesh)
+ SMESH_Mesh* targetMesh,
+ const bool topPresent)
{
PGroupIDs newGroupIDs( new list<int> );
SMESH_Mesh* mesh = targetMesh ? targetMesh : GetMesh();
// Loop on nodes and elements to add them in new groups
- // is there elements of different types generated from one source element;
- // it is false for transformations and true for sweeping
- bool isTwoTypesResult = false;
-
vector< const SMDS_MeshElement* > resultElems;
for ( int isNodes = 0; isNodes < 2; ++isNodes )
{
if ( resElem != sourceElem )
resultElems.push_back( resElem );
- // there must be a top element
const SMDS_MeshElement* topElem = 0;
- if ( isNodes )
+ if ( isNodes ) // there must be a top element
{
topElem = resultElems.back();
resultElems.pop_back();
break;
}
}
-
// add resultElems to groups originted from ones the sourceElem belongs to
list< TOldNewGroup >::iterator gOldNew, gLast = groupsOldNew.end();
for ( gOldNew = groupsOldNew.begin(); gOldNew != gLast; ++gOldNew )
{
SMDS_MeshGroup & newTopGroup = gOldNew->get<2>()->SMDSGroup();
newTopGroup.Add( topElem );
-
- if ( !newGroup.IsEmpty() )
- isTwoTypesResult = true;
- }
+ }
}
}
} // loop on created elements
newGroupDS->SetType( newGroupDS->GetElements()->next()->GetType() );
// make a name
- const bool isTop = ( isTwoTypesResult &&
+ const bool isTop = ( topPresent &&
newGroupDS->GetType() == oldGroupDS->GetType() &&
is2nd );
* \param nodeGens - nodes making corresponding myLastCreatedNodes
* \param elemGens - elements making corresponding myLastCreatedElems
* \param postfix - to append to names of new groups
+ * \param targetMesh - mesh to create groups in
+ * \param topPresent - is there "top" elements that are created by sweeping
*/
PGroupIDs generateGroups(const SMESH_SequenceOfElemPtr& nodeGens,
const SMESH_SequenceOfElemPtr& elemGens,
const std::string& postfix,
- SMESH_Mesh* targetMesh=0);
+ SMESH_Mesh* targetMesh=0,
+ const bool topPresent=true);
/*!
* \brief Create elements by sweeping an element
* \param elem - element to sweep