Back to index

salome-smesh  6.5.0
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
_pyGen Class Reference

Class corresponding to SMESH_Gen. More...

#include <SMESH_2smeshpy.hxx>

Inheritance diagram for _pyGen:
Inheritance graph
[legend]
Collaboration diagram for _pyGen:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 _pyGen (Resource_DataMapOfAsciiStringAsciiString &theEntry2AccessorMethod, Resource_DataMapOfAsciiStringAsciiString &theObjectNames, SALOMEDS::Study_ptr &theStudy, const bool theToKeepAllCommands)
 _pyGen constructor
 Handle (_pyCommand) AddCommand(const _AString &theCommand)
void ExchangeCommands (Handle(_pyCommand) theCmd1, Handle(_pyCommand) theCmd2)
 Change order of commands in the script.
void SetCommandAfter (Handle(_pyCommand) theCmd, Handle(_pyCommand) theAfterCmd)
 Set one command after the other.
void SetCommandBefore (Handle(_pyCommand) theCmd, Handle(_pyCommand) theBeforeCmd)
 Set one command before the other.
 Handle (_pyCommand)&GetLastCommand()
std::list< Handle(_pyCommand) > & GetCommands ()
_pyID GenerateNewID (const _pyID &theID)
 Generated new ID for object and assign with existing name.
void AddObject (Handle(_pyObject)&theObj)
 Stores theObj in myObjects.
void SetProxyObject (const _pyID &theID, Handle(_pyObject)&theObj)
 Re-register an object with other ID to make it Process() commands of other object having this ID.
 Handle (_pyObject) FindObject(const _pyID &theObjID) const
 Handle (_pySubMesh) FindSubMesh(const _pyID &theSubMeshID)
 Handle (_pyHypothesis) FindHyp(const _pyID &theHypID)
 Handle (_pyHypothesis) FindAlgo(const _pyID &theGeom
const _pyID const Handle (_pyHypothesis)&theHypothesis)
void SetAccessorMethod (const _pyID &theID, const char *theMethod)
 Set method to access to object wrapped with python class.
bool AddMeshAccessorMethod (Handle(_pyCommand) theCmd) const
 Add access method to mesh that is an argument.
bool AddAlgoAccessorMethod (Handle(_pyCommand) theCmd) const
 Add access method to algo that is an object or an argument.
virtual const char * AccessorMethod () const
 name of SMESH_Gen in smesh.py
bool IsGeomObject (const _pyID &theObjID) const
 Check if a study entry is under GEOM component.
bool IsNotPublished (const _pyID &theObjID) const
 Returns true if an object is not present in a study.
bool IsToKeepAllCommands () const
void AddExportedMesh (const _AString &file, const ExportedMeshData &mesh)
ExportedMeshDataFindExportedMesh (const _AString &file)
virtual void Process (const Handle(_pyCommand)&theCommand)
 Convert the command or remember it for later conversion.
virtual void Flush ()
 Convert the remembered commands.
virtual void ClearCommands ()
 Clean commmands of removed objects depending on myIsPublished flag.
virtual void Free ()
 Release mutual handles of objects.
 Handle (_pyHypothesisReader) GetHypothesisReader() const
const _pyIDGetID ()
int GetNbCalls () const
bool IsInStudy () const
virtual void SetRemovedFromStudy (const bool isRemoved)
void SetCreationCmd (Handle(_pyCommand) cmd)
int GetCommandNb ()
void AddProcessedCmd (const Handle(_pyCommand)&cmd)
std::list< Handle(_pyCommand) > & GetProcessedCmds ()
virtual bool CanClear ()

Static Public Member Functions

static _pyID FatherID (const _pyID &childID)
 Return ID of a father.

Public Attributes

const _pyIDtheMesh

Protected Member Functions

void setID (const _pyID &theID)
 Set up myID and myIsPublished.

Protected Attributes

_pyID myID
std::list< Handle(_pyCommand) > myProcessedCmds
bool myIsPublished

Private Member Functions

void setNeighbourCommand (Handle(_pyCommand)&theCmd, Handle(_pyCommand)&theOtherCmd, const bool theIsAfter)
 Set one command before or after the other.
 Handle (_pyCommand) myLastCommand
 Handle (_pyHypothesisReader) myHypReader

