diff --git a/src/SMDS/SMDS_MeshGroup.cxx b/src/SMDS/SMDS_MeshGroup.cxx index 053d917b7..842e6c284 100644 --- a/src/SMDS/SMDS_MeshGroup.cxx +++ b/src/SMDS/SMDS_MeshGroup.cxx @@ -41,7 +41,7 @@ using namespace std; SMDS_MeshGroup::SMDS_MeshGroup(const SMDS_Mesh * theMesh, const SMDSAbs_ElementType theType) - :myMesh(theMesh),myType(theType), myParent(NULL) + :myMesh(theMesh),myType(theType), myParent(NULL), myTic(0) { } @@ -112,8 +112,9 @@ bool SMDS_MeshGroup::RemoveFromParent() void SMDS_MeshGroup::Clear() { - myElements.clear(); - myType = SMDSAbs_All; + myElements.clear(); + myType = SMDSAbs_All; + ++myTic; } //======================================================================= @@ -123,14 +124,15 @@ void SMDS_MeshGroup::Clear() void SMDS_MeshGroup::Add(const SMDS_MeshElement * theElem) { - // the type of the group is determined by the first element added - if (myElements.empty()) myType = theElem->GetType(); - else if (theElem->GetType() != myType) { - MESSAGE("SMDS_MeshGroup::Add : Type Mismatch "<GetType()<<"!="<GetType(); + else if (theElem->GetType() != myType) { + MESSAGE("SMDS_MeshGroup::Add : Type Mismatch "<GetType()<<"!="<::iterator found - = myElements.find(theElem); + set::iterator found = myElements.find(theElem); if ( found != myElements.end() ) { myElements.erase(found); if (myElements.empty()) myType = SMDSAbs_All; + ++myTic; return true; } return false; diff --git a/src/SMDS/SMDS_MeshGroup.hxx b/src/SMDS/SMDS_MeshGroup.hxx index 9f4a5f439..f6166a9ef 100644 --- a/src/SMDS/SMDS_MeshGroup.hxx +++ b/src/SMDS/SMDS_MeshGroup.hxx @@ -50,6 +50,7 @@ class SMDS_EXPORT SMDS_MeshGroup:public SMDS_MeshObject bool Remove(const SMDS_MeshElement * theElem); bool IsEmpty() const { return myElements.empty(); } int Extent() const { return myElements.size(); } + int Tic() const { return myTic; } int SubGroupsNb() const { return myChildren.size(); } @@ -87,5 +88,6 @@ class SMDS_EXPORT SMDS_MeshGroup:public SMDS_MeshObject std::list myChildren; TIterator myIterator; TGroupIterator myGroupIterator; + int myTic; // to track changes }; #endif