StdMeshers_NumberOfSegments Class Reference

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

#include <StdMeshers_NumberOfSegments.hxx>

Public Types

enum  DistrType { DT_Regular , DT_Scale , DT_TabFunc , DT_ExprFunc }
 This enumeration presents available types of distribution. More...
 
- Public Types inherited from SMESH_Hypothesis
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 , HYP_INCOMPAT_HYPS
}
 
- Public Types inherited from SMESHDS_Hypothesis
enum  hypothesis_type {
  PARAM_ALGO , ALGO_0D , ALGO_1D , ALGO_2D ,
  ALGO_3D
}
 

Public Member Functions

const std::vector< double > & BuildDistributionExpr (const char *, int, int)
 
const std::vector< double > & BuildDistributionTab (const std::vector< double > &, int, int)
 
int ConversionMode () const
 Returns conversion mode. More...
 
DistrType GetDistrType () const
 Get distribution type. More...
 
const char * GetExpressionFunction () const
 Get expression function for distribution DT_ExprFunc. More...
 
int GetNumberOfSegments () const
 Get the number of segments. More...
 
const char * GetObjectEntry ()
 
const std::vector< int > & GetReversedEdges () const
 
double GetScaleFactor () const
 Get scale factor for scale distribution. More...
 
const std::vector< double > & GetTableFunction () const
 Get table function for distribution DT_TabFunc. More...
 
virtual std::istream & LoadFrom (std::istream &load)
 
virtual std::ostream & SaveTo (std::ostream &save)
 
void SetConversionMode (int conv)
 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...
 
void SetDistrType (DistrType typ)
 Set distribution type. More...
 
void SetExpressionFunction (const char *expr)
 Set expression function for distribution DT_ExprFunc. More...
 
void SetNumberOfSegments (int segmentsNumber)
 Set the number of segments. More...
 
void SetObjectEntry (const char *entry)
 
virtual bool SetParametersByDefaults (const TDefaults &dflts, const SMESH_Mesh *theMesh=0)
 Initialize my parameter values by default parameters. More...
 
virtual bool SetParametersByMesh (const SMESH_Mesh *theMesh, const TopoDS_Shape &theShape)
 Initialize number of segments by the mesh built on the geometry. More...
 
void SetReversedEdges (std::vector< int > &ids)
 
virtual void SetScaleFactor (double scaleFactor)
 Set scale factor for scale distribution. More...
 
void SetTableFunction (const std::vector< double > &table)
 Set table function for distribution DT_TabFunc. More...
 
 StdMeshers_NumberOfSegments (int hypId, int studyId, SMESH_Gen *gen)
 
virtual ~StdMeshers_NumberOfSegments ()
 
- Public Member Functions inherited from SMESH_Hypothesis
void ClearParameters ()
 
virtual bool DataDependOnParams () const
 The returned value is used by NotifySubMeshesHypothesisModification() to decide to call subMesh->AlgoStateEngine( MODIF_HYP, hyp ) or not if subMesh is ready to be computed (algo+hyp==OK) but not yet computed. True result is reasonable for example if EventListeners depend on parameters of hypothesis. More...
 
virtual int GetDim () const
 
SMESH_GenGetGen () const
 
char * GetLastParameters () const
 
virtual const char * GetLibName () const
 
SMESH_MeshGetMeshByPersistentID (int id)
 Find a mesh with given persistent ID. More...
 
char * GetParameters () const
 
virtual int GetShapeType () const
 
int GetStudyId () const
 
virtual bool IsAuxiliary () const
 Return true if me is an auxiliary hypothesis. More...
 
virtual void NotifySubMeshesHypothesisModification ()
 
void SetLastParameters (const char *theParameters)
 
void SetLibName (const char *theLibName)
 
void SetParameters (const char *theParameters)
 
virtual bool SetParametersByDefaults (const TDefaults &dflts, const SMESH_Mesh *theMesh=0)=0
 Initialize my parameter values by default parameters. More...
 
virtual bool SetParametersByMesh (const SMESH_Mesh *theMesh, const TopoDS_Shape &theShape)=0
 Initialize my parameter values by the mesh built on the geometry. More...
 
 SMESH_Hypothesis (int hypId, int studyId, SMESH_Gen *gen)
 
virtual ~SMESH_Hypothesis ()
 
- Public Member Functions inherited from SMESHDS_Hypothesis
int GetID () const
 
const char * GetName () const
 
int GetType () const
 
bool IsSameName (const SMESHDS_Hypothesis &other) const
 Compare types of hypotheses. More...
 
virtual std::istream & LoadFrom (std::istream &load)=0
 
bool operator!= (const SMESHDS_Hypothesis &other) const
 
virtual bool operator== (const SMESHDS_Hypothesis &other) const
 
virtual std::ostream & SaveTo (std::ostream &save)=0
 
 SMESHDS_Hypothesis (int hypId)
 
virtual ~SMESHDS_Hypothesis ()
 

Static Public Member Functions

