StdMeshers_Regular_1D Class Reference

#include <StdMeshers_Regular_1D.hxx>

Public Member Functions

virtual void CancelCompute ()
 Pass CancelCompute() to a child algorithm. More...
 
virtual bool CheckHypothesis (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, SMESH_Hypothesis::Hypothesis_Status &aStatus)
 Check hypothesis definition to mesh a shape. More...
 
virtual bool Compute (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape)
 Computes mesh on a shape. More...
 
virtual bool Evaluate (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, MapShapeNbElems &aResMap)
 evaluates size of prospective mesh on a shape More...
 
virtual const std::list< const SMESHDS_Hypothesis * > & GetUsedHypothesis (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, const bool=true)
 
virtual void SetEventListener (SMESH_subMesh *subMesh)
 Sets event listener to submeshes if necessary. More...
 
 StdMeshers_Regular_1D (int hypId, int studyId, SMESH_Gen *gen)
 
void SubmeshRestored (SMESH_subMesh *subMesh)
 Allow algo to do something after persistent restoration. More...
 
virtual ~StdMeshers_Regular_1D ()
 
- Public Member Functions inherited from SMESH_1D_Algo
 SMESH_1D_Algo (int hypId, int studyId, SMESH_Gen *gen)
 
 SMESH_1D_Algo (int hypId, int studyId, SMESH_Gen *gen)
 
virtual ~SMESH_1D_Algo ()
 
- Public Member Functions inherited from SMESH_Algo
virtual void CancelCompute ()
 Sets _computeCanceled to true. It's usage depends on implementation of a particular mesher. More...
 
virtual bool CheckHypothesis (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, SMESH_Hypothesis::Hypothesis_Status &aStatus)=0
 Check hypothesis definition to mesh a shape. More...
 
virtual bool Compute (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape)=0
 Computes mesh on a shape. More...
 
virtual bool Compute (SMESH_Mesh &aMesh, SMESH_MesherHelper *aHelper)
 Computes mesh without geometry. More...
 
virtual bool Evaluate (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, MapShapeNbElems &aResMap)=0
 evaluates size of prospective mesh on a shape More...
 
const std::list< const SMESHDS_Hypothesis * > & GetAppliedHypothesis (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, const bool ignoreAuxiliary=true) const
 Returns a list of compatible hypotheses assigned to a shape in a mesh. More...
 
const SMESH_HypoFilterGetCompatibleHypoFilter (const bool ignoreAuxiliary) const
 Returns the filter recognizing only compatible hypotheses. More...
 
const std::vector< std::string > & GetCompatibleHypothesis ()
 Returns all types of compatible hypotheses. More...
 
SMESH_ComputeErrorPtr GetComputeError () const
 return compute error More...
 
const FeaturesGetFeatures () const
 
virtual double GetProgress () const
 If possible, returns progress of computation [0.,1.]. More...
 
double GetProgressByTic () const
 Return compute progress by nb of calls of this method. More...
 
virtual const std::list< const SMESHDS_Hypothesis * > & GetUsedHypothesis (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, const bool ignoreAuxiliary=true) const
 Returns a list of compatible hypotheses used to mesh a shape. More...
 
void InitComputeError ()
 initialize compute error etc. before call of Compute() More...
 
virtual std::istream & LoadFrom (std::istream &load)
 Loads nothing from a stream. More...
 
bool NeedDiscreteBoundary () const
 
bool NeedLowerHyps (int dim) const
 
bool NeedShape () const
 
int NumberOfPoints (SMESH_Mesh &aMesh, const TopoDS_Wire &W)
 
bool OnlyUnaryInput () const
 
virtual std::ostream & SaveTo (std::ostream &save)
 Saves nothing in a stream. More...
 
virtual void SetEventListener (SMESH_subMesh *subMesh)
 Sets event listener to submeshes if necessary. More...
 
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)
 Just return false as the algorithm does not hold parameters values. More...
 
 SMESH_Algo (int hypId, int studyId, SMESH_Gen *gen)
 Creates algorithm. More...
 
std::vector< SMESH_subMesh * > & SubMeshesToCompute ()
 
virtual void SubmeshRestored (SMESH_subMesh *subMesh)
 Allow algo to do something after persistent restoration. More...
 
bool SupportSubmeshes () const
 
virtual ~SMESH_Algo ()
 Destructor. More...
 
- 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 ()
 

Protected Types

enum  HypothesisType {
  LOCAL_LENGTH , MAX_LENGTH , NB_SEGMENTS , BEG_END_LENGTH ,
  DEFLECTION , ARITHMETIC_1D , FIXED_POINTS_1D , ADAPTIVE ,
  GEOMETRIC_1D , NONE
}
 
