SALOME - SMESH
StdMeshers_NumberOfSegments Class Reference

This class represents hypothesis for 1d algorithm. More...

#include <StdMeshers_NumberOfSegments.hxx>

Inheritance diagram for StdMeshers_NumberOfSegments:
Inheritance graph
Collaboration diagram for StdMeshers_NumberOfSegments:
Collaboration graph

Public Types

enum  DistrType { DT_Regular, DT_Scale, DT_TabFunc, DT_ExprFunc }
 This enumeration presents available types of distribution. More...
 
enum  Hypothesis_Status {
  HYP_OK = 0, HYP_MISSING, HYP_CONCURENT, HYP_BAD_PARAMETER,
  HYP_HIDDEN_ALGO, HYP_HIDING_ALGO, HYP_UNKNOWN_FATAL, HYP_INCOMPATIBLE,
  HYP_NOTCONFORM, HYP_ALREADY_EXIST, HYP_BAD_DIM, HYP_BAD_SUBSHAPE,
  HYP_BAD_GEOMETRY, HYP_NEED_SHAPE
}
 
enum  hypothesis_type {
  PARAM_ALGO, ALGO_0D, ALGO_1D, ALGO_2D,
  ALGO_3D
}
 

Public Member Functions

 StdMeshers_NumberOfSegments (int hypId, int studyId, SMESH_Gen *gen)
 
virtual ~StdMeshers_NumberOfSegments ()
 
const std::vector< double > & BuildDistributionExpr (const char *, int, int) throw ( SMESH_Exception )
 
const std::vector< double > & BuildDistributionTab (const std::vector< double > &, int, int) throw ( SMESH_Exception )
 
void SetNumberOfSegments (int segmentsNumber) throw ( SMESH_Exception )
 Set the number of segments. More...
 
int GetNumberOfSegments () const
 Get the number of segments. More...
 
void SetDistrType (DistrType typ) throw ( SMESH_Exception )
 Set distribution type. More...
 
DistrType GetDistrType () const
 Get distribution type. More...
 
virtual void SetScaleFactor (double scaleFactor) throw ( SMESH_Exception )
 Set scale factor for scale distribution. More...
 
double GetScaleFactor () const throw ( SMESH_Exception )
 Get scale factor for scale distribution. More...
 
void SetTableFunction (const std::vector< double > &table) throw ( SMESH_Exception )
 Set table function for distribution DT_TabFunc. More...
 
const std::vector< double > & GetTableFunction () const throw ( SMESH_Exception )
 Get table function for distribution DT_TabFunc. More...
 
void SetExpressionFunction (const char *expr) throw ( SMESH_Exception )
 Set expression function for distribution DT_ExprFunc. More...
 
const char * GetExpressionFunction () const throw ( SMESH_Exception )
 Get expression function for distribution DT_ExprFunc. More...
 
void SetConversionMode (int conv) throw ( SMESH_Exception )
 Set conversion mode. When it is 0, it means "exponent mode": the function of distribution of density is used as an exponent of 10, i,e, 10^f(t). When it is 1, it means "cut negative mode". The function of distribution is used as F(t), where F(t0)=f(t0), if f(t0)>=0, otherwise F(t0) = 0. This mode is sensible only when function distribution is used (DT_TabFunc or DT_ExprFunc) More...
 
int ConversionMode () const throw ( SMESH_Exception )
 Returns conversion mode. More...
 
void SetReversedEdges (std::vector< int > &ids)
 
void SetObjectEntry (const char *entry)
 
const char * GetObjectEntry ()
 
const std::vector< int > & GetReversedEdges () const
 
virtual bool SetParametersByMesh (const SMESH_Mesh *theMesh, const TopoDS_Shape &theShape)
 Initialize number of segments by the mesh built on the geometry. More...
 
virtual bool SetParametersByDefaults (const TDefaults &dflts, const SMESH_Mesh *theMesh=0)
 Initialize my parameter values by default parameters. More...
 
virtual std::ostream & SaveTo (std::ostream &save)
 
virtual std::istream & LoadFrom (std::istream &load)
 
virtual int GetDim () const
 
int GetStudyId () const
 
virtual void NotifySubMeshesHypothesisModification ()
 
virtual int GetShapeType () const
 
virtual const char * GetLibName () const
 
void SetLibName (const char *theLibName)
 
void SetParameters (const char *theParameters)
 
char * GetParameters () const
 
void SetLastParameters (const char *theParameters)
 
char * GetLastParameters () const
 
void ClearParameters ()
 
virtual bool IsAuxiliary () const
 Return true if me is an auxiliary hypothesis. More...
 
const char * GetName () const
 
int GetID () const
 
int GetType () const
 

Static Public Member Functions

static bool IsStatusFatal (Hypothesis_Status theStatus)
 