Private Attributes

std::map< _pyID, Handle(_pyMesh) > myMeshes
std::map< _pyID, Handle(_pyMeshEditor) > myMeshEditors
std::map< _pyID, Handle(_pyObject) > myObjects
std::list< Handle(_pyHypothesis) > myHypos
std::list< Handle(_pyCommand) > myCommands
int myNbCommands
Resource_DataMapOfAsciiStringAsciiString & myID2AccessorMethod
Resource_DataMapOfAsciiStringAsciiString & myObjectNames
int myNbFilters
bool myToKeepAllCommands
SALOMEDS::Study_var myStudy
int myGeomIDNb
int myGeomIDIndex
std::map< _AString,
ExportedMeshData
myFile2ExportedMesh

Detailed Description

Class corresponding to SMESH_Gen.

It holds info on existing meshes and hypotheses

Definition at line 220 of file SMESH_2smeshpy.hxx.


Constructor & Destructor Documentation

_pyGen::_pyGen ( Resource_DataMapOfAsciiStringAsciiString &  theEntry2AccessorMethod,
Resource_DataMapOfAsciiStringAsciiString &  theObjectNames,
SALOMEDS::Study_ptr &  theStudy,
const bool  theToKeepAllCommands 
)

_pyGen constructor

Definition at line 380 of file SMESH_2smeshpy.cxx.

  : _pyObject( new _pyCommand( "", 0 )),
    myNbCommands( 0 ),
    myID2AccessorMethod( theEntry2AccessorMethod ),
    myObjectNames( theObjectNames ),
    myNbFilters( 0 ),
    myToKeepAllCommands( theToKeepAllCommands ),
    myStudy( SALOMEDS::Study::_duplicate( theStudy )),
    myGeomIDNb(0), myGeomIDIndex(-1)
{
  // make that GetID() to return TPythonDump::SMESHGenName()
  GetCreationCmd()->Clear();
  GetCreationCmd()->GetString() = TPythonDump::SMESHGenName();
  GetCreationCmd()->GetString() += "=";

  // Find 1st digit of study entry by which a GEOM object differs from a SMESH object
  if ( !theObjectNames.IsEmpty() && !CORBA::is_nil( theStudy ))
  {
    // find a GEOM entry
    _pyID geomID;
    SALOMEDS::SComponent_var geomComp = theStudy->FindComponent("GEOM");
    if ( geomComp->_is_nil() ) return;
    CORBA::String_var entry = geomComp->GetID();
    geomID = entry.in();

    // find a SMESH entry
    _pyID smeshID;
    Resource_DataMapIteratorOfDataMapOfAsciiStringAsciiString e2n( theObjectNames );
    for ( ; e2n.More() && smeshID.IsEmpty(); e2n.Next() )
      if ( _pyCommand::IsStudyEntry( e2n.Key() ))
        smeshID = e2n.Key();

    // find 1st difference between smeshID and geomID
    if ( !geomID.IsEmpty() && !smeshID.IsEmpty() )
      for ( int i = 1; i <= geomID.Length() && i <= smeshID.Length(); ++i )
        if ( geomID.Value( i ) != smeshID.Value( i ))
        {
          myGeomIDNb = geomID.Value( i );
          myGeomIDIndex = i;
        }
  }
}

Here is the call graph for this function:


Member Function Documentation

const char * _pyGen::AccessorMethod ( ) const [virtual]

name of SMESH_Gen in smesh.py

Reimplemented from _pyObject.

Definition at line 432 of file SMESH_2smeshpy.cxx.

Here is the call graph for this function:

Add access method to algo that is an object or an argument.

Parameters:
theCmd- command to add access method
Return values:
bool- true if added

Definition at line 968 of file SMESH_2smeshpy.cxx.