enum  IValueIndex { NB_SEGMENTS_IND = 0 , DISTR_TYPE_IND = 1 , CONV_MODE_IND = 2 }
 
enum  SValueIndex { EXPR_FUNC_IND = 0 }
 
enum  ValueIndex {
  SCALE_FACTOR_IND = 0 , BEG_LENGTH_IND = 0 , END_LENGTH_IND = 1 , DEFLECTION_IND = 0 ,
  PRECISION_IND = 1
}
 
enum  VValueIndex { TAB_FUNC_IND = 0 }
 

Protected Member Functions

virtual bool computeInternalParameters (SMESH_Mesh &theMesh, Adaptor3d_Curve &theC3d, double theLength, double theFirstU, double theLastU, std::list< double > &theParameters, const bool theReverse, bool theConsiderPropagation=false)
 
virtual void redistributeNearVertices (SMESH_Mesh &theMesh, Adaptor3d_Curve &theC3d, double theLength, std::list< double > &theParameters, const TopoDS_Vertex &theVf, const TopoDS_Vertex &theVl)
 Tune parameters to fit "SegmentLengthAroundVertex" hypothesis. More...
 
- Protected Member Functions inherited from SMESH_Algo
void addBadInputElement (const SMDS_MeshElement *elem)
 store a bad input element preventing computation, which may be a temporary one i.e. not residing the mesh, then it will be deleted by InitComputeError() More...
 
void addBadInputElements (const SMESHDS_SubMesh *sm, const bool addNodes=false)
 
bool error (const SMESH_Comment &comment="")
 store COMPERR_ALGO_FAILED error and comment and then return false More...
 
bool error (int error, const SMESH_Comment &comment="")
 store error and comment and then return ( error == COMPERR_OK ) More...
 
bool error (SMESH_ComputeErrorPtr error)
 store error and return error->IsOK() More...
 

Static Protected Member Functions

static const StdMeshers_SegmentLengthAroundVertexgetVertexHyp (SMESH_Mesh &theMesh, const TopoDS_Vertex &theV)
 Return StdMeshers_SegmentLengthAroundVertex assigned to vertex. More...
 

Additional Inherited Members

- Public Types inherited from SMESH_Algo
enum  EMeshError { MEr_OK = 0 , MEr_HOLES , MEr_BAD_ORI , MEr_EMPTY }
 
- 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
}
 
- Static Public Member Functions inherited from SMESH_Algo
static GeomAbs_Shape Continuity (TopoDS_Edge E1, TopoDS_Edge E2)
 Return continuity of two edges. More...
 
static double EdgeLength (const TopoDS_Edge &E)
 Compute length of an edge. More...
 
static const FeaturesGetFeatures (const std::string &algoType)
 Returns a structure describing algorithm features. More...
 
static EMeshError GetMeshError (SMESH_subMesh *subMesh)
 Finds topological errors of a sub-mesh. More...
 
static bool GetNodeParamOnEdge (const SMESHDS_Mesh *theMesh, const TopoDS_Edge &theEdge, std::vector< double > &theParams)
 Fill vector of node parameters on geometrical edge, including vertex nodes. More...
 
static bool GetSortedNodesOnEdge (const SMESHDS_Mesh *theMesh, const TopoDS_Edge &theEdge, const bool ignoreMediumNodes, std::map< double, const SMDS_MeshNode * > &theNodes, const SMDSAbs_ElementType typeToCheck=SMDSAbs_All)
 Fill map of node parameter on geometrical edge to node it-self. More...
 
static bool IsContinuous (const TopoDS_Edge &E1, const TopoDS_Edge &E2)
 Return true if an edge can be considered as a continuation of another. More...
 
static bool isDegenerated (const TopoDS_Edge &E)
 Return true if an edge has no 3D curve. More...
 
static bool IsStraight (const TopoDS_Edge &E, const bool degenResult=false)
 Return true if an edge can be considered straight. More...
 
static const SMDS_MeshNodeVertexNode (const TopoDS_Vertex &V, const SMESH_Mesh *mesh)
 Return the node built on a vertex. A node moved to other geometry by MergeNodes() is also returned. More...
 
static const SMDS_MeshNodeVertexNode (const TopoDS_Vertex &V, const SMESHDS_Mesh *meshDS)
 Return the node built on a vertex. More...
 
static const SMDS_MeshNodeVertexNode (const TopoDS_Vertex &V, const SMESHDS_SubMesh *edgeSM, const SMESH_Mesh *mesh, const bool checkV=true)
 Return the node built on a vertex. A node moved to other geometry by MergeNodes() is also returned. More...
 
- Static Public Member Functions inherited from SMESH_Hypothesis
static bool IsStatusFatal (Hypothesis_Status theStatus)
 

Member Enumeration Documentation

◆ HypothesisType

Enumerator
LOCAL_LENGTH 
MAX_LENGTH 
NB_SEGMENTS 
BEG_END_LENGTH 
DEFLECTION 
ARITHMETIC_1D 
FIXED_POINTS_1D 
ADAPTIVE 
GEOMETRIC_1D 
NONE 

◆ IValueIndex

Enumerator
NB_SEGMENTS_IND 
DISTR_TYPE_IND 
CONV_MODE_IND 

◆ SValueIndex

Enumerator
EXPR_FUNC_IND 

◆ ValueIndex

Enumerator
SCALE_FACTOR_IND 
BEG_LENGTH_IND 
END_LENGTH_IND 
DEFLECTION_IND 
PRECISION_IND 

◆ VValueIndex

Enumerator
TAB_FUNC_IND 

Constructor & Destructor Documentation

◆ StdMeshers_Regular_1D()

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

◆ ~StdMeshers_Regular_1D()

StdMeshers_Regular_1D::~StdMeshers_Regular_1D ( )
virtual

Member Function Documentation

◆ CancelCompute()

void StdMeshers_Regular_1D::CancelCompute ( )
virtual

Pass CancelCompute() to a child algorithm.

Reimplemented from SMESH_Algo.

References ADAPTIVE, and SMESH_Algo::CancelCompute().

◆ CheckHypothesis()

bool StdMeshers_Regular_1D::CheckHypothesis ( SMESH_Mesh aMesh,
const TopoDS_Shape &  aShape,
SMESH_Hypothesis::Hypothesis_Status aStatus 
)
virtual

Check hypothesis definition to mesh a shape.

Parameters
aMesh- the mesh
aShape- the shape
aStatus- check result
Return values
bool- true if hypothesis is well defined

Textual description of a problem can be stored in _comment field.

Implements SMESH_Algo.

Reimplemented in StdMeshers_QuadFromMedialAxis_1D2D::Algo1D.

References ADAPTIVE, ARITHMETIC_1D, BEG_END_LENGTH, BEG_LENGTH_IND, CONV_MODE_IND, StdMeshers_NumberOfSegments::ConversionMode(), DEFLECTION, DEFLECTION_IND, DISTR_TYPE_IND, StdMeshers_NumberOfSegments::DT_ExprFunc, StdMeshers_NumberOfSegments::DT_Regular, StdMeshers_NumberOfSegments::DT_Scale, StdMeshers_NumberOfSegments::DT_TabFunc, END_LENGTH_IND, SMESH_Algo::error(), EXPR_FUNC_IND, FIXED_POINTS_1D, GEOMETRIC_1D, SMESH_Gen::GetBoundaryBoxSegmentation(), StdMeshers_Geometric1D::GetCommonRatio(), StdMeshers_Deflection1D::GetDeflection(), StdMeshers_NumberOfSegments::GetDistrType(), StdMeshers_NumberOfSegments::GetExpressionFunction(), StdMeshers_Propagation::GetFilter(), SMESH_Mesh::GetGen(), SMESH_Mesh::GetHypotheses(), StdMeshers_LocalLength::GetLength(), StdMeshers_MaxLength::GetLength(), StdMeshers_Arithmetic1D::GetLength(), StdMeshers_StartEndLength::GetLength(), StdMeshers_AutomaticLength::GetLength(), StdMeshers_Propagation::GetName(), StdMeshers_PropagOfDistribution::GetName(), SMESHDS_Hypothesis::GetName(), StdMeshers_NumberOfSegments::GetNumberOfSegments(), StdMeshers_LocalLength::GetPrecision(), StdMeshers_Arithmetic1D::GetReversedEdges(), StdMeshers_NumberOfSegments::GetReversedEdges(), StdMeshers_Reversible1D::GetReversedEdges(), StdMeshers_StartEndLength::GetReversedEdges(), StdMeshers_NumberOfSegments::GetScaleFactor(), SMESH_Mesh::GetShapeDiagonalSize(), StdMeshers_Geometric1D::GetStartLength(), StdMeshers_NumberOfSegments::GetTableFunction(), GetUsedHypothesis(), StdMeshers_MaxLength::GetUsePreestimatedLength(), SMESH_Hypothesis::HYP_INCOMPAT_HYPS, SMESH_Hypothesis::HYP_INCOMPATIBLE, SMESH_Hypothesis::HYP_MISSING, SMESH_Hypothesis::HYP_OK, SMESH_Hypothesis::IsAuxiliary(), SMESH_HypoFilter::IsOk(), SMESHDS_Hypothesis::IsSameName(), LOCAL_LENGTH, MAX_LENGTH, NB_SEGMENTS, NB_SEGMENTS_IND, NONE, PRECISION_IND, SCALE_FACTOR_IND, and TAB_FUNC_IND.

Referenced by StdMeshers_QuadFromMedialAxis_1D2D::Algo1D::CheckHypothesis(), and TNodeDistributor::Compute().

◆ Compute()

bool StdMeshers_Regular_1D::Compute ( SMESH_Mesh aMesh,
const TopoDS_Shape &  aShape 
)
virtual

◆ computeInternalParameters()

◆ Evaluate()

bool StdMeshers_Regular_1D::Evaluate ( SMESH_Mesh aMesh,
const TopoDS_Shape &  aShape,
MapShapeNbElems &  aResMap 
)
virtual

evaluates size of prospective mesh on a shape

Parameters
aMesh- the mesh
aShape- the shape
aResMap- prospective number of elements by SMDSAbs_ElementType by a sub-mesh
Return values
bool- is a success

Implements SMESH_Algo.

References ADAPTIVE, computeInternalParameters(), SMESH_Algo::EdgeLength(), SMESH_Algo::error(), SMESH_subMesh::GetComputeError(), SMESH_Mesh::GetSubMesh(), NONE, and redistributeNearVertices().

◆ GetUsedHypothesis()

const list< const SMESHDS_Hypothesis * > & StdMeshers_Regular_1D::GetUsedHypothesis ( SMESH_Mesh aMesh,
const TopoDS_Shape &  aShape,
const bool  ignoreAuxiliary = true 
)
virtual

◆ getVertexHyp()

const StdMeshers_SegmentLengthAroundVertex * StdMeshers_Regular_1D::getVertexHyp ( SMESH_Mesh theMesh,
const TopoDS_Vertex &  theV 
)
staticprotected

◆ redistributeNearVertices()

void StdMeshers_Regular_1D::redistributeNearVertices ( SMESH_Mesh theMesh,
Adaptor3d_Curve theC3d,
double  theLength,
std::list< double > &  theParameters,
const TopoDS_Vertex &  theVf,
const TopoDS_Vertex &  theVl 
)
protectedvirtual

Tune parameters to fit "SegmentLengthAroundVertex" hypothesis.

Parameters
theC3d- wire curve
theLength- curve length
theParameters- internal nodes parameters to modify
theVf- 1st vertex
theVl- 2nd vertex

References BEG_END_LENGTH, BEG_LENGTH_IND, computeInternalParameters(), END_LENGTH_IND, StdMeshers_SegmentLengthAroundVertex::GetLength(), getVertexHyp(), NB_SEGMENTS, and StdMeshers_Regular_1D().

Referenced by StdMeshers_CompositeSegment_1D::Compute(), Compute(), and Evaluate().

◆ SetEventListener()

void StdMeshers_Regular_1D::SetEventListener ( SMESH_subMesh subMesh)
virtual

Sets event listener to submeshes if necessary.

Class used to clean mesh on edges when 0D hyp modified. Common approach doesn't work when 0D algo is missing because the 0D hyp is considered as not participating in computation whereas it is used by 1D algo.

Parameters
subMesh- submesh where algo is set

This method is called when a submesh gets HYP_OK algo_state. After being set, event listener is notified on each event of a submesh.

    \brief Clean mesh on edges
    \param event - algo_event or compute_event itself (of SMESH_subMesh)
    \param eventType - ALGO_EVENT or COMPUTE_EVENT (of SMESH_subMesh)
    \param subMesh - the submesh where the event occurs
   &zwj;/

void ProcessEvent(const int event, const int eventType, SMESH_subMesh* subMesh, EventListenerData*, const SMESH_Hypothesis*) { if ( eventType == SMESH_subMesh::ALGO_EVENT) // all algo events { subMesh->ComputeStateEngine( SMESH_subMesh::MODIF_ALGO_STATE ); } } }; // struct VertexEventListener


/*!

Sets event listener to vertex submeshes

Parameters
subMesh- submesh where algo is set

This method is called when a submesh gets HYP_OK algo_state. After being set, event listener is notified on each event of a submesh.

Reimplemented from SMESH_Algo.

Reimplemented in StdMeshers_CompositeSegment_1D.

References StdMeshers_Propagation::SetPropagationMgr().

Referenced by StdMeshers_CompositeSegment_1D::SetEventListener().

◆ SubmeshRestored()

void StdMeshers_Regular_1D::SubmeshRestored ( SMESH_subMesh subMesh)
virtual

Allow algo to do something after persistent restoration.

Do nothing.

Parameters
subMesh- restored submesh

This method is called only if a submesh has HYP_OK algo_state.

Reimplemented from SMESH_Algo.


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