static std::string CheckExpressionFunction (const std::string &expr, const int convMode)
 Checks validity of the expression of the function f(t), e.g. "sin(t)". In case of validity returns a cleaned expression. More...
 
- Static Public Member Functions inherited from SMESH_Hypothesis
static bool IsStatusFatal (Hypothesis_Status theStatus)
 

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

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

Constructor & Destructor Documentation

◆ StdMeshers_NumberOfSegments()

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

◆ ~StdMeshers_NumberOfSegments()

StdMeshers_NumberOfSegments::~StdMeshers_NumberOfSegments ( )
virtual

Member Function Documentation

◆ BuildDistributionExpr()

const vector< double > & StdMeshers_NumberOfSegments::BuildDistributionExpr ( const char *  expr,
int  nbSeg,
int  conv 
)

◆ BuildDistributionTab()

const vector< double > & StdMeshers_NumberOfSegments::BuildDistributionTab ( const std::vector< double > &  tab,
int  nbSeg,
int  conv 
)

◆ CheckExpressionFunction()

std::string StdMeshers_NumberOfSegments::CheckExpressionFunction ( const std::string &  expr,
const int  convMode 
)
static

Checks validity of the expression of the function f(t), e.g. "sin(t)". In case of validity returns a cleaned expression.

Parameters
convMode- 0 for "Exponent mode", 1 for "Cut negative mode"

Referenced by SetExpressionFunction().

◆ ConversionMode()

int StdMeshers_NumberOfSegments::ConversionMode ( ) const

Returns conversion mode.

Throws SALOME_Exception if distribution type is not functional

Referenced by StdMeshers_Regular_1D::CheckHypothesis().

◆ GetDistrType()

StdMeshers_NumberOfSegments::DistrType StdMeshers_NumberOfSegments::GetDistrType ( ) const

Get distribution type.

Referenced by StdMeshers_Regular_1D::CheckHypothesis().

◆ GetExpressionFunction()

const char * StdMeshers_NumberOfSegments::GetExpressionFunction ( ) const

Get expression function for distribution DT_ExprFunc.

Throws SALOME_Exception if distribution type is not DT_ExprFunc

References DT_ExprFunc.

Referenced by StdMeshers_Regular_1D::CheckHypothesis().

◆ GetNumberOfSegments()

int StdMeshers_NumberOfSegments::GetNumberOfSegments ( ) const

Get the number of segments.

Referenced by StdMeshers_Regular_1D::CheckHypothesis().

◆ GetObjectEntry()

const char * StdMeshers_NumberOfSegments::GetObjectEntry ( )

◆ GetReversedEdges()

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

◆ GetScaleFactor()

double StdMeshers_NumberOfSegments::GetScaleFactor ( ) const

Get scale factor for scale distribution.

Throws SALOME_Exception if distribution type is not DT_Scale

References DT_Scale.

Referenced by StdMeshers_Regular_1D::CheckHypothesis().

◆ GetTableFunction()

const vector< double > & StdMeshers_NumberOfSegments::GetTableFunction ( ) const

Get table function for distribution DT_TabFunc.

Throws SALOME_Exception if distribution type is not DT_TabFunc

References DT_TabFunc.

Referenced by StdMeshers_Regular_1D::CheckHypothesis().

◆ LoadFrom()

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

◆ SaveTo()

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

◆ SetConversionMode()

void StdMeshers_NumberOfSegments::SetConversionMode ( int  conv)

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

References SMESH_Hypothesis::NotifySubMeshesHypothesisModification().

◆ SetDistrType()

void StdMeshers_NumberOfSegments::SetDistrType ( DistrType  typ)

◆ SetExpressionFunction()

void StdMeshers_NumberOfSegments::SetExpressionFunction ( const char *  expr)

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

References CheckExpressionFunction(), DT_ExprFunc, and SMESH_Hypothesis::NotifySubMeshesHypothesisModification().

◆ SetNumberOfSegments()

void StdMeshers_NumberOfSegments::SetNumberOfSegments ( int  segmentsNumber)

Set the number of segments.

Parameters
segmentsNumber- must be greater than zero

References SMESH_Hypothesis::NotifySubMeshesHypothesisModification().

Referenced by MeshPart::Mesher::createMesh().

◆ SetObjectEntry()

void StdMeshers_NumberOfSegments::SetObjectEntry ( const char *  entry)

◆ SetParametersByDefaults()

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.

◆ SetParametersByMesh()

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.

References DT_Regular, SMESHDS_Mesh::MeshElements(), and SMESHDS_SubMesh::NbElements().

◆ SetReversedEdges()

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

◆ SetScaleFactor()

void StdMeshers_NumberOfSegments::SetScaleFactor ( double  scaleFactor)
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

References DT_Regular, DT_Scale, and SMESH_Hypothesis::NotifySubMeshesHypothesisModification().

◆ SetTableFunction()

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

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

References DT_TabFunc, and SMESH_Hypothesis::NotifySubMeshesHypothesisModification().

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

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