Protected Attributes

int _numberOfSegments
 an edge will be split on to this number of segments More...
 
DistrType _distrType
 the type of distribution of density function More...
 
double _scaleFactor
 the scale parameter for DT_Scale More...
 
std::vector< double > _table
 
std::vector< double > _distr
 the table for DT_TabFunc, a sequence of pairs of numbers More...
 
std::string _func
 the expression of the function for DT_ExprFunc More...
 
int _convMode
 flag of conversion mode: 0=exponent, 1=cut negative More...
 
std::vector< int_edgeIDs
 list of reversed edges ids More...
 
std::string _objEntry
 Entry of the main object to reverse edges. More...
 
SMESH_Gen_gen
 
int _studyId
 
int _shapeType
 
int _param_algo_dim
 
std::string _name
 
int _hypId
 
int _type
 

Friends

std::ostream & operator<< (std::ostream &save, StdMeshers_NumberOfSegments &hyp)
 
std::istream & operator>> (std::istream &load, StdMeshers_NumberOfSegments &hyp)
 

Detailed Description

This class represents hypothesis for 1d algorithm.

It provides parameters for subdivision an edge by various distribution types, considering the given number of resulting segments

Definition at line 43 of file StdMeshers_NumberOfSegments.hxx.

Member Enumeration Documentation

◆ DistrType

This enumeration presents available types of distribution.

Enumerator
DT_Regular 

equidistant distribution

DT_Scale 

scale distribution

DT_TabFunc 

distribution with density function presented by table

DT_ExprFunc 

distribution with density function presented by expression

Definition at line 69 of file StdMeshers_NumberOfSegments.hxx.

◆ Hypothesis_Status

Enumerator
HYP_OK 
HYP_MISSING 
HYP_CONCURENT 
HYP_BAD_PARAMETER 
HYP_HIDDEN_ALGO 
HYP_HIDING_ALGO 
HYP_UNKNOWN_FATAL 
HYP_INCOMPATIBLE 
HYP_NOTCONFORM 
HYP_ALREADY_EXIST 
HYP_BAD_DIM 
HYP_BAD_SUBSHAPE 
HYP_BAD_GEOMETRY 
HYP_NEED_SHAPE 

Definition at line 50 of file SMESH_Hypothesis.hxx.

◆ hypothesis_type

Enumerator
PARAM_ALGO 
ALGO_0D 
ALGO_1D 
ALGO_2D 
ALGO_3D 

Definition at line 49 of file SMESHDS_Hypothesis.hxx.

Constructor & Destructor Documentation

◆ StdMeshers_NumberOfSegments()

StdMeshers_NumberOfSegments::StdMeshers_NumberOfSegments ( int  hypId,
int  studyId,
SMESH_Gen gen 
)

◆ ~StdMeshers_NumberOfSegments()

virtual StdMeshers_NumberOfSegments::~StdMeshers_NumberOfSegments ( )
virtual

Member Function Documentation

◆ BuildDistributionExpr()

const std::vector<double>& StdMeshers_NumberOfSegments::BuildDistributionExpr ( const char *  ,
int  ,
int   
)
throw (SMESH_Exception
)

◆ BuildDistributionTab()

const std::vector<double>& StdMeshers_NumberOfSegments::BuildDistributionTab ( const std::vector< double > &  ,
int  ,
int   
)
throw (SMESH_Exception
)

◆ SetNumberOfSegments()

void StdMeshers_NumberOfSegments::SetNumberOfSegments ( int  segmentsNumber)
throw (SMESH_Exception
)

Set the number of segments.

Parameters
segmentsNumber- must be greater than zero

◆ GetNumberOfSegments()

int StdMeshers_NumberOfSegments::GetNumberOfSegments ( ) const

Get the number of segments.

◆ SetDistrType()

void StdMeshers_NumberOfSegments::SetDistrType ( DistrType  typ)
throw (SMESH_Exception
)

Set distribution type.

◆ GetDistrType()

DistrType StdMeshers_NumberOfSegments::GetDistrType ( ) const

Get distribution type.

◆ SetScaleFactor()

virtual void StdMeshers_NumberOfSegments::SetScaleFactor ( double  scaleFactor)
throw (SMESH_Exception
)
virtual

Set scale factor for scale distribution.

Parameters
scaleFactor- positive value different from 1

Throws SALOME_Exception if distribution type is not DT_Scale, or scaleFactor is not a positive value different from 1

◆ GetScaleFactor()

double StdMeshers_NumberOfSegments::GetScaleFactor ( ) const
throw (SMESH_Exception
)

Get scale factor for scale distribution.

Throws SALOME_Exception if distribution type is not DT_Scale

◆ SetTableFunction()

void StdMeshers_NumberOfSegments::SetTableFunction ( const std::vector< double > &  table)
throw (SMESH_Exception
)

