Back to index

salome-smesh  6.5.0
Public Member Functions | Protected Member Functions
StdMeshers_LayerDistribution2D_i Class Reference

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

#include <StdMeshers_LayerDistribution2D_i.hxx>

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

List of all members.

Public Member Functions

 StdMeshers_LayerDistribution2D_i (PortableServer::POA_ptr thePOA, int theStudyId,::SMESH_Gen *theGenImpl)
 StdMeshers_LayerDistribution2D_i::StdMeshers_LayerDistribution2D_i.
virtual ~StdMeshers_LayerDistribution2D_i ()
 StdMeshers_LayerDistribution2D_i::~StdMeshers_LayerDistribution2D_i.
::StdMeshers_LayerDistribution2D * GetImpl ()
 StdMeshers_LayerDistribution2D_i::GetImpl.
CORBA::Boolean IsDimSupported (SMESH::Dimension type)
 Verify whether hypothesis supports given entity type.
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.
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.

Detailed Description

This hypothesis is used by "Radial quadrangle" algorithm.

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

Definition at line 40 of file StdMeshers_LayerDistribution2D_i.hxx.


Constructor & Destructor Documentation

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

StdMeshers_LayerDistribution2D_i::StdMeshers_LayerDistribution2D_i.

Constructor

Definition at line 38 of file StdMeshers_LayerDistribution2D_i.cxx.

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

StdMeshers_LayerDistribution2D_i::~StdMeshers_LayerDistribution2D_i.

Destructor

Definition at line 58 of file StdMeshers_LayerDistribution2D_i.cxx.

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

Member Function Documentation

StdMeshers_LayerDistribution2D * StdMeshers_LayerDistribution2D_i::GetImpl ( )

StdMeshers_LayerDistribution2D_i::GetImpl.

Get implementation

Reimplemented from StdMeshers_LayerDistribution_i.

Definition at line 71 of file StdMeshers_LayerDistribution2D_i.cxx.

{
  return ( ::StdMeshers_LayerDistribution2D* )myBaseImpl;
}
SMESH::SMESH_Hypothesis_ptr StdMeshers_LayerDistribution_i::GetLayerDistribution ( ) [inherited]

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 from StdMeshers_LayerDistribution_i.

Definition at line 85 of file StdMeshers_LayerDistribution2D_i.cxx.

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

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:

char * StdMeshers_LayerDistribution_i::SaveTo ( ) [virtual, inherited]

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 ) [inherited]

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, inherited]

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 );
}

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