Version: 6.3.1
Public Member Functions | Private Member Functions | Private Attributes | Friends

SMESH_GroupBase_i Class Reference

#include <SMESH_Group_i.hxx>

Inheritance diagram for SMESH_GroupBase_i:
Inheritance graph
[legend]

Public Member Functions

 SMESH_GroupBase_i (PortableServer::POA_ptr thePOA, SMESH_Mesh_i *theMeshServant, const int theLocalID)
virtual ~SMESH_GroupBase_i ()
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_arrayGetListOfID ()
SMESH::SMESH_Mesh_ptr GetMesh ()
virtual SMESH::long_arrayGetMeshInfo ()
 Returns statistic of mesh elements Result array of number enityties Inherited from SMESH_IDSource.
virtual SMESH::long_arrayGetIDs ()
virtual
SMESH::array_of_ElementType
GetTypes ()
 Returns types of elements it contains Inherited from SMESH_IDSource interface.
int GetLocalID () const
SMESH_Mesh_iGetMeshServant () const
SMESH_GroupGetSmeshGroup () const
SMESHDS_GroupBaseGetGroupDS () const
void SetColor (const SALOMEDS::Color &color)
SALOMEDS::Color GetColor ()
void SetColorNumber (CORBA::Long color)
CORBA::Long GetColorNumber ()

Private Member Functions

void changeLocalId (int localId)

Private Attributes

SMESH_Mesh_imyMeshServant
int myLocalID

Friends

class SMESH_Mesh_i

Detailed Description

Definition at line 47 of file SMESH_Group_i.hxx.


Constructor & Destructor Documentation

SMESH_GroupBase_i::SMESH_GroupBase_i ( PortableServer::POA_ptr  thePOA,
SMESH_Mesh_i theMeshServant,
const int  theLocalID 
)

Definition at line 51 of file SMESH_Group_i.cxx.

: SALOME::GenericObj_i( thePOA ),
  myMeshServant( theMeshServant ), 
  myLocalID( theLocalID )
{
  // PAL7962: san -- To ensure correct mapping of servant and correct reference counting in GenericObj_i,
  // servant activation is performed by SMESH_Mesh_i::createGroup()
  // thePOA->activate_object( this );
}
SMESH_GroupBase_i::~SMESH_GroupBase_i ( ) [virtual]

Definition at line 81 of file SMESH_Group_i.cxx.

References MESSAGE, myLocalID, myMeshServant, and SMESH_Mesh_i.removeGroup().

{
  MESSAGE("~SMESH_GroupBase_i; this = "<<this );
  if ( myMeshServant )
    myMeshServant->removeGroup(myLocalID);
}

Member Function Documentation

void SMESH_GroupBase_i.changeLocalId ( int  localId) [private]

Definition at line 100 of file SMESH_Group_i.hxx.

Referenced by SMESH_Mesh_i.CheckGeomGroupModif().

{ myLocalID = localId; }
CORBA::Boolean SMESH_GroupBase_i::Contains ( CORBA::Long  elem_id)

Definition at line 241 of file SMESH_Group_i.cxx.

References SMESHDS_GroupBase.Contains(), 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 ( )

Definition at line 453 of file SMESH_Group_i.cxx.

References SMESHDS_GroupBase.GetColor(), 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 ( )

Definition at line 491 of file SMESH_Group_i.cxx.

References SMESHDS_GroupBase.GetColorGroup(), 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
CORBA::Long SMESH_GroupBase_i::GetID ( CORBA::Long  elem_index)

Definition at line 389 of file SMESH_Group_i.cxx.

References 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]

Definition at line 561 of file SMESH_Group_i.cxx.

References GetListOfID().

{
  SMESH::long_array_var aResult = GetListOfID();
  return aResult._retn();
}
SMESH::long_array * SMESH_GroupBase_i::GetListOfID ( )

Definition at line 404 of file SMESH_Group_i.cxx.

References SMESHDS_GroupBase.Extent(), GetGroupDS(), SMESHDS_GroupBase.GetID(), and MESSAGE.

Referenced by 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
SMESH::SMESH_Mesh_ptr SMESH_GroupBase_i::GetMesh ( )

Definition at line 424 of file SMESH_Group_i.cxx.

References 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]

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(), GetGroupDS(), 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

Definition at line 86 of file SMESH_Group_i.hxx.

Referenced by SMESH_GroupOnGeom_i.GetShape().

{ return myMeshServant; }
char * SMESH_GroupBase_i::GetName ( )

Definition at line 149 of file SMESH_Group_i.cxx.

References SMESH_controls.aGroup, 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

Definition at line 93 of file SMESH_Group_i.cxx.

References SMESH_Mesh_i.GetImpl(), myLocalID, and myMeshServant.

Referenced by GetGroupDS(), GetName(), and SetName().

{
  if ( myMeshServant ) {
    ::SMESH_Mesh& aMesh = myMeshServant->GetImpl();
    return aMesh.GetGroup(myLocalID);
  }
  return 0;
}
SMESH::ElementType SMESH_GroupBase_i::GetType ( )

Definition at line 164 of file SMESH_Group_i.cxx.

References SMESH.ALL, EDGE, SMESH.ELEM0D, FACE, GetGroupDS(), SMESHDS_GroupBase.GetType(), MESSAGE, SMESH.NODE, SMDSAbs_0DElement, SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_Node, SMDSAbs_Volume, and VOLUME.

Referenced by SMESH_Group_i.AddFrom(), GetMeshInfo(), 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]

Returns types of elements it contains Inherited from SMESH_IDSource interface.

Definition at line 572 of file SMESH_Group_i.cxx.

References GetGroupDS(), and 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 ( )

Definition at line 206 of file SMESH_Group_i.cxx.

References GetGroupDS(), SMESHDS_GroupBase.IsEmpty(), and MESSAGE.

{
  SMESHDS_GroupBase* aGroupDS = GetGroupDS();
  if (aGroupDS)
    return aGroupDS->IsEmpty();
  MESSAGE("checking IsEmpty of a vague group");
  return true;
}
void SMESH_GroupBase_i::SetColor ( const SALOMEDS::Color &  color)

Definition at line 475 of file SMESH_Group_i.cxx.

References 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)

Definition at line 505 of file SMESH_Group_i.cxx.

References 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)

Definition at line 121 of file SMESH_Group_i.cxx.

References SMESH_controls.aGroup, SMESH_Gen_i.GetCurrentStudy(), SMESH_Mesh_i.GetGen(), GetSmeshGroup(), MESSAGE, 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 ( )

Definition at line 191 of file SMESH_Group_i.cxx.

References SMESHDS_GroupBase.Extent(), GetGroupDS(), and MESSAGE.

{
  SMESHDS_GroupBase* aGroupDS = GetGroupDS();
  if (aGroupDS)
    return aGroupDS->Extent();
  MESSAGE("get size of a vague group");
  return 0;
}

Friends And Related Function Documentation

friend class SMESH_Mesh_i [friend]

Definition at line 101 of file SMESH_Group_i.hxx.


Field Documentation

Definition at line 98 of file SMESH_Group_i.hxx.

Referenced by GetSmeshGroup(), and ~SMESH_GroupBase_i().

Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS