SALOME - SMESH
SMESH_Algo Class Reference

#include <SMESH_Algo.hxx>

Inheritance diagram for SMESH_Algo:
Inheritance graph
Collaboration diagram for SMESH_Algo:
Collaboration graph

Public Types

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

 SMESH_Algo (int hypId, int studyId, SMESH_Gen *gen)
 Creates algorithm.
virtual ~SMESH_Algo ()
 Destructor.
virtual std::ostreamSaveTo (std::ostream &save)
 Saves nothing in a stream.
virtual std::istreamLoadFrom (std::istream &load)
 Loads nothing from a stream.
const std::vector< std::string > & GetCompatibleHypothesis ()
 Returns all types of compatible hypotheses.
virtual bool CheckHypothesis (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, SMESH_Hypothesis::Hypothesis_Status &aStatus)=0
 Check hypothesis definition to mesh a shape.
virtual bool Compute (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape)=0
 Computes mesh on a shape.
virtual bool Compute (SMESH_Mesh &aMesh, SMESH_MesherHelper *aHelper)
 Computes mesh without geometry.
virtual bool Evaluate (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, MapShapeNbElems &aResMap)=0
 evaluates size of prospective mesh on a shape
virtual const std::list< const
SMESHDS_Hypothesis * > & 
GetUsedHypothesis (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, const bool ignoreAuxiliary=true)
 Returns a list of compatible hypotheses used to mesh a shape.
const std::list< const
SMESHDS_Hypothesis * > & 
GetAppliedHypothesis (SMESH_Mesh &aMesh, const TopoDS_Shape &aShape, const bool ignoreAuxiliary=true)
 Returns a list of compatible hypotheses assigned to a shape in a mesh.
bool InitCompatibleHypoFilter (SMESH_HypoFilter &theFilter, const bool ignoreAuxiliary) const
 Make the filter recognize only compatible hypotheses.
virtual bool SetParametersByMesh (const SMESH_Mesh *theMesh, const TopoDS_Shape &theShape)
 Just return false as the algorithm does not hold parameters values.
virtual bool SetParametersByDefaults (const TDefaults &dflts, const SMESH_Mesh *theMesh=0)
 Initialize my parameter values by default parameters.
SMESH_ComputeErrorPtr GetComputeError () const
 return compute error
void InitComputeError ()
 initialize compute error
bool OnlyUnaryInput () const
bool NeedDescretBoundary () const
bool NeedShape () const
bool SupportSubmeshes () const
virtual void SetEventListener (SMESH_subMesh *subMesh)
 Sets event listener to submeshes if necessary.
virtual void SubmeshRestored (SMESH_subMesh *subMesh)
 Allow algo to do something after persistent restoration.
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.
const char * GetName () const
int GetID () const
int GetType () const

Static Public Member Functions

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.
static bool GetSortedNodesOnEdge (const SMESHDS_Mesh *theMesh, const TopoDS_Edge &theEdge, const bool ignoreMediumNodes, std::map< double, const SMDS_MeshNode * > &theNodes)
 Fill map of node parameter on geometrical edge to node it-self.
static bool IsReversedSubMesh (const TopoDS_Face &theFace, SMESHDS_Mesh *theMeshDS)
 Find out elements orientation on a geometrical face.
static double EdgeLength (const TopoDS_Edge &E)
 Compute length of an edge.
static GeomAbs_Shape Continuity (const TopoDS_Edge &E1, const TopoDS_Edge &E2)
 Return continuity of two edges.
static bool IsContinuous (const TopoDS_Edge &E1, const TopoDS_Edge &E2)
 Return true if an edge can be considered as a continuation of another.
static const SMDS_MeshNodeVertexNode (const TopoDS_Vertex &V, const SMESHDS_Mesh *meshDS)
 Return the node built on a vertex.
static bool IsStatusFatal (Hypothesis_Status theStatus)

Protected Member Functions

bool error (int error, const SMESH_Comment &comment="")
 store error and comment and then return ( error == COMPERR_OK )
bool error (const SMESH_Comment &comment="")
 store COMPERR_ALGO_FAILED error and comment and then return false
bool error (SMESH_ComputeErrorPtr error)
 store error and return error->IsOK()
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()

Protected Attributes

std::vector< std::string_compatibleHypothesis
std::list< const
SMESHDS_Hypothesis * > 
_appliedHypList
std::list< const
SMESHDS_Hypothesis * > 
_usedHypList
bool _onlyUnaryInput
bool _requireDescretBoundary
bool _requireShape
bool _supportSubmeshes
bool _quadraticMesh
int _error
 SMESH_ComputeErrorName or anything algo specific.
std::string _comment
 any text explaining what is wrong in Compute()
std::list< const
SMDS_MeshElement * > 
_badInputElements
 to explain COMPERR_BAD_INPUT_MESH
SMESH_Gen_gen
int _studyId
int _shapeType
int _param_algo_dim
std::string _name
int _hypId
int _type

Member Enumeration Documentation

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.

Enumerator:
PARAM_ALGO 
ALGO_0D 
ALGO_1D 
ALGO_2D 
ALGO_3D 

Definition at line 49 of file SMESHDS_Hypothesis.hxx.


Constructor & Destructor Documentation

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

Creates algorithm.

Parameters:
hypId- algorithm ID
studyId- study ID
gen- SMESH_Gen
virtual SMESH_Algo::~SMESH_Algo ( ) [virtual]

Destructor.


Member Function Documentation

virtual std::ostream& SMESH_Algo::SaveTo ( std::ostream save) [virtual]

Saves nothing in a stream.

Parameters:
save- the stream
Return values:
virtualstd::ostream & - the stream

Implements SMESHDS_Hypothesis.

virtual std::istream& SMESH_Algo::LoadFrom ( std::istream load) [virtual]

Loads nothing from a stream.

Parameters:
load- the stream
Return values:
virtualstd::ostream & - the stream

Implements SMESHDS_Hypothesis.

const std::vector< std::string >& SMESH_Algo::GetCompatibleHypothesis ( )

Returns all types of compatible hypotheses.

virtual bool SMESH_Algo::CheckHypothesis ( SMESH_Mesh aMesh,
const TopoDS_Shape aShape,
SMESH_Hypothesis::Hypothesis_Status aStatus 
) [pure virtual]
virtual bool SMESH_Algo::Compute ( SMESH_Mesh aMesh,
const TopoDS_Shape aShape 
) [pure virtual]
virtual bool SMESH_Algo::Compute ( SMESH_Mesh aMesh,
SMESH_MesherHelper aHelper 
) [virtual]

Computes mesh without geometry.

Parameters:
aMesh- the mesh
aHelper- helper that must be used for adding elements to
Return values:
bool- is a success

The method is called if ( !aMesh->HasShapeToMesh() )

Reimplemented in NETGENPlugin_NETGEN_3D.

virtual bool SMESH_Algo::Evaluate ( SMESH_Mesh aMesh,
const TopoDS_Shape aShape,
MapShapeNbElems aResMap 
) [pure virtual]
virtual const std::list<const SMESHDS_Hypothesis *>& SMESH_Algo::GetUsedHypothesis ( SMESH_Mesh aMesh,
const TopoDS_Shape aShape,
const bool  ignoreAuxiliary = true 
) [virtual]

Returns a list of compatible hypotheses used to mesh a shape.

Parameters:
aMesh- the mesh
aShape- the shape
ignoreAuxiliary- do not include auxiliary hypotheses in the list
Return values:
conststd::list <const SMESHDS_Hypothesis*> - hypotheses list

List the hypothesis used by the algorithm associated to the shape. Hypothesis associated to father shape -are- taken into account (see GetAppliedHypothesis). Relevant hypothesis have a name (type) listed in the algorithm. This method could be surcharged by specific algorithms, in case of several hypothesis simultaneously applicable.

Reimplemented in StdMeshers_Regular_1D.

const std::list<const SMESHDS_Hypothesis *>& SMESH_Algo::GetAppliedHypothesis ( SMESH_Mesh aMesh,
const TopoDS_Shape aShape,
const bool  ignoreAuxiliary = true 
)

Returns a list of compatible hypotheses assigned to a shape in a mesh.

Parameters:
aMesh- the mesh
aShape- the shape
ignoreAuxiliary- do not include auxiliary hypotheses in the list
Return values:
conststd::list <const SMESHDS_Hypothesis*> - hypotheses list

List the relevant hypothesis associated to the shape. Relevant hypothesis have a name (type) listed in the algorithm. Hypothesis associated to father shape -are not- taken into account (see GetUsedHypothesis)

bool SMESH_Algo::InitCompatibleHypoFilter ( SMESH_HypoFilter theFilter,
const bool  ignoreAuxiliary 
) const

