From: eap Date: Fri, 23 Nov 2007 10:57:59 +0000 (+0000) Subject: PAL16617 (Modification/Transformation operations with copy don't create a new mesh) X-Git-Tag: V3_2_9rc2~17 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3519f0d02aa972473f2c4df5ff562e50e442e9ee;p=modules%2Fsmesh.git PAL16617 (Modification/Transformation operations with copy don't create a new mesh) + virtual bool Contains (const SMDS_MeshElement* elem); --- diff --git a/src/SMESHDS/SMESHDS_Group.cxx b/src/SMESHDS/SMESHDS_Group.cxx index 1955f56bf..e6b0759c1 100644 --- a/src/SMESHDS/SMESHDS_Group.cxx +++ b/src/SMESHDS/SMESHDS_Group.cxx @@ -77,6 +77,18 @@ bool SMESHDS_Group::Contains (const int theID) return false; } +//======================================================================= +//function : Contains +//purpose : +//======================================================================= + +bool SMESHDS_Group::Contains (const SMDS_MeshElement* elem) +{ + if (elem) + return myGroup.Contains(elem); + return false; +} + //============================================================================= /*! * diff --git a/src/SMESHDS/SMESHDS_Group.hxx b/src/SMESHDS/SMESHDS_Group.hxx index 1541ae851..e73ea5487 100644 --- a/src/SMESHDS/SMESHDS_Group.hxx +++ b/src/SMESHDS/SMESHDS_Group.hxx @@ -49,6 +49,8 @@ class SMESHDS_Group : public SMESHDS_GroupBase virtual bool Contains (const int theID); + virtual bool Contains (const SMDS_MeshElement* elem); + virtual SMDS_ElemIteratorPtr GetElements(); bool Add (const int theID); diff --git a/src/SMESHDS/SMESHDS_GroupBase.cxx b/src/SMESHDS/SMESHDS_GroupBase.cxx index e374b723b..644fbde08 100644 --- a/src/SMESHDS/SMESHDS_GroupBase.cxx +++ b/src/SMESHDS/SMESHDS_GroupBase.cxx @@ -131,12 +131,23 @@ bool SMESHDS_GroupBase::IsEmpty() bool SMESHDS_GroupBase::Contains (const int theID) { - SMDS_ElemIteratorPtr it = GetElements(); - bool contains = false; - if ( it ) - while ( !contains && it->more() ) - contains = ( it->next()->GetID() == theID ); - return contains; + if ( SMDS_ElemIteratorPtr it = GetElements() ) { + while ( it->more() ) + if ( it->next()->GetID() == theID ) + return true; + } + return false; +} + +//======================================================================= +//function : Contains +//purpose : +//======================================================================= + +bool SMESHDS_GroupBase::Contains (const SMDS_MeshElement* elem) +{ + if ( elem ) + return Contains( elem->GetID() ); } //======================================================================= diff --git a/src/SMESHDS/SMESHDS_GroupBase.hxx b/src/SMESHDS/SMESHDS_GroupBase.hxx index d0095dec6..06389f01e 100644 --- a/src/SMESHDS/SMESHDS_GroupBase.hxx +++ b/src/SMESHDS/SMESHDS_GroupBase.hxx @@ -59,6 +59,8 @@ class SMESHDS_GroupBase virtual bool Contains (const int theID); + virtual bool Contains (const SMDS_MeshElement* elem); + virtual SMDS_ElemIteratorPtr GetElements() = 0; int GetID (const int theIndex); diff --git a/src/SMESHDS/SMESHDS_GroupOnGeom.cxx b/src/SMESHDS/SMESHDS_GroupOnGeom.cxx index ede4f0566..f7cb20d39 100644 --- a/src/SMESHDS/SMESHDS_GroupOnGeom.cxx +++ b/src/SMESHDS/SMESHDS_GroupOnGeom.cxx @@ -110,3 +110,14 @@ bool SMESHDS_GroupOnGeom::Contains (const int theID) { return mySubMesh->Contains( findInMesh( theID )); } + +//======================================================================= +//function : Contains +//purpose : +//======================================================================= + +bool SMESHDS_GroupOnGeom::Contains (const SMDS_MeshElement* elem) +{ + return mySubMesh->Contains( elem ); +} + diff --git a/src/SMESHDS/SMESHDS_GroupOnGeom.hxx b/src/SMESHDS/SMESHDS_GroupOnGeom.hxx index bbf2cd35a..f67de30b2 100644 --- a/src/SMESHDS/SMESHDS_GroupOnGeom.hxx +++ b/src/SMESHDS/SMESHDS_GroupOnGeom.hxx @@ -45,6 +45,8 @@ class SMESHDS_GroupOnGeom: public SMESHDS_GroupBase virtual bool Contains (const int theID); + virtual bool Contains (const SMDS_MeshElement* elem); + virtual SMDS_ElemIteratorPtr GetElements(); private: