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)
{
}
void SMDS_MeshGroup::Clear()
{
- myElements.clear();
- myType = SMDSAbs_All;
+ myElements.clear();
+ myType = SMDSAbs_All;
+ ++myTic;
}
//=======================================================================
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 "<<theElem->GetType()<<"!="<<myType);
- return;
- }
+ // 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 "<<theElem->GetType()<<"!="<<myType);
+ return;
+ }
- myElements.insert(theElem);
+ myElements.insert(theElem);
+ ++myTic;
}
//=======================================================================
bool SMDS_MeshGroup::Remove(const SMDS_MeshElement * theElem)
{
- std::set<const SMDS_MeshElement *>::iterator found
- = myElements.find(theElem);
+ set<const SMDS_MeshElement *>::iterator found = myElements.find(theElem);
if ( found != myElements.end() ) {
myElements.erase(found);
if (myElements.empty()) myType = SMDSAbs_All;
+ ++myTic;
return true;
}
return false;
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(); }
std::list<const SMDS_MeshGroup*> myChildren;
TIterator myIterator;
TGroupIterator myGroupIterator;
+ int myTic; // to track changes
};
#endif