Back to index

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

#include <SMESH_2smeshpy.hxx>

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

List of all members.

Public Member Functions

 _pyMesh (const Handle(_pyCommand) creationCmd)
 Mesh created by SMESH_Gen.
 _pyMesh (const Handle(_pyCommand) theCreationCmd, const _pyID &id)
 Mesh created by SMESH_MeshEditor.
const _pyIDGetGeom ()
void AddGroup (const Handle(_pyGroup)&g)
void AddEditor (const Handle(_pyMeshEditor)&e)
bool IsNotGeomPublished ()
virtual void Process (const Handle(_pyCommand)&theCommand)
 Convert an IDL API command of SMESH::SMESH_Mesh to a method call of python Mesh.
virtual void Flush ()
 Convert creation and addition of all algos and hypos.
virtual void SetRemovedFromStudy (const bool isRemoved)
 Sets myIsPublished of me and of all objects depending on me.
virtual bool CanClear ()
 Return true if none of myChildMeshes is in study.
virtual void ClearCommands ()
 Clear my commands and commands of mesh editor.
virtual void Free ()
virtual const char * AccessorMethod () const
 Return method name giving access to an interaface object wrapped by python class.
const _pyIDGetID ()
int GetNbCalls () const
bool IsInStudy () const
void SetCreationCmd (Handle(_pyCommand) cmd)
int GetCommandNb ()
void AddProcessedCmd (const Handle(_pyCommand)&cmd)
std::list< Handle(_pyCommand) > & GetProcessedCmds ()

Static Public Member Functions

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

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

 Handle (_pyCommand) myLastComputeCmd
void addFatherMesh (const Handle(_pyMesh)&mesh)
 Add a father mesh.
void addFatherMesh (const _pyID &meshID)
 Add a father mesh by ID.

Static Private Member Functions

static bool NeedMeshAccess (const Handle(_pyCommand)&theCommand)
 Return True if addition of accesor method is needed.
static void AddMeshAccess (const Handle(_pyCommand)&theCommand)

Private Attributes

std::list< Handle(_pyHypothesis) > myHypos
std::list< Handle(_pyCommand) > myAddHypCmds
std::list< Handle(_pySubMesh) > mySubmeshes
std::list< Handle(_pyGroup) > myGroups
std::list< Handle(_pyMeshEditor)> myEditors
std::list< Handle(_pyMesh) > myChildMeshes
bool myGeomNotInStudy

Detailed Description

Definition at line 294 of file SMESH_2smeshpy.hxx.


Constructor & Destructor Documentation

_pyMesh::_pyMesh ( const Handle(_pyCommand creationCmd)

Mesh created by SMESH_Gen.

Definition at line 1288 of file SMESH_2smeshpy.cxx.

  : _pyObject( theCreationCmd ), myGeomNotInStudy( false )
{
  if ( theCreationCmd->GetMethod() == "CreateMesh" && theGen->IsNotPublished( GetGeom() ))
    myGeomNotInStudy = true;

  // convert my creation command --> smeshpy.Mesh(...)
  Handle(_pyCommand) creationCmd = GetCreationCmd();
  creationCmd->SetObject( SMESH_2smeshpy::SmeshpyName() );
  creationCmd->SetMethod( "Mesh" );
  theGen->SetAccessorMethod( GetID(), _pyMesh::AccessorMethod() );
}

Here is the call graph for this function:

_pyMesh::_pyMesh ( const Handle(_pyCommand theCreationCmd,
const _pyID id 
)

Mesh created by SMESH_MeshEditor.

Definition at line 1307 of file SMESH_2smeshpy.cxx.

                                                                            :
  _pyObject(theCreationCmd,meshId), myGeomNotInStudy(false )
{
  if ( theCreationCmd->MethodStartsFrom( "CreateMeshesFrom" ))
  {
    // this mesh depends on the exported mesh
    const TCollection_AsciiString& file = theCreationCmd->GetArg( 1 );
    if ( !file.IsEmpty() )
    {
      ExportedMeshData& exportData = theGen->FindExportedMesh( file );
      addFatherMesh( exportData.myMesh );
      if ( !exportData.myLastComputeCmd.IsNull() )
      {
        // restore cleared Compute() by which the exported mesh was generated
        exportData.myLastComputeCmd->GetString() = exportData.myLastComputeCmdString;
        // protect that Compute() cmd from clearing
        if ( exportData.myMesh->myLastComputeCmd == exportData.myLastComputeCmd )
          exportData.myMesh->myLastComputeCmd.Nullify();
      }
    }
  }
  else if ( theCreationCmd->MethodStartsFrom( "Concatenate" ))
  {
    // this mesh depends on concatenated meshes
    const TCollection_AsciiString& meshIDs = theCreationCmd->GetArg( 1 );
    list< _pyID > idList = theCreationCmd->GetStudyEntries( meshIDs );
    list< _pyID >::iterator meshID = idList.begin();
    for ( ; meshID != idList.end(); ++meshID )
      addFatherMesh( *meshID );
  }
  else if ( theCreationCmd->GetMethod() == "CopyMesh" )
  {
    // this mesh depends on a copied IdSource
    const _pyID& objID = theCreationCmd->GetArg( 1 );
    addFatherMesh( objID );
  }
  else if ( theCreationCmd->GetMethod().Search("MakeMesh") != -1 ||
            theCreationCmd->GetMethod() == "MakeBoundaryMesh" ||
            theCreationCmd->GetMethod() == "MakeBoundaryElements" )
  {
    // this mesh depends on a source mesh
    // (theCreationCmd is already Process()ed by _pyMeshEditor)
    const _pyID& meshID = theCreationCmd->GetObject();
    addFatherMesh( meshID );
  }
    
  // convert my creation command
  Handle(_pyCommand) creationCmd = GetCreationCmd();
  creationCmd->SetObject( SMESH_2smeshpy::SmeshpyName() );
  theGen->SetAccessorMethod( meshId, _pyMesh::AccessorMethod() );
}

Here is the call graph for this function:


Member Function Documentation

virtual const char* _pyMesh::AccessorMethod ( ) const [inline, virtual]

Return method name giving access to an interaface object wrapped by python class.

Return values:
constchar* - method name

Reimplemented from _pyObject.

Definition at line 318 of file SMESH_2smeshpy.hxx.

Here is the caller graph for this function:

void _pyMesh::AddEditor ( const Handle(_pyMeshEditor)&  e) [inline]

Definition at line 310 of file SMESH_2smeshpy.hxx.

{ myEditors.push_back( e ); }
void _pyMesh::addFatherMesh ( const Handle(_pyMesh)&  mesh) [private]

Add a father mesh.

Definition at line 1839 of file SMESH_2smeshpy.cxx.

{
  if ( !mesh.IsNull() )
  {
    //myFatherMeshes.push_back( mesh );
    mesh->myChildMeshes.push_back( this );

    // protect last Compute() from clearing by the next Compute()
    mesh->myLastComputeCmd.Nullify();
  }
}

Here is the caller graph for this function:

void _pyMesh::addFatherMesh ( const _pyID meshID) [private]

Add a father mesh by ID.

Definition at line 1827 of file SMESH_2smeshpy.cxx.

{
  if ( !meshID.IsEmpty() )
    addFatherMesh( Handle(_pyMesh)::DownCast( theGen->FindObject( meshID )));
}

Here is the call graph for this function:

void _pyMesh::AddGroup ( const Handle(_pyGroup)&  g) [inline]

Definition at line 309 of file SMESH_2smeshpy.hxx.

{ myGroups.push_back( g ); }
static void _pyMesh::AddMeshAccess ( const Handle(_pyCommand)&  theCommand) [inline, static, private]

Definition at line 323 of file SMESH_2smeshpy.hxx.

  { theCommand->SetObject( theCommand->GetObject() + "." _pyMesh_ACCESS_METHOD ); }

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:

bool _pyMesh::CanClear ( ) [virtual]

Return true if none of myChildMeshes is in study.

Reimplemented from _pyObject.

Definition at line 1773 of file SMESH_2smeshpy.cxx.

{
  if ( IsInStudy() )
    return false;

  list< Handle(_pyMesh) >::iterator m = myChildMeshes.begin();
  for ( ; m != myChildMeshes.end(); ++m )
    if ( !(*m)->CanClear() )
      return false;

  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void _pyMesh::ClearCommands ( ) [virtual]

Clear my commands and commands of mesh editor.

Reimplemented from _pyObject.

Definition at line 1792 of file SMESH_2smeshpy.cxx.

{
  if ( !CanClear() )
  {
    if ( !IsInStudy() )
    {
      // mark all sub-objects as not removed, except child meshes
      list< Handle(_pyMesh) > children;
      children.swap( myChildMeshes );
      SetRemovedFromStudy( false );
      children.swap( myChildMeshes );
    }
    return;
  }
  _pyObject::ClearCommands();

  list< Handle(_pySubMesh) >::iterator sm = mySubmeshes.begin();
  for ( ; sm != mySubmeshes.end(); ++sm )
    (*sm)->ClearCommands();
  
  list< Handle(_pyGroup) >::iterator gr = myGroups.begin();
  for ( ; gr != myGroups.end(); ++gr )
    (*gr)->ClearCommands();

  list< Handle(_pyMeshEditor)>::iterator e = myEditors.begin();
  for ( ; e != myEditors.end(); ++e )
    (*e)->ClearCommands();
}

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:

void _pyMesh::Flush ( ) [virtual]

Convert creation and addition of all algos and hypos.

Implements _pyObject.

Definition at line 1619 of file SMESH_2smeshpy.cxx.

{
  {
    // get the meshes this mesh depends on via hypotheses
    list< Handle(_pyMesh) > fatherMeshes;
    list< Handle(_pyHypothesis) >::iterator hyp = myHypos.begin();
    for ( ; hyp != myHypos.end(); ++hyp )
      if ( ! (*hyp)->GetReferredMeshesAndGeom( fatherMeshes ))
        myGeomNotInStudy = true;

    list< Handle(_pyMesh) >::iterator m = fatherMeshes.begin();
    for ( ; m != fatherMeshes.end(); ++m )
      addFatherMesh( *m );
    // if ( removedGeom )
    //     SetRemovedFromStudy(); // as reffered geometry not in study
  }
  if ( myGeomNotInStudy )
    return;

  list < Handle(_pyCommand) >::iterator cmd;

  // try to convert algo addition like this:
  // mesh.AddHypothesis(geom, ALGO ) --> ALGO = mesh.Algo()
  for ( cmd = myAddHypCmds.begin(); cmd != myAddHypCmds.end(); ++cmd )
  {
    Handle(_pyCommand) addCmd = *cmd;

    _pyID algoID = addCmd->GetArg( 2 );
    Handle(_pyHypothesis) algo = theGen->FindHyp( algoID );
    if ( algo.IsNull() || !algo->IsAlgo() )
      continue;

    // check and create new algorithm instance if it is already wrapped
    if ( algo->IsWrapped() ) {
      _pyID localAlgoID = theGen->GenerateNewID( algoID );
      TCollection_AsciiString aNewCmdStr = addCmd->GetIndentation() + localAlgoID +
        TCollection_AsciiString( " = " ) + theGen->GetID() +
        TCollection_AsciiString( ".CreateHypothesis( \"" ) + algo->GetAlgoType() +
        TCollection_AsciiString( "\" )" );

      Handle(_pyCommand) newCmd = theGen->AddCommand( aNewCmdStr );
      Handle(_pyAlgorithm) newAlgo = Handle(_pyAlgorithm)::DownCast(theGen->FindHyp( localAlgoID ));
      if ( !newAlgo.IsNull() ) {
        newAlgo->Assign( algo, this->GetID() );
        newAlgo->SetCreationCmd( newCmd );
        algo = newAlgo;
        // set algorithm creation
        theGen->SetCommandBefore( newCmd, addCmd );
        myHypos.push_back( newAlgo );
        if ( !myLastComputeCmd.IsNull() &&
             newCmd->GetOrderNb() == myLastComputeCmd->GetOrderNb() + 1)
          newAlgo->MeshComputed( myLastComputeCmd );
      }
      else
        newCmd->Clear();
    }
    _pyID geom = addCmd->GetArg( 1 );
    bool isLocalAlgo = ( geom != GetGeom() );

    // try to convert
    if ( algo->Addition2Creation( addCmd, this->GetID() )) // OK
    {
      // wrapped algo is created after mesh creation
      GetCreationCmd()->AddDependantCmd( addCmd );

      if ( isLocalAlgo ) {
        // mesh.AddHypothesis(geom, ALGO ) --> mesh.AlgoMethod(geom)
        addCmd->SetArg( addCmd->GetNbArgs() + 1,
                        TCollection_AsciiString( "geom=" ) + geom );
        // sm = mesh.GetSubMesh(geom, name) --> sm = ALGO.GetSubMesh()
        list < Handle(_pySubMesh) >::iterator smIt;
        for ( smIt = mySubmeshes.begin(); smIt != mySubmeshes.end(); ++smIt ) {
          Handle(_pySubMesh) subMesh = *smIt;
          Handle(_pyCommand) subCmd = subMesh->GetCreationCmd();
          if ( geom == subCmd->GetArg( 1 )) {
            subCmd->SetObject( algo->GetID() );
            subCmd->RemoveArgs();
            subMesh->SetCreator( algo );
          }
        }
      }
    }
    else // KO - ALGO was already created
    {
      // mesh.AddHypothesis(geom, ALGO) --> mesh.AddHypothesis(ALGO, geom=0)
      addCmd->RemoveArgs();
      addCmd->SetArg( 1, algoID );
      if ( isLocalAlgo )
        addCmd->SetArg( 2, geom );
    }
  }

  // try to convert hypo addition like this:
  // mesh.AddHypothesis(geom, HYPO ) --> HYPO = algo.Hypo()
  for ( cmd = myAddHypCmds.begin(); cmd != myAddHypCmds.end(); ++cmd )
  {
    Handle(_pyCommand) addCmd = *cmd;
    _pyID hypID = addCmd->GetArg( 2 );
    Handle(_pyHypothesis) hyp = theGen->FindHyp( hypID );
    if ( hyp.IsNull() || hyp->IsAlgo() )
      continue;
    bool converted = hyp->Addition2Creation( addCmd, this->GetID() );
    if ( !converted ) {
      // mesh.AddHypothesis(geom, HYP) --> mesh.AddHypothesis(HYP, geom=0)
      _pyID geom = addCmd->GetArg( 1 );
      addCmd->RemoveArgs();
      addCmd->SetArg( 1, hypID );
      if ( geom != GetGeom() )
        addCmd->SetArg( 2, geom );
    }
  }

  myAddHypCmds.clear();
  mySubmeshes.clear();

  // flush hypotheses
  list< Handle(_pyHypothesis) >::iterator hyp = myHypos.begin();
  for ( hyp = myHypos.begin(); hyp != myHypos.end(); ++hyp )
    (*hyp)->Flush();
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void _pyMesh::Free ( ) [inline, virtual]

Reimplemented from _pyObject.

Definition at line 317 of file SMESH_2smeshpy.hxx.

{ /*myFatherMeshes.clear();*/ myChildMeshes.clear(); }
int _pyObject::GetCommandNb ( ) [inline, inherited]

Definition at line 180 of file SMESH_2smeshpy.hxx.

{ return myCreationCmd->GetOrderNb(); }
const _pyID& _pyMesh::GetGeom ( ) [inline]

Definition at line 308 of file SMESH_2smeshpy.hxx.

{ return GetCreationCmd()->GetArg(1); }

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; }
_pyMesh::Handle ( _pyCommand  ) [private]

Reimplemented from _pyObject.

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 _pyMesh::IsNotGeomPublished ( ) [inline]

Definition at line 311 of file SMESH_2smeshpy.hxx.

{ return myGeomNotInStudy; }
bool _pyMesh::NeedMeshAccess ( const Handle(_pyCommand)&  theCommand) [static, private]

Return True if addition of accesor method is needed.

Definition at line 1586 of file SMESH_2smeshpy.cxx.

{
  // names of SMESH_Mesh methods fully equal to methods of python class Mesh,
  // so no conversion is needed for them at all:
  static TStringSet sameMethods;
  if ( sameMethods.empty() ) {
    const char * names[] =
      { "ExportDAT","ExportUNV","ExportSTL","ExportSAUV", "RemoveGroup","RemoveGroupWithContents",
        "GetGroups","UnionGroups","IntersectGroups","CutGroups","GetLog","GetId","ClearLog",
        "GetStudyId","HasDuplicatedGroupNamesMED","GetMEDMesh","NbNodes","NbElements",
        "NbEdges","NbEdgesOfOrder","NbFaces","NbFacesOfOrder","NbTriangles",
        "NbTrianglesOfOrder","NbQuadrangles","NbQuadranglesOfOrder","NbPolygons","NbVolumes",
        "NbVolumesOfOrder","NbTetras","NbTetrasOfOrder","NbHexas","NbHexasOfOrder",
        "NbPyramids","NbPyramidsOfOrder","NbPrisms","NbPrismsOfOrder","NbPolyhedrons",
        "NbSubMesh","GetElementsId","GetElementsByType","GetNodesId","GetElementType",
        "GetSubMeshElementsId","GetSubMeshNodesId","GetSubMeshElementType","Dump","GetNodeXYZ",
        "GetNodeInverseElements","GetShapeID","GetShapeIDForElem","GetElemNbNodes",
        "GetElemNode","IsMediumNode","IsMediumNodeOfAnyElem","ElemNbEdges","ElemNbFaces",
        "IsPoly","IsQuadratic","BaryCenter","GetHypothesisList", "SetAutoColor", "GetAutoColor",
        "Clear", "ConvertToStandalone", "GetMeshOrder", "SetMeshOrder"
        ,"" }; // <- mark of end
    sameMethods.Insert( names );
  }

  return !sameMethods.Contains( theCommand->GetMethod() );
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Convert an IDL API command of SMESH::SMESH_Mesh to a method call of python Mesh.

Parameters:
theCommand- Engine method called for this mesh

Reimplemented from _pyObject.

Definition at line 1366 of file SMESH_2smeshpy.cxx.

{
  // some methods of SMESH_Mesh interface needs special conversion
  // to methods of Mesh python class
  //
  // 1. GetSubMesh(geom, name) + AddHypothesis(geom, algo)
  //     --> in Mesh_Algorithm.Create(mesh, geom, hypo, so)
  // 2. AddHypothesis(geom, hyp)
  //     --> in Mesh_Algorithm.Hypothesis(hyp, args, so)
  // 3. CreateGroupFromGEOM(type, name, grp)
  //     --> in Mesh.Group(grp, name="")
  // 4. ExportToMED(f, auto_groups, version)
  //     --> in Mesh.ExportMED( f, auto_groups, version )
  // 5. etc

  const TCollection_AsciiString& method = theCommand->GetMethod();
  // ----------------------------------------------------------------------
  if ( method == "Compute" ) // in snapshot mode, clear the previous Compute()
  {
    if ( !theGen->IsToKeepAllCommands() ) // !historical
    {
      list< Handle(_pyHypothesis) >::iterator hyp;
      if ( !myLastComputeCmd.IsNull() )
      {
        for ( hyp = myHypos.begin(); hyp != myHypos.end(); ++hyp )
          (*hyp)->ComputeDiscarded( myLastComputeCmd );

        myLastComputeCmd->Clear();
      }
      myLastComputeCmd = theCommand;

      for ( hyp = myHypos.begin(); hyp != myHypos.end(); ++hyp )
        (*hyp)->MeshComputed( myLastComputeCmd );
    }
    Flush();
  }
  // ----------------------------------------------------------------------
  else if ( method == "Clear" ) // in snapshot mode, clear all previous commands
  {
    if ( !theGen->IsToKeepAllCommands() ) // !historical
    {
      int untilCmdNb =
        myChildMeshes.empty() ? 0 : myChildMeshes.back()->GetCreationCmd()->GetOrderNb();
      // list< Handle(_pyCommand) >::reverse_iterator cmd = myProcessedCmds.rbegin();
      // for ( ; cmd != myProcessedCmds.rend() && (*cmd)->GetOrderNb() > untilCmdNb; ++cmd )
      //   (*cmd)->Clear();
      if ( !myLastComputeCmd.IsNull() )
      {
        list< Handle(_pyHypothesis) >::iterator hyp;
        for ( hyp = myHypos.begin(); hyp != myHypos.end(); ++hyp )
          (*hyp)->ComputeDiscarded( myLastComputeCmd );

        myLastComputeCmd->Clear();
      }

      list< Handle(_pyMeshEditor)>::iterator e = myEditors.begin();
      for ( ; e != myEditors.end(); ++e )
      {
        list< Handle(_pyCommand)>& cmds = (*e)->GetProcessedCmds();
        list< Handle(_pyCommand) >::reverse_iterator cmd = cmds.rbegin();
        for ( ; cmd != cmds.rend() && (*cmd)->GetOrderNb() > untilCmdNb; ++cmd )
          if ( !(*cmd)->IsEmpty() )
          {
            if ( (*cmd)->GetStudyEntries( (*cmd)->GetResultValue() ).empty() ) // no object created
              (*cmd)->Clear();
          }
      }
      myLastComputeCmd = theCommand; // to clear Clear() the same way as Compute()
    }
  }
  // ----------------------------------------------------------------------
  else if ( method == "GetSubMesh" ) { // collect submeshes of the mesh
    Handle(_pySubMesh) subMesh = theGen->FindSubMesh( theCommand->GetResultValue() );
    if ( !subMesh.IsNull() ) {
      subMesh->SetCreator( this );
      mySubmeshes.push_back( subMesh );
    }
  }
  else if ( method == "RemoveSubMesh" ) { // move submesh creation before its removal
    Handle(_pySubMesh) subMesh = theGen->FindSubMesh( theCommand->GetArg(1) );
    if ( !subMesh.IsNull() )
      subMesh->Process( theCommand );
    AddMeshAccess( theCommand );
  }
  // ----------------------------------------------------------------------
  else if ( method == "AddHypothesis" ) { // mesh.AddHypothesis(geom, HYPO )
    myAddHypCmds.push_back( theCommand );
    // set mesh to hypo
    const _pyID& hypID = theCommand->GetArg( 2 );
    Handle(_pyHypothesis) hyp = theGen->FindHyp( hypID );
    if ( !hyp.IsNull() ) {
      myHypos.push_back( hyp );
      if ( hyp->GetMesh().IsEmpty() )
        hyp->SetMesh( this->GetID() );
    }
  }
  // ----------------------------------------------------------------------
  else if ( method == "CreateGroup" ||
            method == "CreateGroupFromGEOM" ||
            method == "CreateGroupFromFilter" )
  {
    Handle(_pyGroup) group = new _pyGroup( theCommand );
    myGroups.push_back( group );
    theGen->AddObject( group );
  }
  // ----------------------------------------------------------------------
  else if ( theCommand->MethodStartsFrom( "Export" ))
  {
    if ( method == "ExportToMED" ||   // ExportToMED()  --> ExportMED()
         method == "ExportToMEDX" ) { // ExportToMEDX() --> ExportMED()
      theCommand->SetMethod( "ExportMED" );
    }
    else if ( method == "ExportCGNS" )
    { // ExportCGNS(part, ...) -> ExportCGNS(..., part)
      _pyID partID = theCommand->GetArg( 1 );
      int nbArgs = theCommand->GetNbArgs();
      for ( int i = 2; i <= nbArgs; ++i )
        theCommand->SetArg( i-1, theCommand->GetArg( i ));
      theCommand->SetArg( nbArgs, partID );
    }
    else if ( theCommand->MethodStartsFrom( "ExportPartTo" ))
    { // ExportPartTo*(part, ...) -> Export*(..., part)
      //
      // remove "PartTo" from the method
      TCollection_AsciiString newMethod = method;
      newMethod.Remove( 7, 6 );
      theCommand->SetMethod( newMethod );
      // make the 1st arg be the last one
      _pyID partID = theCommand->GetArg( 1 );
      int nbArgs = theCommand->GetNbArgs();
      for ( int i = 2; i <= nbArgs; ++i )
        theCommand->SetArg( i-1, theCommand->GetArg( i ));
      theCommand->SetArg( nbArgs, partID );
    }
    // remember file name
    theGen->AddExportedMesh( theCommand->GetArg( 1 ),
                             ExportedMeshData( this, myLastComputeCmd ));
  }
  // ----------------------------------------------------------------------
  else if ( method == "RemoveHypothesis" ) // (geom, hyp)
  {
    _pyID hypID = theCommand->GetArg( 2 );

    // check if this mesh still has corresponding addition command
    bool hasAddCmd = false;
    list< Handle(_pyCommand) >::iterator cmd = myAddHypCmds.begin();
    while ( cmd != myAddHypCmds.end() )
    {
      // AddHypothesis(geom, hyp)
      if ( hypID == (*cmd)->GetArg( 2 )) { // erase both (add and remove) commands
        theCommand->Clear();
        (*cmd)->Clear();
        cmd = myAddHypCmds.erase( cmd );
        hasAddCmd = true;
      }
      else {
        ++cmd;
      }
    }
    Handle(_pyHypothesis) hyp = theGen->FindHyp( hypID );
    if ( ! hasAddCmd && hypID.Length() != 0 ) { // hypo addition already wrapped
      // RemoveHypothesis(geom, hyp) --> RemoveHypothesis( hyp, geom=0 )
      _pyID geom = theCommand->GetArg( 1 );
      theCommand->RemoveArgs();
      theCommand->SetArg( 1, hypID );
      if ( geom != GetGeom() )
        theCommand->SetArg( 2, geom );
    }
    // remove hyp from myHypos
    myHypos.remove( hyp );
  }
  // check for SubMesh order commands
  else if ( method == "GetMeshOrder" || method == "SetMeshOrder" )
  {
    // make commands GetSubMesh() returning sub-meshes be before using sub-meshes
    // by GetMeshOrder() and SetMeshOrder(), since by defalut GetSubMesh()
    // commands are moved at the end of the script
    TCollection_AsciiString subIDs =
      ( method == "SetMeshOrder" ) ? theCommand->GetArg(1) : theCommand->GetResultValue();
    list< _pyID > idList = theCommand->GetStudyEntries( subIDs );
    list< _pyID >::iterator subID = idList.begin();
    for ( ; subID != idList.end(); ++subID )
    {
      Handle(_pySubMesh) subMesh = theGen->FindSubMesh( *subID );
      if ( !subMesh.IsNull() )
        subMesh->Process( theCommand ); // it moves GetSubMesh() before theCommand
    }
  }
  // update list of groups
  else if ( method == "GetGroups" )
  {
    TCollection_AsciiString grIDs = theCommand->GetResultValue();
    list< _pyID > idList = theCommand->GetStudyEntries( grIDs );
    list< _pyID >::iterator grID = idList.begin();
    for ( ; grID != idList.end(); ++grID )
    {
      Handle(_pyObject) obj = theGen->FindObject( *grID );
      if ( obj.IsNull() )
      {
        Handle(_pyGroup) group = new _pyGroup( theCommand, *grID );
        theGen->AddObject( group );
        myGroups.push_back( group );
      }
    }
  }
  // add accessor method if necessary
  else
  {
    if ( NeedMeshAccess( theCommand ))
      // apply theCommand to the mesh wrapped by smeshpy mesh
      AddMeshAccess( theCommand );
  }
}

Here is the call 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 _pyMesh::SetRemovedFromStudy ( const bool  isRemoved) [virtual]

Sets myIsPublished of me and of all objects depending on me.

Reimplemented from _pyObject.

Definition at line 1746 of file SMESH_2smeshpy.cxx.

{
  _pyObject::SetRemovedFromStudy(isRemoved);

  list< Handle(_pySubMesh) >::iterator sm = mySubmeshes.begin();
  for ( ; sm != mySubmeshes.end(); ++sm )
    (*sm)->SetRemovedFromStudy(isRemoved);

  list< Handle(_pyGroup) >::iterator gr = myGroups.begin();
  for ( ; gr != myGroups.end(); ++gr )
    (*gr)->SetRemovedFromStudy(isRemoved);

  list< Handle(_pyMesh) >::iterator m = myChildMeshes.begin();
  for ( ; m != myChildMeshes.end(); ++m )
    (*m)->SetRemovedFromStudy(isRemoved);

  list< Handle(_pyMeshEditor)>::iterator e = myEditors.begin();
  for ( ; e != myEditors.end(); ++e )
    (*e)->SetRemovedFromStudy(isRemoved);
}

Here is the caller graph for this function:


Member Data Documentation

std::list< Handle(_pyCommand) > _pyMesh::myAddHypCmds [private]

Definition at line 297 of file SMESH_2smeshpy.hxx.

std::list< Handle(_pyMesh) > _pyMesh::myChildMeshes [private]

Definition at line 302 of file SMESH_2smeshpy.hxx.

std::list< Handle(_pyMeshEditor)> _pyMesh::myEditors [private]

Definition at line 300 of file SMESH_2smeshpy.hxx.

bool _pyMesh::myGeomNotInStudy [private]

Definition at line 303 of file SMESH_2smeshpy.hxx.

std::list< Handle(_pyGroup) > _pyMesh::myGroups [private]

Definition at line 299 of file SMESH_2smeshpy.hxx.

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

Definition at line 296 of file SMESH_2smeshpy.hxx.

_pyID _pyObject::myID [protected, inherited]

Definition at line 165 of file SMESH_2smeshpy.hxx.

bool _pyObject::myIsPublished [protected, inherited]

Definition at line 168 of file SMESH_2smeshpy.hxx.

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

Definition at line 167 of file SMESH_2smeshpy.hxx.

std::list< Handle(_pySubMesh) > _pyMesh::mySubmeshes [private]

Definition at line 298 of file SMESH_2smeshpy.hxx.


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