Back to index

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

This hypothesis is used by "Radial prism" algorithm. More...

#include <StdMeshers_LayerDistribution_i.hxx>

Inheritance diagram for StdMeshers_LayerDistribution_i:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 StdMeshers_LayerDistribution_i (PortableServer::POA_ptr thePOA, int theStudyId,::SMESH_Gen *theGenImpl)
 StdMeshers_LayerDistribution_i::StdMeshers_LayerDistribution_i.
virtual ~StdMeshers_LayerDistribution_i ()
 StdMeshers_LayerDistribution_i::~StdMeshers_LayerDistribution_i.
void SetLayerDistribution (SMESH::SMESH_Hypothesis_ptr hyp1D) throw ( SALOME::SALOME_Exception )
 Sets 1D hypothesis specifying distribution of layers.
SMESH::SMESH_Hypothesis_ptr GetLayerDistribution ()
 Returns 1D hypothesis specifying distribution of layers.
::StdMeshers_LayerDistribution * GetImpl ()
 StdMeshers_LayerDistribution_i::GetImpl.
CORBA::Boolean IsDimSupported (SMESH::Dimension type)
 Verify whether hypothesis supports given entity type.
virtual char * SaveTo ()
 Write parameters in a string.
virtual void LoadFrom (const char *theStream)
 Retrieve parameters from the string.

Protected Member Functions

virtual void setOldParameters (const char *theParameters)
 Restore myMethod2VarParams by parameters stored in an old study.

Private Attributes

SMESH::SMESH_Hypothesis_var myHyp

Detailed Description

This hypothesis is used by "Radial prism" algorithm.

It specifies 1D hypothesis defining distribution of segments between the internal and the external surfaces.

Definition at line 47 of file StdMeshers_LayerDistribution_i.hxx.


Constructor & Destructor Documentation

StdMeshers_LayerDistribution_i::StdMeshers_LayerDistribution_i ( PortableServer::POA_ptr  thePOA,
int  theStudyId,
::SMESH_Gen *  theGenImpl 
)

StdMeshers_LayerDistribution_i::StdMeshers_LayerDistribution_i.

Constructor

Definition at line 48 of file StdMeshers_LayerDistribution_i.cxx.

  : SALOME::GenericObj_i( thePOA ), 
    SMESH_Hypothesis_i( thePOA )
{
  MESSAGE( "StdMeshers_LayerDistribution_i::StdMeshers_LayerDistribution_i" );
  myBaseImpl = new ::StdMeshers_LayerDistribution( theGenImpl->GetANewId(),
                                                   theStudyId,
                                                   theGenImpl );
}

StdMeshers_LayerDistribution_i::~StdMeshers_LayerDistribution_i.

Destructor

Definition at line 68 of file StdMeshers_LayerDistribution_i.cxx.

{
  MESSAGE( "StdMeshers_LayerDistribution_i::~StdMeshers_LayerDistribution_i" );
}

Member Function Documentation

StdMeshers_LayerDistribution * StdMeshers_LayerDistribution_i::GetImpl ( )

StdMeshers_LayerDistribution_i::GetImpl.

Get implementation

Reimplemented in StdMeshers_LayerDistribution2D_i.

Definition at line 133 of file StdMeshers_LayerDistribution_i.cxx.

{
  return ( ::StdMeshers_LayerDistribution* )myBaseImpl;
}

Here is the caller graph for this function:

Returns 1D hypothesis specifying distribution of layers.

StdMeshers_LayerDistribution_i::GetLayerDistribution.

Return values:
SMESH::SMESH_Hypothesis_ptr- 1D hypothesis

Returns <number of="" layers>=""> parameter value

Definition at line 119 of file StdMeshers_LayerDistribution_i.cxx.

{
  SMESH::SMESH_Hypothesis_var hyp = myHyp;
  return hyp._retn();
}

Verify whether hypothesis supports given entity type.

Parameters:
type- dimension (see SMESH::Dimension enumeration)
Return values:
CORBA::Boolean- TRUE if dimension is supported, FALSE otherwise

Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)

Reimplemented in StdMeshers_LayerDistribution2D_i.

Definition at line 147 of file StdMeshers_LayerDistribution_i.cxx.

{
  return type == SMESH::DIM_3D;
}
void StdMeshers_LayerDistribution_i::LoadFrom ( const char *  theStream) [virtual]

Retrieve parameters from the string.

Parameters:
theStream- the input string

Definition at line 185 of file StdMeshers_LayerDistribution_i.cxx.