Set table function for distribution DT_TabFunc.

Parameters
table- this vector contains the pairs (parameter, value) following each by other, so the number of elements in the vector must be even. The parameters must be in range [0,1] and sorted in increase order. The values of function must be positive.

Throws SALOME_Exception if distribution type is not DT_TabFunc

◆ GetTableFunction()

const std::vector<double>& StdMeshers_NumberOfSegments::GetTableFunction ( ) const
throw (SMESH_Exception
)

Get table function for distribution DT_TabFunc.

Throws SALOME_Exception if distribution type is not DT_TabFunc

◆ SetExpressionFunction()

void StdMeshers_NumberOfSegments::SetExpressionFunction ( const char *  expr)
throw (SMESH_Exception
)

Set expression function for distribution DT_ExprFunc.

Parameters
expr- string containing the expression of the function f(t), e.g. "sin(t)"

Throws SALOME_Exception if distribution type is not DT_ExprFunc

◆ GetExpressionFunction()

const char* StdMeshers_NumberOfSegments::GetExpressionFunction ( ) const
throw (SMESH_Exception
)

Get expression function for distribution DT_ExprFunc.

Throws SALOME_Exception if distribution type is not DT_ExprFunc

◆ SetConversionMode()

void StdMeshers_NumberOfSegments::SetConversionMode ( int  conv)
throw (SMESH_Exception
)

Set conversion mode. When it is 0, it means "exponent mode": the function of distribution of density is used as an exponent of 10, i,e, 10^f(t). When it is 1, it means "cut negative mode". The function of distribution is used as F(t), where F(t0)=f(t0), if f(t0)>=0, otherwise F(t0) = 0. This mode is sensible only when function distribution is used (DT_TabFunc or DT_ExprFunc)

Throws SALOME_Exception if distribution type is not functional

◆ ConversionMode()

int StdMeshers_NumberOfSegments::ConversionMode ( ) const
throw (SMESH_Exception
)

Returns conversion mode.

Throws SALOME_Exception if distribution type is not functional

◆ SetReversedEdges()

void StdMeshers_NumberOfSegments::SetReversedEdges ( std::vector< int > &  ids)

◆ SetObjectEntry()

void StdMeshers_NumberOfSegments::SetObjectEntry ( const char *  entry)

Definition at line 166 of file StdMeshers_NumberOfSegments.hxx.

◆ GetObjectEntry()

const char* StdMeshers_NumberOfSegments::GetObjectEntry ( )

Definition at line 168 of file StdMeshers_NumberOfSegments.hxx.

◆ GetReversedEdges()

const std::vector<int>& StdMeshers_NumberOfSegments::GetReversedEdges ( ) const

Definition at line 170 of file StdMeshers_NumberOfSegments.hxx.

◆ SetParametersByMesh()

virtual bool StdMeshers_NumberOfSegments::SetParametersByMesh ( const SMESH_Mesh theMesh,
const TopoDS_Shape &  theShape 
)
virtual

Initialize number of segments by the mesh built on the geometry.

Parameters
theMesh- the built mesh
theShape- the geometry of interest
Return values
bool- true if parameter values have been successfully defined

Implements SMESH_Hypothesis.

◆ SetParametersByDefaults()

virtual bool StdMeshers_NumberOfSegments::SetParametersByDefaults ( const TDefaults dflts,
const SMESH_Mesh theMesh = 0 
)
virtual

Initialize my parameter values by default parameters.

Return values
bool- true if parameter values have been successfully defined

Implements SMESH_Hypothesis.

◆ SaveTo()

virtual std::ostream& StdMeshers_NumberOfSegments::SaveTo ( std::ostream &  save)
virtual

Implements SMESHDS_Hypothesis.

◆ LoadFrom()

virtual std::istream& StdMeshers_NumberOfSegments::LoadFrom ( std::istream &  load)
virtual

Implements SMESHDS_Hypothesis.

◆ IsStatusFatal()

static bool SMESH_Hypothesis::IsStatusFatal ( Hypothesis_Status  theStatus)
staticinherited

Definition at line 68 of file SMESH_Hypothesis.hxx.

◆ GetDim()

virtual int SMESH_Hypothesis::GetDim ( ) const
virtualinherited

Referenced by SMESH_Gen::TAlgoStateError::Set().

Here is the caller graph for this function:

◆ GetStudyId()

int SMESH_Hypothesis::GetStudyId ( ) const
inherited

◆ NotifySubMeshesHypothesisModification()

virtual void SMESH_Hypothesis::NotifySubMeshesHypothesisModification ( )
virtualinherited

◆ GetShapeType()

virtual int SMESH_Hypothesis::GetShapeType ( ) const
virtualinherited

◆ GetLibName()

