From c9ccfc74e0ad0568e8f42239ec680b0c6ad624f8 Mon Sep 17 00:00:00 2001 From: eap Date: Tue, 14 Jun 2011 13:49:51 +0000 Subject: [PATCH] 0020743: EDF 1271 SMESH : Create a mesh from a group / FindElementByPoint() on groups + int Tic() const { return myTic; } + int myTic; // to track changes --- src/SMDS/SMDS_MeshGroup.cxx | 26 ++++++++++++++------------ src/SMDS/SMDS_MeshGroup.hxx | 2 ++ 2 files changed, 16 insertions(+), 12 deletions(-) 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