{
  bool added = false;
  list< Handle(_pyHypothesis) >::const_iterator hyp = myHypos.begin();
  for ( ; hyp != myHypos.end(); ++hyp ) {
    if ( (*hyp)->IsAlgo() && /*(*hyp)->IsWrapped() &&*/
         theCmd->AddAccessorMethod( (*hyp)->GetID(), (*hyp)->AccessorMethod() ))
      added = true;
  }
  return added;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void _pyGen::AddExportedMesh ( const _AString file,
const ExportedMeshData mesh 
) [inline]

Definition at line 251 of file SMESH_2smeshpy.hxx.

Here is the caller graph for this function:

Add access method to mesh that is an argument.

Parameters:
theCmd- command to add access method
Return values:
bool- true if added

Definition at line 949 of file SMESH_2smeshpy.cxx.

{
  bool added = false;
  map< _pyID, Handle(_pyMesh) >::const_iterator id_mesh = myMeshes.begin();
  for ( ; id_mesh != myMeshes.end(); ++id_mesh ) {
    if ( theCmd->AddAccessorMethod( id_mesh->first, id_mesh->second->AccessorMethod() ))
      added = true;
  }
  return added;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void _pyGen::AddObject ( Handle(_pyObject)&  theObj)

Stores theObj in myObjects.

Definition at line 1165 of file SMESH_2smeshpy.cxx.

{
  if ( theObj.IsNull() ) return;

  if ( theObj->IsKind( STANDARD_TYPE( _pyMesh )))
    myMeshes.insert( make_pair( theObj->GetID(), Handle(_pyMesh)::DownCast( theObj )));

  else if ( theObj->IsKind( STANDARD_TYPE( _pyMeshEditor )))
    myMeshEditors.insert( make_pair( theObj->GetID(), Handle(_pyMeshEditor)::DownCast( theObj )));

  else
    myObjects.insert( make_pair( theObj->GetID(), theObj ));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void _pyObject::AddProcessedCmd ( const Handle(_pyCommand)&  cmd) [inline, inherited]

Definition at line 181 of file SMESH_2smeshpy.hxx.

  { if (myProcessedCmds.empty() || myProcessedCmds.back()!=cmd) myProcessedCmds.push_back( cmd );}

Here is the caller graph for this function:

virtual bool _pyObject::CanClear ( ) [inline, virtual, inherited]

Reimplemented in _pyFilter, _pyHypothesis, _pyMeshEditor, and _pyMesh.

Definition at line 187 of file SMESH_2smeshpy.hxx.

{ return !myIsPublished; }

Here is the caller graph for this function:

void _pyGen::ClearCommands ( ) [virtual]

Clean commmands of removed objects depending on myIsPublished flag.

Reimplemented from _pyObject.

Definition at line 893 of file SMESH_2smeshpy.cxx.

{
  map< _pyID, Handle(_pyMesh) >::iterator id_mesh = myMeshes.begin();
  for ( ; id_mesh != myMeshes.end(); ++id_mesh )
    id_mesh->second->ClearCommands();

  list< Handle(_pyHypothesis) >::iterator hyp = myHypos.begin();
  for ( ; hyp != myHypos.end(); ++hyp )
    if ( !hyp->IsNull() )
      (*hyp)->ClearCommands();

  map< _pyID, Handle(_pyObject) >::iterator id_obj = myObjects.begin();
  for ( ; id_obj != myObjects.end(); ++id_obj )
    id_obj->second->ClearCommands();
}

Here is the caller graph for this function:

void _pyGen::ExchangeCommands ( Handle(_pyCommand theCmd1,
Handle(_pyCommand theCmd2 
)

Change order of commands in the script.

Parameters:
theCmd1- One command
theCmd2- Another command

Definition at line 1046 of file SMESH_2smeshpy.cxx.

{
  list< Handle(_pyCommand) >::iterator pos1, pos2;
  pos1 = find( myCommands.begin(), myCommands.end(), theCmd1 );
  pos2 = find( myCommands.begin(), myCommands.end(), theCmd2 );
  myCommands.insert( pos1, theCmd2 );
  myCommands.insert( pos2, theCmd1 );
  myCommands.erase( pos1 );
  myCommands.erase( pos2 );

  int nb1 = theCmd1->GetOrderNb();
  theCmd1->SetOrderNb( theCmd2->GetOrderNb() );
  theCmd2->SetOrderNb( nb1 );
//   cout << "BECOME " << theCmd1->GetOrderNb() << "\t" << theCmd1->GetString() << endl
//        << "BECOME " << theCmd2->GetOrderNb() << "\t" << theCmd2->GetString() << endl << endl;
}

Here is the call graph for this function:

_pyID _pyObject::FatherID ( const _pyID childID) [static, inherited]

Return ID of a father.

Definition at line 3633 of file SMESH_2smeshpy.cxx.

{
  int colPos = childID.SearchFromEnd(':');
  if ( colPos > 0 )
    return childID.SubString( 1, colPos-1 );
  return "";
}

Here is the caller graph for this function:

ExportedMeshData& _pyGen::FindExportedMesh ( const _AString file) [inline]

Definition at line 253 of file SMESH_2smeshpy.hxx.

  { return myFile2ExportedMesh[ file ]; }

Here is the caller graph for this function:

void _pyGen::Flush ( ) [virtual]

Convert the remembered commands.

Implements _pyObject.

Definition at line 830 of file SMESH_2smeshpy.cxx.

{
  // create an empty command
  myLastCommand = new _pyCommand();

  map< _pyID, Handle(_pyMesh) >::iterator id_mesh;
  map< _pyID, Handle(_pyObject) >::iterator id_obj;
  list< Handle(_pyHypothesis) >::iterator hyp;

  if ( IsToKeepAllCommands() ) // historical dump
  {
    // set myIsPublished = true to all objects
    for ( id_mesh = myMeshes.begin(); id_mesh != myMeshes.end(); ++id_mesh )
      id_mesh->second->SetRemovedFromStudy( false );
    for ( hyp = myHypos.begin(); hyp != myHypos.end(); ++hyp )
      (*hyp)->SetRemovedFromStudy( false );
    for ( id_obj = myObjects.begin(); id_obj != myObjects.end(); ++id_obj )
      id_obj->second->SetRemovedFromStudy( false );
  }
  else
  {
    // let hypotheses find referred objects in order to prevent clearing
    // not published referred hyps (it's needed for hyps like "LayerDistribution")
    list< Handle(_pyMesh) > fatherMeshes;
    for ( hyp = myHypos.begin(); hyp != myHypos.end(); ++hyp )
      if ( !hyp->IsNull() )
        (*hyp)->GetReferredMeshesAndGeom( fatherMeshes );
  }
  // set myIsPublished = false to all objects depending on
  // meshes built on a removed geometry
  for ( id_mesh = myMeshes.begin(); id_mesh != myMeshes.end(); ++id_mesh )
    if ( id_mesh->second->IsNotGeomPublished() )
      id_mesh->second->SetRemovedFromStudy( true );

  // Flush meshes
  for ( id_mesh = myMeshes.begin(); id_mesh != myMeshes.end(); ++id_mesh )
    if ( ! id_mesh->second.IsNull() )
      id_mesh->second->Flush();

  // Flush hyps
  for ( hyp = myHypos.begin(); hyp != myHypos.end(); ++hyp )
    if ( !hyp->IsNull() ) {
      (*hyp)->Flush();
      // smeshgen.CreateHypothesis() --> smesh.smesh.CreateHypothesis()
      if ( !(*hyp)->IsWrapped() )
        (*hyp)->GetCreationCmd()->SetObject( SMESH_2smeshpy::GenName() );
    }

  // Flush other objects
  for ( id_obj = myObjects.begin(); id_obj != myObjects.end(); ++id_obj )
    if ( ! id_obj->second.IsNull() )
      id_obj->second->Flush();

  myLastCommand->SetOrderNb( ++myNbCommands );
  myCommands.push_back( myLastCommand );
}

Here is the call graph for this function:

Here is the caller graph for this function:

void _pyGen::Free ( ) [virtual]

Release mutual handles of objects.

Reimplemented from _pyObject.

Definition at line 915 of file SMESH_2smeshpy.cxx.

{
  map< _pyID, Handle(_pyMesh) >::iterator id_mesh = myMeshes.begin();
  for ( ; id_mesh != myMeshes.end(); ++id_mesh )
    id_mesh->second->Free();
  myMeshes.clear();

  map< _pyID, Handle(_pyMeshEditor) >::iterator id_ed = myMeshEditors.begin();
  for ( ; id_ed != myMeshEditors.end(); ++id_ed )
    id_ed->second->Free();
  myMeshEditors.clear();

  map< _pyID, Handle(_pyObject) >::iterator id_obj = myObjects.begin();
  for ( ; id_obj != myObjects.end(); ++id_obj )
    id_obj->second->Free();
  myObjects.clear();

  list< Handle(_pyHypothesis) >::iterator hyp = myHypos.begin();
  for ( ; hyp != myHypos.end(); ++hyp )
    if ( !hyp->IsNull() )
      (*hyp)->Free();
  myHypos.clear();

  myFile2ExportedMesh.clear();
}

Here is the caller graph for this function:

_pyID _pyGen::GenerateNewID ( const _pyID theID)

Generated new ID for object and assign with existing name.

Parameters:
theID- ID of existing object

Definition at line 1144 of file SMESH_2smeshpy.cxx.

{
  int index = 1;
  _pyID aNewID;
  do {
    aNewID = theID + _pyID( ":" ) + _pyID( index++ );
  }
  while ( myObjectNames.IsBound( aNewID ) );

  myObjectNames.Bind( aNewID, myObjectNames.IsBound( theID )
                      ? (myObjectNames.Find( theID ) + _pyID( "_" ) + _pyID( index-1 ))
                      : _pyID( "A" ) + aNewID );
  return aNewID;
}

Here is the caller graph for this function:

int _pyObject::GetCommandNb ( ) [inline, inherited]

Definition at line 180 of file SMESH_2smeshpy.hxx.

{ return myCreationCmd->GetOrderNb(); }
std::list< Handle(_pyCommand) >& _pyGen::GetCommands ( ) [inline]

Definition at line 232 of file SMESH_2smeshpy.hxx.

{ return myCommands; }

Here is the caller graph for this function:

const _pyID& _pyObject::GetID ( ) [inline, inherited]

Definition at line 173 of file SMESH_2smeshpy.hxx.

{ return myID.IsEmpty() ? myCreationCmd->GetResultValue() : myID; }

Here is the call graph for this function:

Here is the caller graph for this function:

int _pyObject::GetNbCalls ( ) const [inline, inherited]

Definition at line 176 of file SMESH_2smeshpy.hxx.

{ return myProcessedCmds.size(); }

Here is the caller graph for this function:

std::list< Handle(_pyCommand) >& _pyObject::GetProcessedCmds ( ) [inline, inherited]

Definition at line 183 of file SMESH_2smeshpy.hxx.

{ return myProcessedCmds; }

Here is the caller graph for this function:

Reimplemented from _pyObject.

const _pyID const _pyGen::Handle ( _pyHypothesis  )
_pyGen::Handle ( _pyCommand  ) [private]

Reimplemented from _pyObject.

bool _pyGen::IsGeomObject ( const _pyID theObjID) const

Check if a study entry is under GEOM component.

Definition at line 1232 of file SMESH_2smeshpy.cxx.

{
  if ( myGeomIDNb )
  {
    return ( myGeomIDIndex <= theObjID.Length() &&
             int( theObjID.Value( myGeomIDIndex )) == myGeomIDNb &&
             _pyCommand::IsStudyEntry( theObjID ));
  }
  return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool _pyObject::IsInStudy ( ) const [inline, inherited]

Definition at line 177 of file SMESH_2smeshpy.hxx.

{ return myIsPublished; }

Here is the caller graph for this function:

bool _pyGen::IsNotPublished ( const _pyID theObjID) const

Returns true if an object is not present in a study.

Definition at line 1249 of file SMESH_2smeshpy.cxx.

{
  if ( theObjID.IsEmpty() ) return false;

  if ( myObjectNames.IsBound( theObjID ))
    return false; // SMESH object is in study

  // either the SMESH object is not in study or it is a GEOM object
  if ( IsGeomObject( theObjID ))
  {
    SALOMEDS::SObject_var so = myStudy->FindObjectID( theObjID.ToCString() );
    if ( so->_is_nil() ) return true;
    CORBA::Object_var obj = so->GetObject();
    return CORBA::is_nil( obj );
  }
  return true; // SMESH object not in study
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool _pyGen::IsToKeepAllCommands ( ) const [inline]

Definition at line 250 of file SMESH_2smeshpy.hxx.

{ return myToKeepAllCommands; }

Here is the caller graph for this function:

void _pyGen::Process ( const Handle(_pyCommand)&  theCommand) [virtual]

Convert the command or remember it for later conversion.

Parameters:
theCommand- The python command calling a method of SMESH_Gen

Reimplemented from _pyObject.

Definition at line 694 of file SMESH_2smeshpy.cxx.

{
  // there are methods to convert:
  // CreateMesh( shape )
  // Concatenate( [mesh1, ...], ... )
  // CreateHypothesis( theHypType, theLibName )
  // Compute( mesh, geom )
  // Evaluate( mesh, geom )
  // mesh creation
  TCollection_AsciiString method = theCommand->GetMethod();

  if ( method == "CreateMesh" || method == "CreateEmptyMesh")
  {
    Handle(_pyMesh) mesh = new _pyMesh( theCommand );
    myMeshes.insert( make_pair( mesh->GetID(), mesh ));
    return;
  }
  if ( method == "CreateMeshesFromUNV" ||
       method == "CreateMeshesFromSTL" ||
       method == "CreateMeshesFromCGNS" ||
       method == "CopyMesh" )
  {
    Handle(_pyMesh) mesh = new _pyMesh( theCommand, theCommand->GetResultValue() );
    myMeshes.insert( make_pair( mesh->GetID(), mesh ));
    return;
  }
  if( method == "CreateMeshesFromMED" || method == "CreateMeshesFromSAUV")
  {
    for(int ind = 0;ind<theCommand->GetNbResultValues();ind++)
    {
      _pyID meshID = theCommand->GetResultValue(ind+1);
      if ( !theCommand->IsStudyEntry( meshID ) ) continue;
      Handle(_pyMesh) mesh = new _pyMesh( theCommand, theCommand->GetResultValue(ind+1));
      myMeshes.insert( make_pair( mesh->GetID(), mesh ));
    }
  }

  // CreateHypothesis()
  if ( method == "CreateHypothesis" )
  {
    // issue 199929, remove standard library name (default parameter)
    const TCollection_AsciiString & aLibName = theCommand->GetArg( 2 );
    if ( aLibName.Search( "StdMeshersEngine" ) != -1 ) {
      // keep first argument
      TCollection_AsciiString arg = theCommand->GetArg( 1 );
      theCommand->RemoveArgs();
      theCommand->SetArg( 1, arg );
    }

    myHypos.push_back( _pyHypothesis::NewHypothesis( theCommand ));
    return;
  }

  // smeshgen.Compute( mesh, geom ) --> mesh.Compute()
  if ( method == "Compute" )
  {
    const _pyID& meshID = theCommand->GetArg( 1 );
    map< _pyID, Handle(_pyMesh) >::iterator id_mesh = myMeshes.find( meshID );
    if ( id_mesh != myMeshes.end() ) {
      theCommand->SetObject( meshID );
      theCommand->RemoveArgs();
      id_mesh->second->Process( theCommand );
      id_mesh->second->AddProcessedCmd( theCommand );
      return;
    }
  }

  // smeshgen.Evaluate( mesh, geom ) --> mesh.Evaluate(geom)
  if ( method == "Evaluate" )
  {
    const _pyID& meshID = theCommand->GetArg( 1 );
    map< _pyID, Handle(_pyMesh) >::iterator id_mesh = myMeshes.find( meshID );
    if ( id_mesh != myMeshes.end() ) {
      theCommand->SetObject( meshID );
      _pyID geom = theCommand->GetArg( 2 );
      theCommand->RemoveArgs();
      theCommand->SetArg( 1, geom );
      id_mesh->second->AddProcessedCmd( theCommand );
      return;
    }
  }

  // objects erasing creation command if no more it's commands invoked:
  // SMESH_Pattern, FilterManager
  if ( method == "GetPattern" ||
       method == "CreateFilterManager" ||
       method == "CreateMeasurements" ) {
    Handle(_pyObject) obj = new _pySelfEraser( theCommand );
    if ( !myObjects.insert( make_pair( obj->GetID(), obj )).second )
      theCommand->Clear(); // already created
  }
  // Concatenate( [mesh1, ...], ... )
  else if ( method == "Concatenate" || method == "ConcatenateWithGroups")
  {
    if ( method == "ConcatenateWithGroups" ) {
      theCommand->SetMethod( "Concatenate" );
      theCommand->SetArg( theCommand->GetNbArgs() + 1, "True" );
    }
    Handle(_pyMesh) mesh = new _pyMesh( theCommand, theCommand->GetResultValue() );
    myMeshes.insert( make_pair( mesh->GetID(), mesh ));
    AddMeshAccessorMethod( theCommand );
  }
  else if ( method == "SetName" ) // SetName(obj,name)
  {
    // store theCommand as one of object commands to erase it along with the object
    const _pyID& objID = theCommand->GetArg( 1 );
    Handle(_pyObject) obj = FindObject( objID );
    if ( !obj.IsNull() )
      obj->AddProcessedCmd( theCommand );
  }

  // Replace name of SMESH_Gen

  // names of SMESH_Gen methods fully equal to methods defined in smesh.py
  static TStringSet smeshpyMethods;
  if ( smeshpyMethods.empty() ) {
    const char * names[] =
      { "SetEmbeddedMode","IsEmbeddedMode","SetCurrentStudy","GetCurrentStudy",
        "GetPattern","GetSubShapesId",
        "" }; // <- mark of array end
    smeshpyMethods.Insert( names );
  }
  if ( smeshpyMethods.Contains( theCommand->GetMethod() ))
    // smeshgen.Method() --> smesh.Method()
    theCommand->SetObject( SMESH_2smeshpy::SmeshpyName() );
  else
    // smeshgen.Method() --> smesh.smesh.Method()
    theCommand->SetObject( SMESH_2smeshpy::GenName() );
}

Here is the call graph for this function:

Here is the caller graph for this function:

void _pyGen::SetAccessorMethod ( const _pyID theID,
const char *  theMethod 
)

Set method to access to object wrapped with python class.

Parameters:
theID- The wrapped object entry
theMethod- The accessor method

Definition at line 1132 of file SMESH_2smeshpy.cxx.

{
  myID2AccessorMethod.Bind( theID, (char*) theMethod );
}

Here is the caller graph for this function:

void _pyGen::SetCommandAfter ( Handle(_pyCommand theCmd,
Handle(_pyCommand theAfterCmd 
)

Set one command after the other.

Parameters:
theCmd- Command to move
theAfterCmd- Command ater which to insert the first one

Definition at line 1071 of file SMESH_2smeshpy.cxx.

{
  setNeighbourCommand( theCmd, theAfterCmd, true );
}

Here is the call graph for this function:

Here is the caller graph for this function:

void _pyGen::SetCommandBefore ( Handle(_pyCommand theCmd,
Handle(_pyCommand theBeforeCmd 
)

Set one command before the other.

Parameters:
theCmd- Command to move
theBeforeCmd- Command before which to insert the first one

Definition at line 1084 of file SMESH_2smeshpy.cxx.

{
  setNeighbourCommand( theCmd, theBeforeCmd, false );
}

Here is the call graph for this function:

Here is the caller graph for this function:

void _pyObject::SetCreationCmd ( Handle(_pyCommand cmd) [inline, inherited]

Definition at line 179 of file SMESH_2smeshpy.hxx.

{ myCreationCmd = cmd; }

Here is the caller graph for this function:

void _pyObject::setID ( const _pyID theID) [protected, inherited]

Set up myID and myIsPublished.

Definition at line 3591 of file SMESH_2smeshpy.cxx.

{
  myID = theID;
  myIsPublished = !theGen->IsNotPublished( GetID() );
}

Here is the call graph for this function:

Here is the caller graph for this function:

void _pyGen::setNeighbourCommand ( Handle(_pyCommand)&  theCmd,
Handle(_pyCommand)&  theOtherCmd,
const bool  theIsAfter 
) [private]

Set one command before or after the other.

Parameters:
theCmd- Command to move
theOtherCmd- Command ater or before which to insert the first one

Definition at line 1097 of file SMESH_2smeshpy.cxx.

{
  list< Handle(_pyCommand) >::iterator pos;
  pos = find( myCommands.begin(), myCommands.end(), theCmd );
  myCommands.erase( pos );
  pos = find( myCommands.begin(), myCommands.end(), theOtherCmd );
  myCommands.insert( (theIsAfter ? ++pos : pos), theCmd );

  int i = 1;
  for ( pos = myCommands.begin(); pos != myCommands.end(); ++pos)
    (*pos)->SetOrderNb( i++ );
}

Here is the caller graph for this function:

void _pyGen::SetProxyObject ( const _pyID theID,
Handle(_pyObject)&  theObj 
)

Re-register an object with other ID to make it Process() commands of other object having this ID.

Definition at line 1186 of file SMESH_2smeshpy.cxx.

{
  if ( theObj.IsNull() ) return;

  if ( theObj->IsKind( STANDARD_TYPE( _pyMesh )))
    myMeshes.insert( make_pair( theID, Handle(_pyMesh)::DownCast( theObj )));

  else if ( theObj->IsKind( STANDARD_TYPE( _pyMeshEditor )))
    myMeshEditors.insert( make_pair( theID, Handle(_pyMeshEditor)::DownCast( theObj )));

  else
    myObjects.insert( make_pair( theID, theObj ));
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void _pyObject::SetRemovedFromStudy ( const bool  isRemoved) [inline, virtual, inherited]

Reimplemented in _pyMesh.

Definition at line 178 of file SMESH_2smeshpy.hxx.

{ myIsPublished = !isRemoved; }

Member Data Documentation

std::list< Handle(_pyCommand) > _pyGen::myCommands [private]

Definition at line 273 of file SMESH_2smeshpy.hxx.

Definition at line 282 of file SMESH_2smeshpy.hxx.

int _pyGen::myGeomIDIndex [private]

Definition at line 281 of file SMESH_2smeshpy.hxx.

int _pyGen::myGeomIDNb [private]

Definition at line 281 of file SMESH_2smeshpy.hxx.

std::list< Handle(_pyHypothesis) > _pyGen::myHypos [private]

Definition at line 272 of file SMESH_2smeshpy.hxx.

_pyID _pyObject::myID [protected, inherited]

Definition at line 165 of file SMESH_2smeshpy.hxx.

Resource_DataMapOfAsciiStringAsciiString& _pyGen::myID2AccessorMethod [private]

Definition at line 275 of file SMESH_2smeshpy.hxx.

bool _pyObject::myIsPublished [protected, inherited]

Definition at line 168 of file SMESH_2smeshpy.hxx.

Definition at line 270 of file SMESH_2smeshpy.hxx.

std::map< _pyID, Handle(_pyMesh) > _pyGen::myMeshes [private]

Definition at line 269 of file SMESH_2smeshpy.hxx.

int _pyGen::myNbCommands [private]

Definition at line 274 of file SMESH_2smeshpy.hxx.

int _pyGen::myNbFilters [private]

Definition at line 278 of file SMESH_2smeshpy.hxx.

Resource_DataMapOfAsciiStringAsciiString& _pyGen::myObjectNames [private]

Definition at line 276 of file SMESH_2smeshpy.hxx.

std::map< _pyID, Handle(_pyObject) > _pyGen::myObjects [private]

Definition at line 271 of file SMESH_2smeshpy.hxx.

std::list< Handle(_pyCommand) > _pyObject::myProcessedCmds [protected, inherited]

Definition at line 167 of file SMESH_2smeshpy.hxx.

SALOMEDS::Study_var _pyGen::myStudy [private]

Definition at line 280 of file SMESH_2smeshpy.hxx.

Definition at line 279 of file SMESH_2smeshpy.hxx.

Definition at line 240 of file SMESH_2smeshpy.hxx.


The documentation for this class was generated from the following files: