Version: 6.3.1
Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes

_pyLayerDistributionHypo Class Reference

Class for LayerDistribution hypothesis conversion. More...

#include <SMESH_2smeshpy.hxx>

Inheritance diagram for _pyLayerDistributionHypo:
Inheritance graph
[legend]

Public Member Functions

 _pyLayerDistributionHypo (const Handle(_pyCommand)&theCreationCmd, const char *algoMethod)
void Process (const Handle(_pyCommand)&theCommand)
 Convert methods of 1D hypotheses to my own methods.
void Flush ()
 Finish conversion.
bool Addition2Creation (const Handle(_pyCommand)&theAdditionCmd, const _pyID &theMesh)
void SetConvMethodAndType (const char *creationMethod, const char *type)
void AddArgMethod (const char *method, const int nbArgs=1)
const
TColStd_SequenceOfAsciiString & 
GetArgs () const
const std::list< Handle(_pyCommand)> & GetArgCommands () const
void ClearAllCommands ()
 clear creation, arg and unkown commands
virtual bool IsAlgo () const
bool IsValid () const
bool IsWrapped () const
const _pyIDGetGeom () const
void SetMesh (const _pyID &theMeshId)
const _pyIDGetMesh () const
const TCollection_AsciiString & GetAlgoType () const
const TCollection_AsciiString & GetAlgoCreationMethod () const
bool CanBeCreatedBy (const TCollection_AsciiString &algoType) const
const TCollection_AsciiString & GetCreationMethod (const TCollection_AsciiString &algoType) const
virtual bool IsWrappable (const _pyID &theMesh)
const Handle (_pyCommand)&GetCreationCmd()
virtual void Assign (const Handle(_pyHypothesis)&theOther, const _pyID &theMesh)
 Assign fields of theOther to me except myIsWrapped.
const _pyIDGetID ()
int GetNbCalls () const
void SetCreationCmd (Handle(_pyCommand) cmd)
int GetCommandNb ()
virtual const char * AccessorMethod () const
 Return method name giving access to an interaface object wrapped by python class.

Static Public Member Functions

static Handle (_pyHypothesis) NewHypothesis(const Handle(_pyCommand)&theCreationCmd)
static _pyID FatherID (const _pyID &childID)
 Return ID of a father.

Protected Attributes

bool myIsAlgo
bool myIsWrapped
_pyID myGeom
_pyID myMesh
std::map
< TCollection_AsciiString,
TCollection_AsciiString > 
myType2CreationMethod
TColStd_SequenceOfAsciiString myArgs
TColStd_SequenceOfAsciiString myArgMethods
TColStd_SequenceOfInteger myNbArgsByMethod
std::list< Handle(_pyCommand)> myArgCommands
std::list< Handle(_pyCommand)> myUnknownCommands

Private Member Functions

 Handle (_pyHypothesis) my1dHyp

Private Attributes

TCollection_AsciiString myAlgoMethod

Detailed Description

Class for LayerDistribution hypothesis conversion.

Definition at line 374 of file SMESH_2smeshpy.hxx.


Constructor & Destructor Documentation

_pyLayerDistributionHypo._pyLayerDistributionHypo ( const Handle(_pyCommand)&  theCreationCmd,
const char *  algoMethod 
)

Definition at line 379 of file SMESH_2smeshpy.hxx.

                                                                                            :
    _pyHypothesis(theCreationCmd), myAlgoMethod((char*)algoMethod) {}

Member Function Documentation

const char * _pyObject::AccessorMethod ( ) const [virtual, inherited]

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

Return values:
constchar* - method name

Reimplemented in _pyGen, _pyMesh, and _pyAlgorithm.

Definition at line 2484 of file SMESH_2smeshpy.cxx.

{
  return 0;
}
void _pyHypothesis.AddArgMethod ( const char *  method,
const int  nbArgs = 1 
) [inherited]

Definition at line 305 of file SMESH_2smeshpy.hxx.

  { myArgMethods.Append( (char*)method ); myNbArgsByMethod.Append( nbArgs ); }
bool _pyLayerDistributionHypo::Addition2Creation ( const Handle(_pyCommand)&  theAdditionCmd,
const _pyID theMesh 
) [virtual]
Parameters:
theAdditionCmd- command to be converted
theMesh- mesh instance
Return values:
bool- status

Reimplemented from _pyHypothesis.

Definition at line 1746 of file SMESH_2smeshpy.cxx.

References _pyCommand.AddDependantCmd(), SMESH_box.geom, _pyHypothesis.GetAlgoType(), _pyCommand.GetArg(), _pyObject.GetID(), Handle(), myAlgoMethod, _pyHypothesis.myArgCommands, and _pyHypothesis.myIsWrapped.

{
  myIsWrapped = false;

  if ( my1dHyp.IsNull() )
    return false;

  // set "SetLayerDistribution()" after addition cmd
  theAdditionCmd->AddDependantCmd( myArgCommands.front() );

  _pyID geom = theAdditionCmd->GetArg( 1 );

  Handle(_pyHypothesis) algo = theGen->FindAlgo( geom, theMesh, this );
  if ( !algo.IsNull() )
  {
    my1dHyp->SetMesh( theMesh );
    my1dHyp->SetConvMethodAndType(my1dHyp->GetAlgoCreationMethod().ToCString(),
                                  algo->GetAlgoType().ToCString());
    if ( !my1dHyp->Addition2Creation( theAdditionCmd, theMesh ))
      return false;

    // clear "SetLayerDistribution()" cmd
    myArgCommands.back()->Clear();

    // Convert my creation => me = RadialPrismAlgo.Get3DHypothesis()

    // find RadialPrism algo created on <geom> for theMesh
    GetCreationCmd()->SetObject( algo->GetID() );
    GetCreationCmd()->SetMethod( myAlgoMethod );
    GetCreationCmd()->RemoveArgs();
    theAdditionCmd->AddDependantCmd( GetCreationCmd() );
    myIsWrapped = true;
  }
  return myIsWrapped;
}
void _pyHypothesis::Assign ( const Handle(_pyHypothesis)&  theOther,
const _pyID theMesh 
) [virtual, inherited]

Assign fields of theOther to me except myIsWrapped.

Definition at line 1647 of file SMESH_2smeshpy.cxx.

References _pyHypothesis.myArgCommands, _pyHypothesis.myArgMethods, _pyHypothesis.myArgs, _pyHypothesis.myGeom, _pyHypothesis.myIsAlgo, _pyHypothesis.myIsWrapped, _pyHypothesis.myMesh, _pyHypothesis.myNbArgsByMethod, _pyHypothesis.myType2CreationMethod, and _pyHypothesis.myUnknownCommands.

{
  myIsWrapped = false;
  myMesh = theMesh;

  // myCreationCmd = theOther->myCreationCmd;
  myIsAlgo = theOther->myIsAlgo;
  myGeom = theOther->myGeom;
  myType2CreationMethod = theOther->myType2CreationMethod;
  myArgs = theOther->myArgs;
  myArgMethods = theOther->myArgMethods;
  myNbArgsByMethod = theOther->myNbArgsByMethod;
  myArgCommands = theOther->myArgCommands;
  myUnknownCommands = theOther->myUnknownCommands;
}
bool _pyHypothesis.CanBeCreatedBy ( const TCollection_AsciiString &  algoType) const [inherited]

Definition at line 320 of file SMESH_2smeshpy.hxx.

  { return myType2CreationMethod.find( algoType ) != myType2CreationMethod.end(); }
void _pyHypothesis::ClearAllCommands ( ) [inherited]

clear creation, arg and unkown commands

Definition at line 1629 of file SMESH_2smeshpy.cxx.

References _pyHypothesis.myArgCommands, and _pyHypothesis.myUnknownCommands.

{
  GetCreationCmd()->Clear();
  list<Handle(_pyCommand)>::iterator cmd = myArgCommands.begin();
  for ( ; cmd != myArgCommands.end(); ++cmd )
    ( *cmd )->Clear();
  cmd = myUnknownCommands.begin();
  for ( ; cmd != myUnknownCommands.end(); ++cmd )
    ( *cmd )->Clear();
}
_pyID _pyObject::FatherID ( const _pyID childID) [static, inherited]

Return ID of a father.

Definition at line 2494 of file SMESH_2smeshpy.cxx.

Referenced by _pySegmentLengthAroundVertexHyp.Addition2Creation().

{
  int colPos = childID.SearchFromEnd(':');
  if ( colPos > 0 )
    return childID.SubString( 1, colPos-1 );
  return "";
}
void _pyLayerDistributionHypo::Flush ( ) [virtual]

Finish conversion.

Reimplemented from _pyHypothesis.

Definition at line 1789 of file SMESH_2smeshpy.cxx.

References _pyGen.GetCommands(), and _pyHypothesis.myArgCommands.

