Back to index

salome-smesh  6.5.0
Public Member Functions
StdMeshers::StdMeshers_NumberOfSegments Interface Reference

StdMeshers_NumberOfSegments: interface of "Nb. Segments" hypothesis. More...

import "SMESH_BasicHypothesis.idl";

Inheritance diagram for StdMeshers::StdMeshers_NumberOfSegments:
Inheritance graph
[legend]
Collaboration diagram for StdMeshers::StdMeshers_NumberOfSegments:
Collaboration graph
[legend]

List of all members.

Public Member Functions

SMESH::double_array BuildDistributionExpr (in string func, in long nbSeg, in long conv) raises (SALOME::SALOME_Exception)
 Builds and returns point distribution according to passed density function.
SMESH::double_array BuildDistributionTab (in SMESH::double_array func, in long nbSeg, in long conv) raises (SALOME::SALOME_Exception)
void SetNumberOfSegments (in long segmentsNumber) raises (SALOME::SALOME_Exception)
 Sets <number of="" segments>=""> parameter value.
long GetNumberOfSegments ()
 Returns <number of="" segments>=""> parameter value.
void SetDistrType (in long typ) raises (SALOME::SALOME_Exception)
 Sets <distribution type>=""> parameter value.
long GetDistrType ()
 Returns <distribution type>=""> parameter value.
void SetScaleFactor (in double scaleFactor) raises (SALOME::SALOME_Exception)
 Sets <scale factor>=""> parameter value.
double GetScaleFactor () raises (SALOME::SALOME_Exception)
 Returns <scale factor>=""> parameter value.
void SetTableFunction (in SMESH::double_array table) raises (SALOME::SALOME_Exception)
 Sets.
SMESH::double_array GetTableFunction () raises (SALOME::SALOME_Exception)
 Returns.
void SetExpressionFunction (in string expr) raises (SALOME::SALOME_Exception)
 Sets <expression function>=""> parameter value for distribution DT_ExprFunc.
string GetExpressionFunction () raises (SALOME::SALOME_Exception)
 Returns <expression function>=""> parameter value for distribution DT_ExprFunc.
void SetConversionMode (in long conv) raises (SALOME::SALOME_Exception)
 Sets <conversion mode>=""> parameter value for functional distributions.
long ConversionMode () raises (SALOME::SALOME_Exception)
 Returns <conversion mode>=""> parameter value for functional distributions.
void SetReversedEdges (in SMESH::long_array list)
 Set list of edges to reverse.
SMESH::long_array GetReversedEdges ()
 Returns list of edges to reverse.
void SetObjectEntry (in string entry)
 Set entry of the main object.
string GetObjectEntry ()
 Get the entry of the main object.
string GetName ()
 Get the Hypothesis typeName.
string GetLibName ()
 Get the Hypothesis plugin library Name.
long GetId ()
 Get the internal Id.
void SetVarParameter (in string parameter, in string method)
 Set the variable parameter.
string GetVarParameter (in string methodName)
 Return the variable parameter used for Hypothesis creation by name of method setting this parameter.
void SetParameters (in string theParameters)
 Set list of parameters.
string GetParameters ()
 Return list of notebook variables used for Hypothesis creation separated by ":" symbol.
ListOfParameters GetLastParameters ()
 Return list of last notebook variables used for Hypothesis creation.
void SetLastParameters (in string theParameters)
 Set list of parameters.
void ClearParameters ()
 Clear parameters list.
boolean IsDimSupported (in Dimension type)
 Verify whether hypothesis supports given entity type.

Detailed Description

StdMeshers_NumberOfSegments: interface of "Nb. Segments" hypothesis.

Definition at line 133 of file SMESH_BasicHypothesis.idl.


Member Function Documentation

const vector< double > & StdMeshers_NumberOfSegments::BuildDistributionExpr ( in string  func,
in long  nbSeg,
in long  conv 
) raises (SALOME::SALOME_Exception)

Builds and returns point distribution according to passed density function.

Definition at line 95 of file StdMeshers_NumberOfSegments.cxx.

{
  if( !buildDistribution( TCollection_AsciiString( ( Standard_CString )expr ), conv, 0.0, 1.0, nbSeg, _distr, 1E-4 ) )
    _distr.resize( 0 );
  return _distr;
}

Here is the call graph for this function:

const vector< double > & StdMeshers_NumberOfSegments::BuildDistributionTab ( in SMESH::double_array  func,
in long  nbSeg,
in long  conv 
) raises (SALOME::SALOME_Exception)

Definition at line 104 of file StdMeshers_NumberOfSegments.cxx.

{
  if( !buildDistribution( tab, conv, 0.0, 1.0, nbSeg, _distr, 1E-4 ) )
    _distr.resize( 0 );
  return _distr;
}

Here is the call graph for this function:

void SMESH_Hypothesis::ClearParameters ( ) [inherited]

Clear parameters list.

Definition at line 196 of file SMESH_Hypothesis.cxx.

{
  _parameters = string();
}
int StdMeshers_NumberOfSegments::ConversionMode ( ) raises (SALOME::SALOME_Exception)