Make the filter recognize only compatible hypotheses.

Parameters:
theFilter- the filter to initialize
ignoreAuxiliary- make filter ignore compatible auxiliary hypotheses
Return values:
bool- true if the algo has compatible hypotheses
virtual bool SMESH_Algo::SetParametersByMesh ( const SMESH_Mesh theMesh,
const TopoDS_Shape theShape 
) [virtual]

Just return false as the algorithm does not hold parameters values.

Implements SMESH_Hypothesis.

virtual bool SMESH_Algo::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.

SMESH_ComputeErrorPtr SMESH_Algo::GetComputeError ( ) const

return compute error

void SMESH_Algo::InitComputeError ( )

initialize compute error

bool SMESH_Algo::OnlyUnaryInput ( ) const

Definition at line 201 of file SMESH_Algo.hxx.

bool SMESH_Algo::NeedDescretBoundary ( ) const

Definition at line 209 of file SMESH_Algo.hxx.

bool SMESH_Algo::NeedShape ( ) const

Definition at line 212 of file SMESH_Algo.hxx.

bool SMESH_Algo::SupportSubmeshes ( ) const

Definition at line 215 of file SMESH_Algo.hxx.

virtual void SMESH_Algo::SetEventListener ( SMESH_subMesh subMesh) [virtual]

Sets event listener to submeshes if necessary.

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. By default non listener is set

Reimplemented in StdMeshers_Regular_1D, StdMeshers_Projection_1D, StdMeshers_Projection_2D, StdMeshers_Projection_3D, and StdMeshers_CompositeSegment_1D.

virtual void SMESH_Algo::SubmeshRestored ( SMESH_subMesh subMesh) [virtual]

Allow algo to do something after persistent restoration.

Parameters:
subMesh- restored submesh

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

Reimplemented in StdMeshers_Regular_1D, and StdMeshers_RadialQuadrangle_1D2D.

static bool SMESH_Algo::GetNodeParamOnEdge ( const SMESHDS_Mesh theMesh,
const TopoDS_Edge &  theEdge,
std::vector< double > &  theParams 
) [static]

Fill vector of node parameters on geometrical edge, including vertex nodes.

Parameters:
theMesh- The mesh containing nodes
theEdge- The geometrical edge of interest
theParams- The resulting vector of sorted node parameters
Return values:
bool- false if not all parameters are OK
static bool SMESH_Algo::GetSortedNodesOnEdge ( const SMESHDS_Mesh theMesh,
const TopoDS_Edge &  theEdge,
const bool  ignoreMediumNodes,
std::map< double, const SMDS_MeshNode * > &  theNodes 
) [static]

Fill map of node parameter on geometrical edge to node it-self.

Parameters:
theMesh- The mesh containing nodes
theEdge- The geometrical edge of interest
theNodes- The resulting map
ignoreMediumNodes- to store medium nodes of quadratic elements or not
Return values:
bool- false if not all parameters are OK
static bool SMESH_Algo::IsReversedSubMesh ( const TopoDS_Face &  theFace,
SMESHDS_Mesh theMeshDS 
) [static]

Find out elements orientation on a geometrical face.

Parameters:
theFace- The face correctly oriented in the shape being meshed
theMeshDS- The mesh data structure
Return values:
bool- true if the face normal and the normal of first element in the correspoding submesh point in different directions
static double SMESH_Algo::EdgeLength ( const TopoDS_Edge &  E) [static]

Compute length of an edge.

Parameters:
E- the edge
Return values:
double- the length
static GeomAbs_Shape SMESH_Algo::Continuity ( const TopoDS_Edge &  E1,
const TopoDS_Edge &  E2 
) [static]

Return continuity of two edges.

Parameters:
E1- the 1st edge
E2- the 2nd edge
Return values:
GeomAbs_Shape- regularity at the junction between E1 and E2
static bool SMESH_Algo::IsContinuous ( const TopoDS_Edge &  E1,
const TopoDS_Edge &  E2 
) [static]

Return true if an edge can be considered as a continuation of another.

Definition at line 295 of file SMESH_Algo.hxx.

static const SMDS_MeshNode* SMESH_Algo::VertexNode ( const TopoDS_Vertex &  V,
const SMESHDS_Mesh meshDS 
) [static]

Return the node built on a vertex.

Parameters:
V- the vertex
meshDS- mesh
Return values:
constSMDS_MeshNode* - found node or NULL
bool SMESH_Algo::error ( int  error,
const SMESH_Comment comment = "" 
) [protected]

store error and comment and then return ( error == COMPERR_OK )

bool SMESH_Algo::error ( const SMESH_Comment comment = "") [protected]

store COMPERR_ALGO_FAILED error and comment and then return false

Definition at line 317 of file SMESH_Algo.hxx.

References error(), and COMPERR_ALGO_FAILED.

Referenced by error().

Here is the call graph for this function:

Here is the caller graph for this function:

bool SMESH_Algo::error ( SMESH_ComputeErrorPtr  error) [protected]

store error and return error->IsOK()

void SMESH_Algo::addBadInputElement ( const SMDS_MeshElement elem) [protected]

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()

static bool SMESH_Hypothesis::IsStatusFatal ( Hypothesis_Status  theStatus) [static, inherited]

Definition at line 68 of file SMESH_Hypothesis.hxx.

virtual int SMESH_Hypothesis::GetDim ( ) const [virtual, inherited]

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

Here is the caller graph for this function:

int SMESH_Hypothesis::GetStudyId ( ) const [inherited]
virtual void SMESH_Hypothesis::NotifySubMeshesHypothesisModification ( ) [virtual, inherited]
virtual int SMESH_Hypothesis::GetShapeType ( ) const [virtual, inherited]
virtual const char* SMESH_Hypothesis::GetLibName ( ) const [virtual, inherited]
void SMESH_Hypothesis::SetLibName ( const char *  theLibName) [inherited]
void SMESH_Hypothesis::SetParameters ( const char *  theParameters) [inherited]
char* SMESH_Hypothesis::GetParameters ( ) const [inherited]
void SMESH_Hypothesis::SetLastParameters ( const char *  theParameters) [inherited]
char* SMESH_Hypothesis::GetLastParameters ( ) const [inherited]
void SMESH_Hypothesis::ClearParameters ( ) [inherited]
virtual bool SMESH_Hypothesis::IsAuxiliary ( ) const [virtual, inherited]

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:

const char* SMESHDS_Hypothesis::GetName ( ) const [inherited]
int SMESHDS_Hypothesis::GetID ( ) const [inherited]
int SMESHDS_Hypothesis::GetType ( ) const [inherited]

Referenced by SMESH_Hypothesis::IsAuxiliary().

Here is the caller graph for this function:


Field Documentation

Definition at line 333 of file SMESH_Algo.hxx.

Definition at line 334 of file SMESH_Algo.hxx.

bool SMESH_Algo::_onlyUnaryInput [protected]

Definition at line 339 of file SMESH_Algo.hxx.

Definition at line 340 of file SMESH_Algo.hxx.

bool SMESH_Algo::_requireShape [protected]

Definition at line 341 of file SMESH_Algo.hxx.

Definition at line 342 of file SMESH_Algo.hxx.

bool SMESH_Algo::_quadraticMesh [protected]

Definition at line 346 of file SMESH_Algo.hxx.

int SMESH_Algo::_error [protected]

SMESH_ComputeErrorName or anything algo specific.

Definition at line 348 of file SMESH_Algo.hxx.

any text explaining what is wrong in Compute()

Definition at line 349 of file SMESH_Algo.hxx.

to explain COMPERR_BAD_INPUT_MESH

Definition at line 350 of file SMESH_Algo.hxx.

SMESH_Gen* SMESH_Hypothesis::_gen [protected, inherited]

Definition at line 118 of file SMESH_Hypothesis.hxx.

int SMESH_Hypothesis::_studyId [protected, inherited]

Definition at line 119 of file SMESH_Hypothesis.hxx.

int SMESH_Hypothesis::_shapeType [protected, inherited]

Definition at line 120 of file SMESH_Hypothesis.hxx.

int SMESH_Hypothesis::_param_algo_dim [protected, inherited]

Definition at line 121 of file SMESH_Hypothesis.hxx.

std::string SMESHDS_Hypothesis::_name [protected, inherited]

Definition at line 52 of file SMESHDS_Hypothesis.hxx.

int SMESHDS_Hypothesis::_hypId [protected, inherited]

Definition at line 53 of file SMESHDS_Hypothesis.hxx.

int SMESHDS_Hypothesis::_type [protected, inherited]

Definition at line 54 of file SMESHDS_Hypothesis.hxx.