virtual const char* SMESH_Hypothesis::GetLibName ( ) const
virtualinherited

◆ SetLibName()

void SMESH_Hypothesis::SetLibName ( const char *  theLibName)
inherited

◆ SetParameters()

void SMESH_Hypothesis::SetParameters ( const char *  theParameters)
inherited

◆ GetParameters()

char* SMESH_Hypothesis::GetParameters ( ) const
inherited

◆ SetLastParameters()

void SMESH_Hypothesis::SetLastParameters ( const char *  theParameters)
inherited

◆ GetLastParameters()

char* SMESH_Hypothesis::GetLastParameters ( ) const
inherited

◆ ClearParameters()

void SMESH_Hypothesis::ClearParameters ( )
inherited

◆ IsAuxiliary()

virtual bool SMESH_Hypothesis::IsAuxiliary ( ) const
virtualinherited

Return true if me is an auxiliary hypothesis.

Return values
bool- auxiliary or not

An auxiliary hypothesis is optional, i.e. an algorithm can work without it and another hypothesis of the same dimention can be assigned to the shape

Definition at line 114 of file SMESH_Hypothesis.hxx.

References SMESHDS_Hypothesis::GetType().

Here is the call graph for this function:

◆ GetName()

const char* SMESHDS_Hypothesis::GetName ( ) const
inherited

◆ GetID()

int SMESHDS_Hypothesis::GetID ( ) const
inherited

◆ GetType()

int SMESHDS_Hypothesis::GetType ( ) const
inherited

Referenced by SMESH_Hypothesis::IsAuxiliary().

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  save,
StdMeshers_NumberOfSegments hyp 
)
friend

◆ operator>>

std::istream& operator>> ( std::istream &  load,
StdMeshers_NumberOfSegments hyp 
)
friend

Field Documentation

◆ _numberOfSegments

int StdMeshers_NumberOfSegments::_numberOfSegments
protected

an edge will be split on to this number of segments

Definition at line 192 of file StdMeshers_NumberOfSegments.hxx.

◆ _distrType

DistrType StdMeshers_NumberOfSegments::_distrType
protected

the type of distribution of density function

Definition at line 193 of file StdMeshers_NumberOfSegments.hxx.

◆ _scaleFactor

double StdMeshers_NumberOfSegments::_scaleFactor
protected

the scale parameter for DT_Scale

Definition at line 194 of file StdMeshers_NumberOfSegments.hxx.

◆ _table

std::vector<double> StdMeshers_NumberOfSegments::_table
protected

Definition at line 195 of file StdMeshers_NumberOfSegments.hxx.

◆ _distr

std::vector<double> StdMeshers_NumberOfSegments::_distr
protected

the table for DT_TabFunc, a sequence of pairs of numbers

Definition at line 195 of file StdMeshers_NumberOfSegments.hxx.

◆ _func

std::string StdMeshers_NumberOfSegments::_func
protected

the expression of the function for DT_ExprFunc

Definition at line 196 of file StdMeshers_NumberOfSegments.hxx.

◆ _convMode

int StdMeshers_NumberOfSegments::_convMode
protected

flag of conversion mode: 0=exponent, 1=cut negative

Definition at line 197 of file StdMeshers_NumberOfSegments.hxx.

◆ _edgeIDs

std::vector<int> StdMeshers_NumberOfSegments::_edgeIDs
protected

list of reversed edges ids

Definition at line 198 of file StdMeshers_NumberOfSegments.hxx.

◆ _objEntry

std::string StdMeshers_NumberOfSegments::_objEntry
protected

Entry of the main object to reverse edges.

Definition at line 199 of file StdMeshers_NumberOfSegments.hxx.

◆ _gen

SMESH_Gen* SMESH_Hypothesis::_gen
protectedinherited

Definition at line 118 of file SMESH_Hypothesis.hxx.

◆ _studyId

int SMESH_Hypothesis::_studyId
protectedinherited

Definition at line 119 of file SMESH_Hypothesis.hxx.

◆ _shapeType

int SMESH_Hypothesis::_shapeType
protectedinherited

Definition at line 120 of file SMESH_Hypothesis.hxx.

◆ _param_algo_dim

int SMESH_Hypothesis::_param_algo_dim
protectedinherited

Definition at line 121 of file SMESH_Hypothesis.hxx.

◆ _name

std::string SMESHDS_Hypothesis::_name
protectedinherited

Definition at line 52 of file SMESHDS_Hypothesis.hxx.

◆ _hypId

int SMESHDS_Hypothesis::_hypId
protectedinherited

Definition at line 53 of file SMESHDS_Hypothesis.hxx.

◆ _type

int SMESHDS_Hypothesis::_type
protectedinherited

Definition at line 54 of file SMESHDS_Hypothesis.hxx.