{
  ASSERT( myBaseImpl );
  std::istringstream is( theStream );

  string typeName, libName;
  if ( is >> typeName &&
       is >> libName )
  {
    SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen();
    SALOMEDS::Study_var curStudy = gen->GetCurrentStudy();
    gen->SetCurrentStudy( SALOMEDS::Study::_nil() ); // prevent hypo publishing

    try {
      SMESH::SMESH_Hypothesis_var hyp1D =
        gen->CreateHypothesis( typeName.c_str(), libName.c_str() );
      SMESH_Hypothesis_i* hyp1D_i = SMESH::DownCast< SMESH_Hypothesis_i*>( hyp1D );
      if ( hyp1D_i ) {
        hyp1D_i->LoadFrom( & theStream[ (streamoff) is.tellg()+1 ]);
        this->GetImpl()->SetLayerDistribution( hyp1D_i->GetImpl() );
        myHyp = hyp1D;
        // as hyp1D is not published, its ID changes
        //SMESH::TPythonDump() << _this() << ".SetLayerDistribution( " << hyp1D << " )";

        // restore a mark of storage version ("VARS...")
        SMESH_Hypothesis_i::LoadFrom( & theStream[ (streamoff)is.tellg()+1 ]);
      }
    }
    catch (...) {
    }
    gen->SetCurrentStudy( curStudy );  // enable hypo publishing
  }
}

Here is the call graph for this function:

Write parameters in a string.

Return values:
char*- resulting string

Definition at line 159 of file StdMeshers_LayerDistribution_i.cxx.

{
  ASSERT( myBaseImpl );
  std::ostringstream os;

  ::SMESH_Hypothesis* hyp1D = GetImpl()->GetLayerDistribution();
  SMESH_Hypothesis_i* hyp1D_i = SMESH::DownCast< SMESH_Hypothesis_i*>( myHyp );
  if ( !hyp1D || !hyp1D_i )
    os << "NULL_HYPO ";
  else {
    os << hyp1D->GetName() << " "
       << hyp1D->GetLibName() << " "
       << hyp1D_i->SaveTo() << " ";
  }
  os << SMESH_Hypothesis_i::SaveTo();  // to have a mark of storage version ("VARS...")

  return CORBA::string_dup( os.str().c_str() );
}

Here is the call graph for this function:

void StdMeshers_LayerDistribution_i::SetLayerDistribution ( SMESH::SMESH_Hypothesis_ptr  hyp1D) throw ( SALOME::SALOME_Exception )

Sets 1D hypothesis specifying distribution of layers.

StdMeshers_LayerDistribution_i::SetLayerDistribution.

Parameters:
hyp1D- 1D hypothesis

Definition at line 81 of file StdMeshers_LayerDistribution_i.cxx.

{
  ASSERT( myBaseImpl );
  try {
    SMESH_Hypothesis_i * hyp_i = SMESH::DownCast< SMESH_Hypothesis_i*>( hyp1D );
    bool isNewHyp = ( hyp_i->GetImpl() != this->GetImpl()->GetLayerDistribution() );
    this->GetImpl()->SetLayerDistribution( hyp_i->GetImpl() );
    myHyp = SMESH::SMESH_Hypothesis::_duplicate( hyp1D );
    // Remove SO of 1D hypothesis if it was published
    if (SMESH_Gen_i* gen = SMESH_Gen_i::GetSMESHGen()) {
      SALOMEDS::Study_var study = gen->GetCurrentStudy();
      SALOMEDS::SObject_var SO = gen->ObjectToSObject( study, hyp1D );
      if ( ! SO->_is_nil() )
        study->NewBuilder()->RemoveObjectWithChildren( SO );
    }
    // Update Python script: write creation of 1D hyp as it is not published and
    // for this, SMESH_Gen does not write it's creation
    if ( isNewHyp )
      SMESH::TPythonDump() << hyp1D << " = "
                           << SMESH_Gen_i::GetSMESHGen() << ".CreateHypothesis('"
                           << hyp_i->GetName() << "', '" << hyp_i->GetLibName() << "')";
  }
  catch ( SALOME_Exception& S_ex ) {
    THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
  }
  // Update Python script
  SMESH::TPythonDump() << _this() << ".SetLayerDistribution( " << hyp1D << " )";
}
void StdMeshers_LayerDistribution_i::setOldParameters ( const char *  theParameters) [protected, virtual]

Restore myMethod2VarParams by parameters stored in an old study.

Definition at line 225 of file StdMeshers_LayerDistribution_i.cxx.

{
  if ( SMESH_Hypothesis_i* hyp1D_i = SMESH::DownCast< SMESH_Hypothesis_i*>( myHyp ))
    hyp1D_i->setOldParameters( theParameters );
}

Member Data Documentation

SMESH::SMESH_Hypothesis_var StdMeshers_LayerDistribution_i::myHyp [private]

Definition at line 87 of file StdMeshers_LayerDistribution_i.hxx.


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