X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHDS%2FSMESHDS_GroupBase.cxx;h=89542aded12723b5e7ed9ba4dab172a9052c2971;hp=818c52009306bfed4f4b76d5096f4f8543377c49;hb=refs%2Ftags%2FV9_7_0a1;hpb=c98d9fcd7f02c1f1f5c24dd3e709ed75228d66c4 diff --git a/src/SMESHDS/SMESHDS_GroupBase.cxx b/src/SMESHDS/SMESHDS_GroupBase.cxx index 818c52009..89542aded 100644 --- a/src/SMESHDS/SMESHDS_GroupBase.cxx +++ b/src/SMESHDS/SMESHDS_GroupBase.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -51,11 +51,11 @@ SMESHDS_GroupBase::SMESHDS_GroupBase (const int theID, //============================================================================= /*! - * + * Don't use it! */ //============================================================================= -int SMESHDS_GroupBase::GetID (const int theIndex) +smIdType SMESHDS_GroupBase::GetID (const int theIndex) { if (myCurIndex < 1 || myCurIndex > theIndex) { myIterator = GetElements(); @@ -75,7 +75,7 @@ int SMESHDS_GroupBase::GetID (const int theIndex) */ //============================================================================= -const SMDS_MeshElement* SMESHDS_GroupBase::findInMesh (const int theID) const +const SMDS_MeshElement* SMESHDS_GroupBase::findInMesh (const smIdType theID) const { SMDSAbs_ElementType aType = GetType(); const SMDS_MeshElement* aElem = NULL; @@ -107,10 +107,10 @@ void SMESHDS_GroupBase::resetIterator() //purpose : //======================================================================= -int SMESHDS_GroupBase::Extent() const +smIdType SMESHDS_GroupBase::Extent() const { SMDS_ElemIteratorPtr it = GetElements(); - int nb = 0; + smIdType nb = 0; if ( it ) for ( ; it->more(); it->next() ) nb++; @@ -124,6 +124,9 @@ int SMESHDS_GroupBase::Extent() const bool SMESHDS_GroupBase::IsEmpty() { + if ( myMesh->GetMeshInfo().NbElements( myType ) == 0 ) + // avoid long iteration over sub-meshes of a complex sub-mesh of a group on geometry + return true; SMDS_ElemIteratorPtr it = GetElements(); return ( !it || !it->more() ); } @@ -133,7 +136,7 @@ bool SMESHDS_GroupBase::IsEmpty() //purpose : //======================================================================= -bool SMESHDS_GroupBase::Contains (const int theID) +bool SMESHDS_GroupBase::Contains (const smIdType theID) { if ( SMDS_ElemIteratorPtr it = GetElements() ) { while ( it->more() )