-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
SMDS_MeshGroup::SMDS_MeshGroup(const SMDS_Mesh * theMesh,
const SMDSAbs_ElementType theType)
- : SMDS_ElementHolder( theMesh ), myType(theType), myTic(0)
+ : SMDS_ElementHolder( theMesh ), myType( theType ), myTic( 0 )
{
}
bool SMDS_MeshGroup::Add(const SMDS_MeshElement * theElem)
{
// the type of the group is determined by the first element added
- if (myElements.empty()) {
+ if ( myElements.empty() ) {
myType = theElem->GetType();
}
- else if (theElem->GetType() != myType) {
+ else if ( theElem->GetType() != myType ) {
MESSAGE("SMDS_MeshGroup::Add : Type Mismatch "<<theElem->GetType()<<"!="<<myType);
return false;
}
- myElements.insert(theElem);
+ bool added = myElements.insert( theElem ).second;
+
++myTic;
- return true;
+ return added;
}
//=======================================================================
//purpose :
//=======================================================================
-bool SMDS_MeshGroup::Remove(const SMDS_MeshElement * theElem)
+bool SMDS_MeshGroup::Remove( const SMDS_MeshElement * theElem )
{
TElementSet::iterator found = myElements.find(theElem);
if ( found != myElements.end() ) {
- myElements.erase(found);
- if (myElements.empty()) myType = SMDSAbs_All;
+ myElements.erase( found );
+ if ( myElements.empty() ) myType = SMDSAbs_All;
++myTic;
return true;
}
//=======================================================================
//function : Contains
-//purpose :
+//purpose :
//=======================================================================
bool SMDS_MeshGroup::Contains(const SMDS_MeshElement * theElem) const
{
- return myElements.find(theElem) != myElements.end();
+ return myElements.find( theElem ) != myElements.end();
}
//=======================================================================
void SMDS_MeshGroup::tmpClear()
{
- compact();
myElements.clear();
}