{
  // as creation of 1D hyp was written later then it's edition,
  // we need to find all it's edition calls and process them
  if ( !my1dHyp.IsNull() )
  {
    _pyID hyp1dID = my1dHyp->GetCreationCmd()->GetResultValue();

    // make a new name for 1D hyp = "HypType" + "_Distribution"
    _pyID newName;
    if ( my1dHyp->IsWrapped() ) {
      newName = my1dHyp->GetCreationCmd()->GetMethod();
    }
    else {
      TCollection_AsciiString hypTypeQuoted = my1dHyp->GetCreationCmd()->GetArg(1);
      newName = hypTypeQuoted.SubString( 2, hypTypeQuoted.Length() - 1 );
    }
    newName += "_Distribution";
    my1dHyp->GetCreationCmd()->SetResultValue( newName );

    list< Handle(_pyCommand) >& cmds = theGen->GetCommands();
    list< Handle(_pyCommand) >::iterator cmdIt = cmds.begin();
    for ( ; cmdIt != cmds.end(); ++cmdIt ) {
      const _pyID& objID = (*cmdIt)->GetObject();
      if ( objID == hyp1dID ) {
        my1dHyp->Process( *cmdIt );
        my1dHyp->GetCreationCmd()->AddDependantCmd( *cmdIt );
        ( *cmdIt )->SetObject( newName );
      }
    }
    // Set new hyp name to SetLayerDistribution() cmd
    if ( !myArgCommands.empty() && !myArgCommands.back()->IsEmpty() )
      myArgCommands.back()->SetArg( 1, newName );
  }
}
const TCollection_AsciiString& _pyHypothesis.GetAlgoCreationMethod ( ) const [inherited]

Definition at line 318 of file SMESH_2smeshpy.hxx.

Referenced by _pyHypothesis.Addition2Creation().

  { return myType2CreationMethod.begin()->second; }
const TCollection_AsciiString& _pyHypothesis.GetAlgoType ( ) const [inherited]

Definition at line 316 of file SMESH_2smeshpy.hxx.

Referenced by Addition2Creation(), and _pyHypothesis.Addition2Creation().

  { return myType2CreationMethod.begin()->first; }
const std::list<Handle(_pyCommand)>& _pyHypothesis.GetArgCommands ( ) const [inherited]

Definition at line 308 of file SMESH_2smeshpy.hxx.

{ return myArgCommands; }
const TColStd_SequenceOfAsciiString& _pyHypothesis.GetArgs ( ) const [inherited]

Definition at line 307 of file SMESH_2smeshpy.hxx.

{ return myArgs; }
int _pyObject.GetCommandNb ( ) [inherited]

Definition at line 167 of file SMESH_2smeshpy.hxx.

{ return myCreationCmd->GetOrderNb(); }
const TCollection_AsciiString& _pyHypothesis.GetCreationMethod ( const TCollection_AsciiString &  algoType) const [inherited]

Definition at line 322 of file SMESH_2smeshpy.hxx.

Referenced by _pyHypothesis.Addition2Creation().

  { return myType2CreationMethod.find( algoType )->second; }
const _pyID& _pyHypothesis.GetGeom ( ) const [inherited]

Definition at line 313 of file SMESH_2smeshpy.hxx.

{ return myGeom; }
const _pyID& _pyObject.GetID ( ) [inherited]

Definition at line 162 of file SMESH_2smeshpy.hxx.

Referenced by _pyMesh._pyMesh(), _pyAlgorithm.Addition2Creation(), Addition2Creation(), _pyHypothesis.Addition2Creation(), and _pyMesh.Flush().

{ return myCreationCmd->GetResultValue(); }
const _pyID& _pyHypothesis.GetMesh ( ) const [inherited]

Definition at line 315 of file SMESH_2smeshpy.hxx.

{ return myMesh; }
int _pyObject.GetNbCalls ( ) const [inherited]

Definition at line 165 of file SMESH_2smeshpy.hxx.

References _pyObject.myNbCalls.

Referenced by _pySubMesh.Flush(), and _pySelfEraser.Flush().

{ return myNbCalls; }
_pyLayerDistributionHypo.Handle ( _pyHypothesis  ) [private]

Referenced by Addition2Creation(), and Process().

static _pyHypothesis.Handle ( _pyHypothesis  ) const [static, inherited]
const _pyObject.Handle ( _pyCommand  ) [inherited]

Reimplemented in _pyGen, and _pyGen.

Definition at line 164 of file SMESH_2smeshpy.hxx.

