-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2010 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
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's classes
// File : SMESH_Group_i.cxx
// Author : Sergey ANIKIN, OCC
SMDSAbs_ElementType aSMDSType = aGroupDS->GetType();
SMESH::ElementType aType;
switch (aSMDSType) {
- case SMDSAbs_Node: aType = SMESH::NODE; break;
- case SMDSAbs_Edge: aType = SMESH::EDGE; break;
- case SMDSAbs_Face: aType = SMESH::FACE; break;
- case SMDSAbs_Volume: aType = SMESH::VOLUME; break;
- default: aType = SMESH::ALL; break;
+ case SMDSAbs_Node: aType = SMESH::NODE; break;
+ case SMDSAbs_Edge: aType = SMESH::EDGE; break;
+ case SMDSAbs_Face: aType = SMESH::FACE; break;
+ case SMDSAbs_Volume: aType = SMESH::VOLUME; break;
+ case SMDSAbs_0DElement: aType = SMESH::ELEM0D; break;
+ default: aType = SMESH::ALL; break;
}
return aType;
}
CORBA::Long
ChangeByPredicate( SMESH::Predicate_i* thePredicate,
- SMESHDS_GroupBase* theGroupBase,
- TFunChangeGroup theFun)
+ SMESHDS_GroupBase* theGroupBase,
+ TFunChangeGroup theFun)
{
CORBA::Long aNb = 0;
if(SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>(theGroupBase)){
CORBA::Long i = 0, iEnd = aSequence.size();
for(; i < iEnd; i++)
if((aGroupDS->*theFun)(aSequence[i]))
- aNb++;
+ aNb++;
return aNb;
}
return aNb;
return 0;
}
+CORBA::Long SMESH_Group_i::AddFrom( SMESH::SMESH_IDSource_ptr theSource )
+{
+ long nbAdd = 0;
+ SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( GetGroupDS() );
+ if (aGroupDS) {
+ SMESH::long_array_var anIds;
+ if ( !CORBA::is_nil(SMESH::SMESH_GroupBase::_narrow(theSource)) &&
+ SMESH::SMESH_GroupBase::_narrow(theSource)->GetType() == GetType() ) {
+ anIds = theSource->GetIDs();
+ }
+ else if ( !CORBA::is_nil(SMESH::SMESH_Mesh::_narrow(theSource)) ) {
+ anIds = SMESH::SMESH_Mesh::_narrow(theSource)->GetElementsByType( GetType() );
+ }
+ else if ( !CORBA::is_nil(SMESH::SMESH_subMesh::_narrow(theSource)) ) {
+ anIds = SMESH::SMESH_subMesh::_narrow(theSource)->GetElementsByType( GetType() );
+ }
+ else {
+ anIds->length( 0 );
+ }
+ for ( int i = 0, total = anIds->length(); i < total; i++ ) {
+ if ( aGroupDS->Add((int)anIds[i]) ) nbAdd++;
+ }
+ }
+
+ // Update Python script
+ TPythonDump() << "nbAdd = " << _this() << ".AddFrom( " << theSource << " )";
+
+ return nbAdd;
+}
+
//=============================================================================
/*!
*