Returns <conversion mode>=""> parameter value for functional distributions.

Definition at line 487 of file StdMeshers_NumberOfSegments.cxx.

{
//   if (_distrType != DT_TabFunc && _distrType != DT_ExprFunc)
//     throw SALOME_Exception(LOCALIZED("not a functional distribution"));
  return _convMode;
}
StdMeshers_NumberOfSegments::DistrType StdMeshers_NumberOfSegments::GetDistrType ( )

Returns <distribution type>=""> parameter value.

Definition at line 168 of file StdMeshers_NumberOfSegments.cxx.

{
  return _distrType;
}
const char * StdMeshers_NumberOfSegments::GetExpressionFunction ( ) raises (SALOME::SALOME_Exception)

Returns <expression function>=""> parameter value for distribution DT_ExprFunc.

Definition at line 454 of file StdMeshers_NumberOfSegments.cxx.

{
  if (_distrType != DT_ExprFunc)
    throw SALOME_Exception(LOCALIZED("not an expression function distribution"));
  return _func.c_str();
}
long SMESH::SMESH_Hypothesis::GetId ( ) [inherited]

Get the internal Id.

char * SMESH_Hypothesis::GetLastParameters ( ) [inherited]

Return list of last notebook variables used for Hypothesis creation.

Definition at line 216 of file SMESH_Hypothesis.cxx.

{
  return (char*)_lastParameters.c_str();
}
const char * SMESH_Hypothesis::GetLibName ( ) [inherited]

Get the Hypothesis plugin library Name.

Definition at line 141 of file SMESH_Hypothesis.cxx.

{
  return _libName.c_str();
}
string SMESH::SMESH_Hypothesis::GetName ( ) [inherited]

Get the Hypothesis typeName.

Here is the caller graph for this function:

Returns <number of="" segments>=""> parameter value.

Definition at line 138 of file StdMeshers_NumberOfSegments.cxx.

{
  return _numberOfSegments;
}

Get the entry of the main object.

char * SMESH_Hypothesis::GetParameters ( ) [inherited]

Return list of notebook variables used for Hypothesis creation separated by ":" symbol.

Definition at line 206 of file SMESH_Hypothesis.cxx.

{
  return (char*)_parameters.c_str();
}

Returns list of edges to reverse.

double StdMeshers_NumberOfSegments::GetScaleFactor ( ) raises (SALOME::SALOME_Exception)

Returns <scale factor>=""> parameter value.

Definition at line 203 of file StdMeshers_NumberOfSegments.cxx.

{
  if (_distrType != DT_Scale)
    throw SALOME_Exception(LOCALIZED("not a scale distribution"));
  return _scaleFactor;
}
const vector< double > & StdMeshers_NumberOfSegments::GetTableFunction ( ) raises (SALOME::SALOME_Exception)

Returns.

value for distribution DT_TabFunc

Definition at line 284 of file StdMeshers_NumberOfSegments.cxx.

{
  if (_distrType != DT_TabFunc)
    throw SALOME_Exception(LOCALIZED("not a table function distribution"));
  return _table;
}
string SMESH::SMESH_Hypothesis::GetVarParameter ( in string  methodName) [inherited]

Return the variable parameter used for Hypothesis creation by name of method setting this parameter.

boolean SMESH::SMESH_Hypothesis::IsDimSupported ( in Dimension  type) [inherited]

Verify whether hypothesis supports given entity type.

void StdMeshers_NumberOfSegments::SetConversionMode ( in long  conv) raises (SALOME::SALOME_Exception)

Sets <conversion mode>=""> parameter value for functional distributions.

Definition at line 468 of file StdMeshers_NumberOfSegments.cxx.

{
//   if (_distrType != DT_TabFunc && _distrType != DT_ExprFunc)
//     throw SALOME_Exception(LOCALIZED("not a functional distribution"));

  if( conv != _convMode )
  {
    _convMode = conv;
    NotifySubMeshesHypothesisModification();
  }
}
void StdMeshers_NumberOfSegments::SetDistrType ( in long  typ) raises (SALOME::SALOME_Exception)

Sets <distribution type>=""> parameter value.

Definition at line 149 of file StdMeshers_NumberOfSegments.cxx.

{
  if (typ < DT_Regular || typ > DT_ExprFunc)
    throw SALOME_Exception(LOCALIZED("distribution type is out of range"));

  if (typ != _distrType)
  {
    _distrType = typ;
    NotifySubMeshesHypothesisModification();
  }
}
void StdMeshers_NumberOfSegments::SetExpressionFunction ( in string  expr) raises (SALOME::SALOME_Exception)

Sets <expression function>=""> parameter value for distribution DT_ExprFunc.

Definition at line 391 of file StdMeshers_NumberOfSegments.cxx.

{
  if (_distrType != DT_ExprFunc)
    _distrType = DT_ExprFunc;
    //throw SALOME_Exception(LOCALIZED("not an expression function distribution"));

  string func = CheckExpressionFunction( expr, _convMode );
  if( _func != func )
  {
    _func = func;
    NotifySubMeshesHypothesisModification();
  }
}
void SMESH_Hypothesis::SetLastParameters ( in string  theParameters) [inherited]

