Salome HOME
PAL16617 (Modification/Transformation operations with copy don't create a new mesh)
authoreap <eap@opencascade.com>
Wed, 19 Dec 2007 15:02:14 +0000 (15:02 +0000)
committereap <eap@opencascade.com>
Wed, 19 Dec 2007 15:02:14 +0000 (15:02 +0000)
+  virtual bool Contains (const SMDS_MeshElement* elem);

src/SMESHDS/SMESHDS_Group.cxx
src/SMESHDS/SMESHDS_Group.hxx
src/SMESHDS/SMESHDS_GroupBase.cxx
src/SMESHDS/SMESHDS_GroupBase.hxx
src/SMESHDS/SMESHDS_GroupOnGeom.cxx
src/SMESHDS/SMESHDS_GroupOnGeom.hxx

index 1955f56bfd2e3f5935ee6d47bbd83a4547d813dc..e6b0759c102fc6bd28e12444294d17d7e23b7023 100644 (file)
@@ -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;
+}
+
 //=============================================================================
 /*!
  *  
index 2d41756a53788cffcde24c0eebb86ee0628c57bd..7f5c98c9ca4e80e180de0365f4a8a8566c94f3c4 100644 (file)
@@ -51,6 +51,8 @@ class SMESHDS_EXPORT 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);
index 5221743a9a6e3087c2ce4c3cd49af071ac2dff53..0b2cad051b5a320f458ac24d518941ece05d25ba 100644 (file)
@@ -132,12 +132,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() );
 }
 
 //=======================================================================
index 7e2d521e0dec5b54cd6ae8b2ff06b2c121ab45f3..dc4714e8af1d3f03ee23b796ab89242f008ed67d 100644 (file)
@@ -63,6 +63,8 @@ class SMESHDS_EXPORT 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);
index ede4f05665ab127ce2c6051d0126127911a73804..f7cb20d39d5767583e7f0ebcf0bcb4d054730beb 100644 (file)
@@ -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 );
+}
+
index eaee815f8be7c5c87b1f04a0bc71419b6b9a1ef8..d2c3a1dc46ea60753dc22374d8bf9e3975591a3f 100644 (file)
@@ -47,6 +47,8 @@ class SMESHDS_EXPORT SMESHDS_GroupOnGeom: public SMESHDS_GroupBase
 
   virtual bool Contains (const int theID);
 
+  virtual bool Contains (const SMDS_MeshElement* elem);
+
   virtual SMDS_ElemIteratorPtr GetElements();
 
  private: