#include <SMESH_Group_i.hxx>

Public Member Functions | |
| SMESH_Group_i (PortableServer::POA_ptr thePOA, SMESH_Mesh_i *theMeshServant, const int theLocalID) | |
| void | Clear () |
| CORBA::Long | Add (const SMESH::long_array &theIDs) |
| CORBA::Long | Remove (const SMESH::long_array &theIDs) |
| CORBA::Long | AddByPredicate (SMESH::Predicate_ptr thePredicate) |
| CORBA::Long | RemoveByPredicate (SMESH::Predicate_ptr thePredicate) |
| CORBA::Long | AddFrom (SMESH::SMESH_IDSource_ptr theSource) |
| void | SetName (const char *name) |
| char * | GetName () |
| SMESH::ElementType | GetType () |
| CORBA::Long | Size () |
| CORBA::Boolean | IsEmpty () |
| CORBA::Boolean | Contains (CORBA::Long elem_id) |
| CORBA::Long | GetID (CORBA::Long elem_index) |
| SMESH::long_array * | GetListOfID () |
| SMESH::SMESH_Mesh_ptr | GetMesh () |
| virtual SMESH::long_array * | GetMeshInfo () |
| Returns statistic of mesh elements Result array of number enityties Inherited from SMESH_IDSource. | |
| virtual SMESH::long_array * | GetIDs () |
| virtual SMESH::array_of_ElementType * | GetTypes () |
| Returns types of elements it contains Inherited from SMESH_IDSource interface. | |
| int | GetLocalID () const |
| SMESH_Mesh_i * | GetMeshServant () const |
| SMESH_Group * | GetSmeshGroup () const |
| SMESHDS_GroupBase * | GetGroupDS () const |
| void | SetColor (const SALOMEDS::Color &color) |
| SALOMEDS::Color | GetColor () |
| void | SetColorNumber (CORBA::Long color) |
| CORBA::Long | GetColorNumber () |
Definition at line 108 of file SMESH_Group_i.hxx.
| SMESH_Group_i::SMESH_Group_i | ( | PortableServer::POA_ptr | thePOA, |
| SMESH_Mesh_i * | theMeshServant, | ||
| const int | theLocalID | ||
| ) |
Definition at line 61 of file SMESH_Group_i.cxx.
: SALOME::GenericObj_i( thePOA ),
SMESH_GroupBase_i( thePOA, theMeshServant, theLocalID )
{
//MESSAGE("SMESH_Group_i; this = "<<this );
}
| CORBA::Long SMESH_Group_i::Add | ( | const SMESH::long_array & | theIDs | ) |
Definition at line 256 of file SMESH_Group_i.cxx.
References SMESHDS_Group.Add(), SMESH_GroupBase_i.GetGroupDS(), and MESSAGE.
{
// Update Python script
TPythonDump() << "nbAdd = " << _this() << ".Add( " << theIDs << " )";
// Add elements to the group
SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( GetGroupDS() );
if (aGroupDS) {
int nbAdd = 0;
for (int i = 0; i < theIDs.length(); i++) {
int anID = (int) theIDs[i];
if (aGroupDS->Add(anID))
nbAdd++;
}
return nbAdd;
}
MESSAGE("attempt to add elements to a vague group");
return 0;
}
| CORBA::Long SMESH_Group_i::AddByPredicate | ( | SMESH::Predicate_ptr | thePredicate | ) |
Definition at line 332 of file SMESH_Group_i.cxx.
References SMESHDS_Group.Add(), ChangeByPredicate(), SMESH_GroupBase_i.GetGroupDS(), and SMESH.GetPredicate().
{
if(SMESH::Predicate_i* aPredicate = SMESH::GetPredicate(thePredicate)){
TPythonDump()<<_this()<<".AddByPredicate("<<aPredicate<<")";
return ChangeByPredicate(aPredicate,GetGroupDS(),&SMESHDS_Group::Add);
}
return 0;
}
| CORBA::Long SMESH_Group_i::AddFrom | ( | SMESH::SMESH_IDSource_ptr | theSource | ) |
Definition at line 352 of file SMESH_Group_i.cxx.
References SMESHDS_Group.Add(), SMESH_BelongToGeom.anIds, SMESH_GroupBase_i.GetGroupDS(), SMESH_GroupBase_i.GetType(), ex21_lamp.group, PAL_MESH_041_mesh.mesh, and SMESH_test4.submesh.
{
long nbAdd = 0;
SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( GetGroupDS() );
if (aGroupDS) {
SMESH::long_array_var anIds;
SMESH::SMESH_GroupBase_var group = SMESH::SMESH_GroupBase::_narrow(theSource);
SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow(theSource);
SMESH::SMESH_subMesh_var submesh = SMESH::SMESH_subMesh::_narrow(theSource);
SMESH::Filter_var filter = SMESH::Filter::_narrow(theSource);
if ( !group->_is_nil())
anIds = group->GetType()==GetType() ? theSource->GetIDs() : new SMESH::long_array();
else if ( !mesh->_is_nil() )
anIds = mesh->GetElementsByType( GetType() );
else if ( !submesh->_is_nil())
anIds = submesh->GetElementsByType( GetType() );
else if ( !filter->_is_nil() )
anIds = filter->GetElementType()==GetType() ? theSource->GetIDs() : new SMESH::long_array();
else
anIds = theSource->GetIDs();
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;
}
| void SMESH_Group_i::Clear | ( | ) |
Definition at line 221 of file SMESH_Group_i.cxx.
References SMESHDS_Group.Clear(), SMESH_GroupBase_i.GetGroupDS(), and MESSAGE.
{
// Update Python script
TPythonDump() << _this() << ".Clear()";
// Clear the group
SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( GetGroupDS() );
if (aGroupDS) {
aGroupDS->Clear();
return;
}
MESSAGE("attempt to clear a vague group");
}
| CORBA::Boolean SMESH_GroupBase_i::Contains | ( | CORBA::Long | elem_id | ) | [inherited] |
Definition at line 241 of file SMESH_Group_i.cxx.
References SMESHDS_GroupBase.Contains(), SMESH_GroupBase_i.GetGroupDS(), and MESSAGE.
{
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
if (aGroupDS)
return aGroupDS->Contains(theID);
MESSAGE("attempt to check contents of a vague group");
return false;
}
| SALOMEDS::Color SMESH_GroupBase_i::GetColor | ( | ) | [inherited] |
Definition at line 453 of file SMESH_Group_i.cxx.
References SMESHDS_GroupBase.GetColor(), SMESH_GroupBase_i.GetGroupDS(), and MESSAGE.
Referenced by SMESH_Gen_i.Save().
{
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
if (aGroupDS)
{
Quantity_Color aQColor = aGroupDS->GetColor();
SALOMEDS::Color aColor;
aColor.R = aQColor.Red();
aColor.G = aQColor.Green();
aColor.B = aQColor.Blue();
return aColor;
}
MESSAGE("get color of a group");
return SALOMEDS::Color();
}
| CORBA::Long SMESH_GroupBase_i::GetColorNumber | ( | ) | [inherited] |
Definition at line 491 of file SMESH_Group_i.cxx.
References SMESHDS_GroupBase.GetColorGroup(), SMESH_GroupBase_i.GetGroupDS(), and MESSAGE.
{
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
if (aGroupDS)
return aGroupDS->GetColorGroup();
MESSAGE("get color number of a group");
return 0;
}
| SMESHDS_GroupBase * SMESH_GroupBase_i::GetGroupDS | ( | ) | const [inherited] |
Definition at line 107 of file SMESH_Group_i.cxx.
References SMESH_controls.aGroup, and SMESH_GroupBase_i.GetSmeshGroup().
Referenced by Add(), AddByPredicate(), AddFrom(), Clear(), SMESH_GroupBase_i.Contains(), SMESH_GroupBase_i.GetColor(), SMESH_GroupBase_i.GetColorNumber(), SMESH_GroupBase_i.GetID(), SMESH_GroupBase_i.GetListOfID(), SMESH_GroupBase_i.GetMeshInfo(), SMESH_GroupOnGeom_i.GetShape(), SMESH_GroupBase_i.GetType(), SMESH_GroupBase_i.GetTypes(), SMESH_GroupBase_i.IsEmpty(), Remove(), RemoveByPredicate(), SMESH_Gen_i.Save(), SMESH_GroupBase_i.SetColor(), SMESH_GroupBase_i.SetColorNumber(), and SMESH_GroupBase_i.Size().
{
::SMESH_Group* aGroup = GetSmeshGroup();
if ( aGroup )
return aGroup->GetGroupDS();
return 0;
}
| CORBA::Long SMESH_GroupBase_i::GetID | ( | CORBA::Long | elem_index | ) | [inherited] |
Definition at line 389 of file SMESH_Group_i.cxx.
References SMESH_GroupBase_i.GetGroupDS(), SMESHDS_GroupBase.GetID(), and MESSAGE.
{
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
if (aGroupDS)
return aGroupDS->GetID(theIndex);
MESSAGE("attempt to iterate on a vague group");
return -1;
}
| SMESH::long_array * SMESH_GroupBase_i::GetIDs | ( | ) | [virtual, inherited] |
Definition at line 561 of file SMESH_Group_i.cxx.
References SMESH_GroupBase_i.GetListOfID().
{
SMESH::long_array_var aResult = GetListOfID();
return aResult._retn();
}
| SMESH::long_array * SMESH_GroupBase_i::GetListOfID | ( | ) | [inherited] |
Definition at line 404 of file SMESH_Group_i.cxx.
References SMESHDS_GroupBase.Extent(), SMESH_GroupBase_i.GetGroupDS(), SMESHDS_GroupBase.GetID(), and MESSAGE.
Referenced by SMESH_GroupBase_i.GetIDs(), and SMESH_Mesh_i.RemoveGroupWithContents().
{
SMESH::long_array_var aRes = new SMESH::long_array();
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
if (aGroupDS) {
int aSize = aGroupDS->Extent();
aRes->length(aSize);
for (int i = 0; i < aSize; i++)
aRes[i] = aGroupDS->GetID(i+1);
return aRes._retn();
}
MESSAGE("get list of IDs of a vague group");
return aRes._retn();
}
| int SMESH_GroupBase_i.GetLocalID | ( | ) | const [inherited] |
Definition at line 85 of file SMESH_Group_i.hxx.
Referenced by SMESH_Mesh_i.CheckGeomGroupModif(), SMESH_Mesh_i.ConvertToStandalone(), SMESH_Gen_i.Load(), and SMESH_Mesh_i.RemoveGroup().
{ return myLocalID; }
| SMESH::SMESH_Mesh_ptr SMESH_GroupBase_i::GetMesh | ( | ) | [inherited] |
Definition at line 424 of file SMESH_Group_i.cxx.
References SMESH_GroupBase_i.myMeshServant.
{
SMESH::SMESH_Mesh_var aMesh;
if ( myMeshServant )
aMesh = SMESH::SMESH_Mesh::_narrow( myMeshServant->_this() );
return aMesh._retn();
}
| SMESH::long_array * SMESH_GroupBase_i::GetMeshInfo | ( | ) | [virtual, inherited] |
Returns statistic of mesh elements Result array of number enityties Inherited from SMESH_IDSource.
Definition at line 524 of file SMESH_Group_i.cxx.
References SMESH_Mesh_i.CollectMeshInfo(), SMESH.Entity_Last, SMESH.Entity_Node, SMESHDS_GroupBase.Extent(), SMESHDS_GroupBase.GetElements(), SMESH_GroupBase_i.GetGroupDS(), SMESH_GroupBase_i.GetType(), and SMESH.NODE.
{
SMESH::long_array_var aRes = new SMESH::long_array();
aRes->length(SMESH::Entity_Last);
for (int i = SMESH::Entity_Node; i < SMESH::Entity_Last; i++)
aRes[i] = 0;
SMESHDS_GroupBase* aGrpDS = GetGroupDS();
if ( !aGrpDS )
return aRes._retn();
if ( GetType() == NODE )
aRes[ SMESH::Entity_Node ] = aGrpDS->Extent();
else
SMESH_Mesh_i::CollectMeshInfo( aGrpDS->GetElements(), aRes);
// SMDS_ElemIteratorPtr it = aGrpDS->GetElements();
// if ( it->more() )
// {
// cout << "START" << endl;
// set< const SMDS_MeshElement* > nodes;
// const SMDS_MeshElement* e = it->next();
// for ( int i = 0; i < 1000000; ++i)
// {
// SMDS_ElemIteratorPtr it = e->nodesIterator();
// nodes.insert( e + i );
// }
// cout << "END "<< nodes.size() << endl;
// }
return aRes._retn();
}
| SMESH_Mesh_i* SMESH_GroupBase_i.GetMeshServant | ( | ) | const [inherited] |
Definition at line 86 of file SMESH_Group_i.hxx.
Referenced by SMESH_GroupOnGeom_i.GetShape().
{ return myMeshServant; }
| char * SMESH_GroupBase_i::GetName | ( | ) | [inherited] |
Definition at line 149 of file SMESH_Group_i.cxx.
References SMESH_controls.aGroup, SMESH_GroupBase_i.GetSmeshGroup(), and MESSAGE.
Referenced by SMESH_Gen_i.Save().
{
::SMESH_Group* aGroup = GetSmeshGroup();
if (aGroup)
return CORBA::string_dup (aGroup->GetName());
MESSAGE("get name of a vague group");
return CORBA::string_dup( "NO_NAME" );
}
| SMESH_Group * SMESH_GroupBase_i::GetSmeshGroup | ( | ) | const [inherited] |
Definition at line 93 of file SMESH_Group_i.cxx.
References SMESH_Mesh_i.GetImpl(), SMESH_GroupBase_i.myLocalID, and SMESH_GroupBase_i.myMeshServant.
Referenced by SMESH_GroupBase_i.GetGroupDS(), SMESH_GroupBase_i.GetName(), and SMESH_GroupBase_i.SetName().
{
if ( myMeshServant ) {
::SMESH_Mesh& aMesh = myMeshServant->GetImpl();
return aMesh.GetGroup(myLocalID);
}
return 0;
}
| SMESH::ElementType SMESH_GroupBase_i::GetType | ( | ) | [inherited] |
Definition at line 164 of file SMESH_Group_i.cxx.
References SMESH.ALL, EDGE, SMESH.ELEM0D, FACE, SMESH_GroupBase_i.GetGroupDS(), SMESHDS_GroupBase.GetType(), MESSAGE, SMESH.NODE, SMDSAbs_0DElement, SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_Node, SMDSAbs_Volume, and VOLUME.
Referenced by AddFrom(), SMESH_GroupBase_i.GetMeshInfo(), SMESH_GroupBase_i.GetTypes(), and SMESH_Mesh_i.RemoveGroupWithContents().
{
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
if (aGroupDS) {
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;
case SMDSAbs_0DElement: aType = SMESH::ELEM0D; break;
default: aType = SMESH::ALL; break;
}
return aType;
}
MESSAGE("get type of a vague group");
return SMESH::ALL;
}
| SMESH::array_of_ElementType * SMESH_GroupBase_i::GetTypes | ( | ) | [virtual, inherited] |
Returns types of elements it contains Inherited from SMESH_IDSource interface.
Definition at line 572 of file SMESH_Group_i.cxx.
References SMESH_GroupBase_i.GetGroupDS(), and SMESH_GroupBase_i.GetType().
{
SMESH::array_of_ElementType_var types = new SMESH::array_of_ElementType;
if ( SMESHDS_GroupBase* ds = GetGroupDS() )
if ( !ds->IsEmpty() )
{
types->length( 1 );
types[0] = GetType();
}
return types._retn();
}
| CORBA::Boolean SMESH_GroupBase_i::IsEmpty | ( | ) | [inherited] |
Definition at line 206 of file SMESH_Group_i.cxx.
References SMESH_GroupBase_i.GetGroupDS(), SMESHDS_GroupBase.IsEmpty(), and MESSAGE.
{
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
if (aGroupDS)
return aGroupDS->IsEmpty();
MESSAGE("checking IsEmpty of a vague group");
return true;
}
| CORBA::Long SMESH_Group_i::Remove | ( | const SMESH::long_array & | theIDs | ) |
Definition at line 282 of file SMESH_Group_i.cxx.
References SMESH_GroupBase_i.GetGroupDS(), MESSAGE, and SMESHDS_Group.Remove().
{
// Update Python script
TPythonDump() << "nbDel = " << _this() << ".Remove( " << theIDs << " )";
// Remove elements from the group
SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( GetGroupDS() );
if (aGroupDS) {
int nbDel = 0;
for (int i = 0; i < theIDs.length(); i++) {
int anID = (int) theIDs[i];
if (aGroupDS->Remove(anID))
nbDel++;
}
return nbDel;
}
MESSAGE("attempt to remove elements from a vague group");
return 0;
}
| CORBA::Long SMESH_Group_i::RemoveByPredicate | ( | SMESH::Predicate_ptr | thePredicate | ) |
Definition at line 343 of file SMESH_Group_i.cxx.
References ChangeByPredicate(), SMESH_GroupBase_i.GetGroupDS(), SMESH.GetPredicate(), and SMESHDS_Group.Remove().
{
if(SMESH::Predicate_i* aPredicate = SMESH::GetPredicate(thePredicate)){
TPythonDump()<<_this()<<".RemoveByPredicate("<<aPredicate<<")";
return ChangeByPredicate(aPredicate,GetGroupDS(),&SMESHDS_Group::Remove);
}
return 0;
}
| void SMESH_GroupBase_i::SetColor | ( | const SALOMEDS::Color & | color | ) | [inherited] |
Definition at line 475 of file SMESH_Group_i.cxx.
References SMESH_GroupBase_i.GetGroupDS(), and SMESHDS_GroupBase.SetColor().
{
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
if (aGroupDS)
{
Quantity_Color aQColor( color.R, color.G, color.B, Quantity_TOC_RGB );
aGroupDS->SetColor(aQColor);
TPythonDump()<<_this()<<".SetColor( SALOMEDS.Color( "<<color.R<<", "<<color.G<<", "<<color.B<<" ))";
}
}
| void SMESH_GroupBase_i::SetColorNumber | ( | CORBA::Long | color | ) | [inherited] |
Definition at line 505 of file SMESH_Group_i.cxx.
References SMESH_GroupBase_i.GetGroupDS(), MESSAGE, and SMESHDS_GroupBase.SetColorGroup().
{
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
if (aGroupDS)
{
aGroupDS->SetColorGroup(color);
TPythonDump()<<_this()<<".SetColorNumber( "<<color<<" )";
}
MESSAGE("set color number of a group");
return ;
}
| void SMESH_GroupBase_i::SetName | ( | const char * | name | ) | [inherited] |
Definition at line 121 of file SMESH_Group_i.cxx.
References SMESH_controls.aGroup, SMESH_Gen_i.GetCurrentStudy(), SMESH_Mesh_i.GetGen(), SMESH_GroupBase_i.GetSmeshGroup(), MESSAGE, SMESH_GroupBase_i.myMeshServant, SMESH_Gen_i.ObjectToSObject(), and SMESH_Gen_i.SetName().
{
// Perform renaming
::SMESH_Group* aGroup = GetSmeshGroup();
if (!aGroup) {
MESSAGE("can't set name of a vague group");
return;
}
if ( aGroup->GetName() && !strcmp( aGroup->GetName(), theName ) )
return; // nothing to rename
aGroup->SetName(theName);
// Update group name in a study
SMESH_Gen_i* aGen = myMeshServant->GetGen();
aGen->SetName( aGen->ObjectToSObject( aGen->GetCurrentStudy(), _this() ), theName );
// Update Python script
TPythonDump() << _this() << ".SetName( '" << theName << "' )";
}
| CORBA::Long SMESH_GroupBase_i::Size | ( | ) | [inherited] |
Definition at line 191 of file SMESH_Group_i.cxx.
References SMESHDS_GroupBase.Extent(), SMESH_GroupBase_i.GetGroupDS(), and MESSAGE.
{
SMESHDS_GroupBase* aGroupDS = GetGroupDS();
if (aGroupDS)
return aGroupDS->Extent();
MESSAGE("get size of a vague group");
return 0;
}