Set list of parameters.

Parameters:
theParametersis a string containing the last notebook variables separated by ":" symbol, used for Hypothesis creation

Definition at line 226 of file SMESH_Hypothesis.cxx.

{
  _lastParameters = string(theParameters);
}
void StdMeshers_NumberOfSegments::SetNumberOfSegments ( in long  segmentsNumber) raises (SALOME::SALOME_Exception)

Sets <number of="" segments>=""> parameter value.

Definition at line 120 of file StdMeshers_NumberOfSegments.cxx.

{
  int oldNumberOfSegments = _numberOfSegments;
  if (segmentsNumber <= 0)
    throw SALOME_Exception(LOCALIZED("number of segments must be positive"));
  _numberOfSegments = segmentsNumber;

  if (oldNumberOfSegments != _numberOfSegments)
    NotifySubMeshesHypothesisModification();
}

Set entry of the main object.

void SMESH_Hypothesis::SetParameters ( in string  theParameters) [inherited]

Set list of parameters.

Parameters:
theParametersis a string containing the notebook variables separated by ":" symbol, used for Hypothesis creation

Definition at line 180 of file SMESH_Hypothesis.cxx.

{
  string aNewParameters(theParameters);
  if(aNewParameters.size()==0 && _parameters.size()==0)
    aNewParameters = " ";
  if(_parameters.size()>0)
    _parameters +="|";
  _parameters +=aNewParameters;
  SetLastParameters(theParameters);
}

Here is the call graph for this function:

Set list of edges to reverse.

Definition at line 743 of file StdMeshers_NumberOfSegments.cxx.

{
  if ( ids != _edgeIDs ) {
    _edgeIDs = ids;

    NotifySubMeshesHypothesisModification();
  }
}
void StdMeshers_NumberOfSegments::SetScaleFactor ( in double  scaleFactor) raises (SALOME::SALOME_Exception)

Sets <scale factor>=""> parameter value.

Definition at line 179 of file StdMeshers_NumberOfSegments.cxx.

{
  if (_distrType != DT_Scale)
    _distrType = DT_Scale;
    //throw SALOME_Exception(LOCALIZED("not a scale distribution"));
  if (scaleFactor < PRECISION)
    throw SALOME_Exception(LOCALIZED("scale factor must be positive"));
  //if (fabs(scaleFactor - 1.0) < PRECISION)
  //  throw SALOME_Exception(LOCALIZED("scale factor must not be equal to 1"));

  if (fabs(_scaleFactor - scaleFactor) > PRECISION)
  {
    _scaleFactor = scaleFactor;
    NotifySubMeshesHypothesisModification();
  }
}
void StdMeshers_NumberOfSegments::SetTableFunction ( in SMESH::double_array  table) raises (SALOME::SALOME_Exception)

Sets.

value for distribution DT_TabFunc

Definition at line 217 of file StdMeshers_NumberOfSegments.cxx.

{
  if (_distrType != DT_TabFunc)
    _distrType = DT_TabFunc;
  //throw SALOME_Exception(LOCALIZED("not a table function distribution"));
  if ( (table.size() % 2) != 0 )
    throw SALOME_Exception(LOCALIZED("odd size of vector of table function"));

  int i;
  double prev = -PRECISION;
  bool isSame = table.size() == _table.size();

  bool pos = false;
  for (i=0; i < table.size()/2; i++) {
    double par = table[i*2];
    double val = table[i*2+1];
    if( _convMode==0 )
    {
      try {
#ifdef NO_CAS_CATCH
        OCC_CATCH_SIGNALS;
#endif
        val = pow( 10.0, val );
      } catch(Standard_Failure) {
        Handle(Standard_Failure) aFail = Standard_Failure::Caught();
        throw SALOME_Exception( LOCALIZED( "invalid value"));
        return;
      }
    }
    else if( _convMode==1 && val<0.0 )
      val = 0.0;

    if ( par<0 || par > 1)
      throw SALOME_Exception(LOCALIZED("parameter of table function is out of range [0,1]"));
    if ( fabs(par-prev)<PRECISION )
      throw SALOME_Exception(LOCALIZED("two parameters are the same"));
    if ( val < 0 )
      throw SALOME_Exception(LOCALIZED("value of table function is not positive"));
    if( val>PRECISION )
      pos = true;
    if (isSame)
    {
      double oldpar = _table[i*2];
      double oldval = _table[i*2+1];
      if (fabs(par - oldpar) > PRECISION || fabs(val - oldval) > PRECISION)
        isSame = false;
    }
    prev = par;
  }

  if( !pos )
    throw SALOME_Exception(LOCALIZED("value of table function is not positive"));

  if( pos && !isSame )
  {
    _table = table;
    NotifySubMeshesHypothesisModification();
  }
}

Here is the call graph for this function:

void SMESH::SMESH_Hypothesis::SetVarParameter ( in string  parameter,
in string  method 
) [inherited]

Set the variable parameter.

Parameters:
parameteris a string containing the notebook variable used for Hypothesis creation
methodis a name of Hypothesis method setting this parameter

This method must be called before calling method()


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