Salome HOME
PAL16617 (Modification/Transformation operations with copy don't create a new mesh)
authoreap <eap@opencascade.com>
Fri, 23 Nov 2007 10:57:59 +0000 (10:57 +0000)
committereap <eap@opencascade.com>
Fri, 23 Nov 2007 10:57:59 +0000 (10:57 +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 1541ae8518517187f0c19dab14d00656a46c9b4f..e73ea5487bcc0df2ff90db6e20cf999c272333e8 100644 (file)
@@ -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);
index e374b723bdb5024fb167b22c2618da8877ae3309..644fbde080620fbc3db08c65809f50420309f268 100644 (file)
@@ -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() );
 }
 
 //=======================================================================
index d0095dec6e979566a3eae9c84b16941a33f591df..06389f01ef2175aa98895c73d665b67af17d8517 100644 (file)
@@ -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);
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 bbf2cd35aa6e478174a86d965be90ccbc4d0fbda..f67de30b2683c0a548c0c4f1afecbbbeca67dd2b 100644 (file)
@@ -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: