PAL16617 (Modification/Transformation operations with copy don't create a new mesh)

+  virtual bool Contains (const SMDS_MeshElement* elem);
This commit is contained in:
eap 2007-12-19 15:02:14 +00:00
parent 53660eaf43
commit 2e446e7121
6 changed files with 46 additions and 6 deletions

View File

@ -77,6 +77,18 @@ bool SMESHDS_Group::Contains (const int theID)
return false; return false;
} }
//=======================================================================
//function : Contains
//purpose :
//=======================================================================
bool SMESHDS_Group::Contains (const SMDS_MeshElement* elem)
{
if (elem)
return myGroup.Contains(elem);
return false;
}
//============================================================================= //=============================================================================
/*! /*!
* *

View File

@ -51,6 +51,8 @@ class SMESHDS_EXPORT SMESHDS_Group : public SMESHDS_GroupBase
virtual bool Contains (const int theID); virtual bool Contains (const int theID);
virtual bool Contains (const SMDS_MeshElement* elem);
virtual SMDS_ElemIteratorPtr GetElements(); virtual SMDS_ElemIteratorPtr GetElements();
bool Add (const int theID); bool Add (const int theID);

View File

@ -132,12 +132,23 @@ bool SMESHDS_GroupBase::IsEmpty()
bool SMESHDS_GroupBase::Contains (const int theID) bool SMESHDS_GroupBase::Contains (const int theID)
{ {
SMDS_ElemIteratorPtr it = GetElements(); if ( SMDS_ElemIteratorPtr it = GetElements() ) {
bool contains = false; while ( it->more() )
if ( it ) if ( it->next()->GetID() == theID )
while ( !contains && it->more() ) return true;
contains = ( it->next()->GetID() == theID ); }
return contains; return false;
}
//=======================================================================
//function : Contains
//purpose :
//=======================================================================
bool SMESHDS_GroupBase::Contains (const SMDS_MeshElement* elem)
{
if ( elem )
return Contains( elem->GetID() );
} }
//======================================================================= //=======================================================================

View File

@ -63,6 +63,8 @@ class SMESHDS_EXPORT SMESHDS_GroupBase
virtual bool Contains (const int theID); virtual bool Contains (const int theID);
virtual bool Contains (const SMDS_MeshElement* elem);
virtual SMDS_ElemIteratorPtr GetElements() = 0; virtual SMDS_ElemIteratorPtr GetElements() = 0;
int GetID (const int theIndex); int GetID (const int theIndex);

View File

@ -110,3 +110,14 @@ bool SMESHDS_GroupOnGeom::Contains (const int theID)
{ {
return mySubMesh->Contains( findInMesh( theID )); return mySubMesh->Contains( findInMesh( theID ));
} }
//=======================================================================
//function : Contains
//purpose :
//=======================================================================
bool SMESHDS_GroupOnGeom::Contains (const SMDS_MeshElement* elem)
{
return mySubMesh->Contains( elem );
}

View File

@ -47,6 +47,8 @@ class SMESHDS_EXPORT SMESHDS_GroupOnGeom: public SMESHDS_GroupBase
virtual bool Contains (const int theID); virtual bool Contains (const int theID);
virtual bool Contains (const SMDS_MeshElement* elem);
virtual SMDS_ElemIteratorPtr GetElements(); virtual SMDS_ElemIteratorPtr GetElements();
private: private: