Version: 8.3.0
_pyGen Class Reference

Class corresponding to SMESH_Gen. More...

#include <SMESH_2smeshpy.hxx>

Inheritance diagram for _pyGen:

Public Member Functions

 _pyGen (Resource_DataMapOfAsciiStringAsciiString &theEntry2AccessorMethod, Resource_DataMapOfAsciiStringAsciiString &theObjectNames, std::set< TCollection_AsciiString > &theRemovedObjIDs, SALOMEDS::Study_ptr &theStudy, const bool theToKeepAllCommands)
 _pyGen constructor More...
 
 Handle (_pyCommand) AddCommand(const _AString &theCommand)
 
void ExchangeCommands (Handle(_pyCommand) theCmd1, Handle(_pyCommand) theCmd2)
 Change order of commands in the script. More...
 
void SetCommandAfter (Handle(_pyCommand) theCmd, Handle(_pyCommand) theAfterCmd)
 Set one command after the other. More...
 
void SetCommandBefore (Handle(_pyCommand) theCmd, Handle(_pyCommand) theBeforeCmd)
 Set one command before the other. More...
 
 Handle (_pyCommand)&GetLastCommand()
 
std::list< Handle(_pyCommand) > & GetCommands ()
 
void PlaceSubmeshAfterItsCreation (Handle(_pyCommand) theCmdUsingSubmesh) const
 Prevent moving a command creating a sub-mesh to the end of the script if the sub-mesh is used in theCmdUsingSubmesh as argument. More...
 
_pyID GenerateNewID (const _pyID &theID)
 Generated new ID for object and assign with existing name. More...
 
bool AddObject (Handle(_pyObject)&theObj)
 Stores theObj in myObjects. More...
 
void CheckObjectIsReCreated (Handle(_pyObject)&theObj)
 Erases an existing object with the same ID. More...
 
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. More...
 
 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. More...
 
bool AddMeshAccessorMethod (Handle(_pyCommand) theCmd) const
 Add access method to mesh that is an argument. More...
 
bool AddAlgoAccessorMethod (Handle(_pyCommand) theCmd) const
 Add access method to algo that is an object or an argument. More...
 
virtual const char * AccessorMethod () const
 name of SMESH_Gen in smeshBuilder.py More...
 
bool IsGeomObject (const _pyID &theObjID) const
 Check if a study entry is under GEOM component. More...
 
bool IsNotPublished (const _pyID &theObjID) const
 Returns true if an object is not present in a study. More...
 
void ObjectCreationRemoved (const _pyID &theObjID)
 Add an object to myRemovedObjIDs that leads to that SetName() for this object is not dumped. More...
 
void KeepAgrCmds (const _pyID &theObjID)
 
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. More...
 
virtual void Flush ()
 Convert the remembered commands. More...
 
virtual void ClearCommands ()
 Clean commmands of removed objects depending on myIsPublished flag. More...
 
virtual void Free ()
 Release mutual handles of objects. More...
 
 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 ()
 
void AddArgCmd (const Handle(_pyCommand)&cmd)
 
virtual bool CanClear ()
 Return true if all my users can be cleared. More...
 

Static Public Member Functions

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

Data Fields

const _pyIDtheMesh
 

Protected Member Functions

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

Protected Attributes

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

Private Member Functions

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

Private Attributes

std::map< _pyID, Handle(_pyMesh) > myMeshes
 
std::map< _pyID, Handle(_pyMeshEditor) > myMeshEditors
 
std::map< _pyID, Handle(_pyHypothesis) > myHypos
 
std::map< _pyID, Handle(_pyObject) > myObjects
 
std::list< Handle(_pyObject) > myOrderedObjects
 
_pyStringFamily myKeepAgrCmdsIDs
 
std::list< Handle(_pyCommand) > myCommands
 
int myNbCommands
 
Resource_DataMapOfAsciiStringAsciiString & myID2AccessorMethod
 
Resource_DataMapOfAsciiStringAsciiString & myObjectNames
 
std::set
< TCollection_AsciiString > & 
myRemovedObjIDs
 
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

Constructor & Destructor Documentation

_pyGen::_pyGen ( Resource_DataMapOfAsciiStringAsciiString &  theEntry2AccessorMethod,
Resource_DataMapOfAsciiStringAsciiString &  theObjectNames,
std::set< TCollection_AsciiString > &  theRemovedObjIDs,
SALOMEDS::Study_ptr &  theStudy,
const bool  theToKeepAllCommands 
)

Member Function Documentation

const char * _pyGen::AccessorMethod ( ) const
virtual

name of SMESH_Gen in smeshBuilder.py

Reimplemented from _pyObject.

References SMESH_2smeshpy::GenName().

bool _pyGen::AddAlgoAccessorMethod ( Handle(_pyCommand theCmd) const

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

References _pyCommand::AddAccessorMethod(), and myHypos.

Referenced by _pyHypothesis::Flush().

void _pyObject::AddArgCmd ( const Handle(_pyCommand)&  cmd)
inherited

References _pyObject::myArgCmds.

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

References myFile2ExportedMesh.

Referenced by _pyMesh::Process().

bool _pyGen::AddMeshAccessorMethod ( Handle(_pyCommand theCmd) const

Add access method to mesh that is an argument.

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

References _pyCommand::AddAccessorMethod(), and myMeshes.

Referenced by _pyHypothesis::Flush(), Process(), _pyMeshEditor::Process(), _pyFilter::Process(), and _pyGroup::Process().

bool _pyGen::AddObject ( Handle(_pyObject)&  theObj)
void _pyObject::AddProcessedCmd ( const Handle(_pyCommand)&  cmd)
inherited
bool _pyObject::CanClear ( )
virtualinherited

Return true if all my users can be cleared.

Reimplemented in _pyGroup, _pySelfEraser, _pyHypothesis, _pyMeshEditor, and _pyMesh.

References _pyObject::Handle(), _pyObject::myArgCmds, and _pyObject::myIsPublished.

Referenced by _pyObject::ClearCommands(), and _pySelfEraser::IsAliveCmd().

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

Erases an existing object with the same ID.

This method should be called before storing theObj in _pyGen

References _pyObject::GetID(), Handle(), _pyCommand::IsStudyEntry(), myHypos, myMeshes, and myObjects.

Referenced by AddObject(), and Process().

void _pyGen::ClearCommands ( )
virtual

Clean commmands of removed objects depending on myIsPublished flag.

Reimplemented from _pyObject.

References myHypos, myMeshes, and myOrderedObjects.

Referenced by SMESH_2smeshpy::ConvertScript().

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

Change order of commands in the script.

Parameters
theCmd1- One command
theCmd2- Another command

References _pyCommand::GetOrderNb(), myCommands, and _pyCommand::SetOrderNb().

_pyID _pyObject::FatherID ( const _pyID childID)
staticinherited

Return ID of a father.

Referenced by _pySegmentLengthAroundVertexHyp::Addition2Creation().

ExportedMeshData& _pyGen::FindExportedMesh ( const _AString file)

References myFile2ExportedMesh.

Referenced by _pyMesh::_pyMesh().

void _pyGen::Flush ( )
virtual
void _pyGen::Free ( )
virtual

Release mutual handles of objects.

Reimplemented from _pyObject.

References id_obj, myFile2ExportedMesh, myHypos, myMeshEditors, myMeshes, and myObjects.

Referenced by SMESH_2smeshpy::ConvertScript().

_pyID _pyGen::GenerateNewID ( const _pyID theID)

Generated new ID for object and assign with existing name.

Parameters
theID- ID of existing object

References myObjectNames.

Referenced by _pyMesh::Flush().

int _pyObject::GetCommandNb ( )
inherited
int _pyObject::GetNbCalls ( ) const
inherited
std::list< Handle(_pyCommand) >& _pyObject::GetProcessedCmds ( )
inherited
_pyGen::Handle ( _pyCommand  ) const
_pyGen::Handle ( _pyCommand  )
_pyGen::Handle ( _pyObject  ) const
_pyGen::Handle ( _pySubMesh  ) const
_pyGen::Handle ( _pyHypothesis  ) const
_pyGen::Handle ( _pyHypothesis  ) const
const _pyID const _pyGen::Handle ( _pyHypothesis  )
_pyGen::Handle ( _pyHypothesisReader  ) const
_pyGen::Handle ( _pyCommand  )
private
_pyGen::Handle ( _pyHypothesisReader  )
private
bool _pyGen::IsGeomObject ( const _pyID theObjID) const

Check if a study entry is under GEOM component.

References _pyCommand::IsStudyEntry(), myGeomIDIndex, and myGeomIDNb.

Referenced by _pyHypothesis::GetReferredMeshesAndGeom(), and IsNotPublished().

bool _pyGen::IsNotPublished ( const _pyID theObjID) const

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

References IsGeomObject(), myObjectNames, and myStudy.

Referenced by _pyMesh::_pyMesh(), _pyHypothesis::GetReferredMeshesAndGeom(), and _pyObject::setID().

bool _pyGen::IsToKeepAllCommands ( ) const
void _pyGen::KeepAgrCmds ( const _pyID theObjID)
void _pyGen::ObjectCreationRemoved ( const _pyID theObjID)

Add an object to myRemovedObjIDs that leads to that SetName() for this object is not dumped.

Parameters
[in]theObjID- entry of the object whose creation command was eliminated

References myRemovedObjIDs.

void _pyGen::PlaceSubmeshAfterItsCreation ( Handle(_pyCommand theCmdUsingSubmesh) const

Prevent moving a command creating a sub-mesh to the end of the script if the sub-mesh is used in theCmdUsingSubmesh as argument.

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

References myID2AccessorMethod.

Referenced by _pyMesh::_pyMesh(), and _pyAlgorithm::Addition2Creation().

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

References setNeighbourCommand().

Referenced by _pyCommand::SetDependentCmdsAfter().

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

References setNeighbourCommand().

Referenced by _pyMesh::Flush().

void _pyObject::SetCreationCmd ( Handle(_pyCommand cmd)
inherited
void _pyObject::setID ( const _pyID theID)
protectedinherited

Set up myID and myIsPublished.

References _pyObject::GetID(), IsNotPublished(), _pyObject::myID, and _pyObject::myIsPublished.

Referenced by _pyGroup::_pyGroup(), and _pyObject::_pyObject().

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

References myCommands.

Referenced by SetCommandAfter(), and SetCommandBefore().

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.

References SMESH::DownCast(), Handle(), myMeshEditors, myMeshes, and myObjects.

Referenced by _pyGroup::Process().

virtual void _pyObject::SetRemovedFromStudy ( const bool  isRemoved)
virtualinherited

Reimplemented in _pyMesh.

References _pyObject::myIsPublished.

Referenced by _pyMesh::SetRemovedFromStudy().

Field Documentation

std::list< Handle(_pyCommand) > _pyObject::myArgCmds
protectedinherited
std::list< Handle(_pyCommand) > _pyGen::myCommands
private
std::map< _AString, ExportedMeshData > _pyGen::myFile2ExportedMesh
private
int _pyGen::myGeomIDIndex
private

Referenced by _pyGen(), and IsGeomObject().

int _pyGen::myGeomIDNb
private

Referenced by _pyGen(), and IsGeomObject().

std::map< _pyID, Handle(_pyHypothesis) > _pyGen::myHypos
private
_pyID _pyObject::myID
protectedinherited
Resource_DataMapOfAsciiStringAsciiString& _pyGen::myID2AccessorMethod
private

Referenced by SetAccessorMethod().

_pyStringFamily _pyGen::myKeepAgrCmdsIDs
private

Referenced by KeepAgrCmds().

std::map< _pyID, Handle(_pyMeshEditor) > _pyGen::myMeshEditors
private

Referenced by AddObject(), Free(), and SetProxyObject().

int _pyGen::myNbCommands
private

Referenced by Flush().

int _pyGen::myNbFilters
private
Resource_DataMapOfAsciiStringAsciiString& _pyGen::myObjectNames
private

Referenced by GenerateNewID(), and IsNotPublished().

std::map< _pyID, Handle(_pyObject) > _pyGen::myObjects
private
std::list< Handle(_pyObject) > _pyGen::myOrderedObjects
private

Referenced by AddObject(), ClearCommands(), and Flush().

std::list< Handle(_pyCommand) > _pyObject::myProcessedCmds
protectedinherited
std::set< TCollection_AsciiString >& _pyGen::myRemovedObjIDs
private

Referenced by ObjectCreationRemoved().

SALOMEDS::Study_var _pyGen::myStudy
private

Referenced by IsNotPublished().

bool _pyGen::myToKeepAllCommands
private

Referenced by IsToKeepAllCommands().

const _pyID& _pyGen::theMesh