{ return myCreationCmd; }
virtual bool _pyHypothesis.IsAlgo ( ) const [virtual, inherited]

Definition at line 310 of file SMESH_2smeshpy.hxx.

Referenced by _pyHypothesis.Addition2Creation().

{ return myIsAlgo; }
bool _pyHypothesis.IsValid ( ) const [inherited]

Definition at line 311 of file SMESH_2smeshpy.hxx.

{ return !myType2CreationMethod.empty(); }
virtual bool _pyHypothesis.IsWrappable ( const _pyID theMesh) [virtual, inherited]
bool _pyHypothesis.IsWrapped ( ) const [inherited]
void _pyLayerDistributionHypo::Process ( const Handle(_pyCommand)&  theCommand) [virtual]

Convert methods of 1D hypotheses to my own methods.

Parameters:
theCommand- The called hypothesis method

Reimplemented from _pyHypothesis.

Definition at line 1714 of file SMESH_2smeshpy.cxx.

References _pyCommand.GetArg(), _pyCommand.GetMethod(), Handle(), and _pyHypothesis.myArgCommands.

{
  if ( theCommand->GetMethod() != "SetLayerDistribution" )
    return;

  _pyID newName; // name for 1D hyp = "HypType" + "_Distribution"

  const _pyID& hyp1dID = theCommand->GetArg( 1 );
  Handle(_pyHypothesis) hyp1d = theGen->FindHyp( hyp1dID );
  if ( hyp1d.IsNull() ) // apparently hypId changed at study restoration
    hyp1d = my1dHyp;
  else if ( !my1dHyp.IsNull() && hyp1dID != my1dHyp->GetID() ) {
    // 1D hypo is already set, so distribution changes and the old
    // 1D hypo is thrown away
    my1dHyp->ClearAllCommands();
  }
  my1dHyp = hyp1d;

  if ( !myArgCommands.empty() )
    myArgCommands.front()->Clear();
  myArgCommands.push_back( theCommand );
}
void _pyHypothesis.SetConvMethodAndType ( const char *  creationMethod,
const char *  type 
) [inherited]

Definition at line 303 of file SMESH_2smeshpy.hxx.

  { myType2CreationMethod[ (char*)type ] = (char*)creationMethod; }
void _pyObject.SetCreationCmd ( Handle(_pyCommand cmd) [inherited]

Definition at line 166 of file SMESH_2smeshpy.hxx.

Referenced by _pyHypothesis.Addition2Creation().

{ myCreationCmd = cmd; }
void _pyHypothesis.SetMesh ( const _pyID theMeshId) [inherited]

Definition at line 314 of file SMESH_2smeshpy.hxx.

{ if ( myMesh.IsEmpty() ) myMesh = theMeshId; }

Field Documentation

TCollection_AsciiString _pyLayerDistributionHypo.myAlgoMethod [private]

Definition at line 377 of file SMESH_2smeshpy.hxx.

Referenced by Addition2Creation().

std::list<Handle(_pyCommand)> _pyHypothesis.myArgCommands [protected, inherited]
TColStd_SequenceOfAsciiString _pyHypothesis.myArgMethods [protected, inherited]

Definition at line 297 of file SMESH_2smeshpy.hxx.

Referenced by _pyHypothesis.Assign(), and _pyHypothesis.Process().

TColStd_SequenceOfAsciiString _pyHypothesis.myArgs [protected, inherited]
_pyID _pyHypothesis.myGeom [protected, inherited]

Definition at line 292 of file SMESH_2smeshpy.hxx.

Referenced by _pyHypothesis.Addition2Creation(), and _pyHypothesis.Assign().

bool _pyHypothesis.myIsAlgo [protected, inherited]
bool _pyHypothesis.myIsWrapped [protected, inherited]
_pyID _pyHypothesis.myMesh [protected, inherited]

Definition at line 292 of file SMESH_2smeshpy.hxx.

Referenced by _pyHypothesis.Assign().

TColStd_SequenceOfInteger _pyHypothesis.myNbArgsByMethod [protected, inherited]

Definition at line 298 of file SMESH_2smeshpy.hxx.

Referenced by _pyHypothesis.Assign(), and _pyHypothesis.Process().

std::map<TCollection_AsciiString, TCollection_AsciiString > _pyHypothesis.myType2CreationMethod [protected, inherited]

Definition at line 294 of file SMESH_2smeshpy.hxx.

Referenced by _pyHypothesis.Assign().

std::list<Handle(_pyCommand)> _pyHypothesis.myUnknownCommands [protected, inherited]
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