SALOME - SMESH
SMESH_subMesh Class Reference

#include <SMESH_subMesh.hxx>

Collaboration diagram for SMESH_subMesh:
Collaboration graph

Public Types

enum  compute_state { NOT_READY, READY_TO_COMPUTE, COMPUTE_OK, FAILED_TO_COMPUTE }
 
enum  algo_state { NO_ALGO, MISSING_HYP, HYP_OK }
 
enum  algo_event {
  ADD_HYP, ADD_ALGO, REMOVE_HYP, REMOVE_ALGO,
  ADD_FATHER_HYP, ADD_FATHER_ALGO, REMOVE_FATHER_HYP, REMOVE_FATHER_ALGO,
  MODIF_HYP
}
 
enum  compute_event {
  MODIF_ALGO_STATE, COMPUTE, CLEAN, SUBMESH_COMPUTED,
  SUBMESH_RESTORED, MESH_ENTITY_REMOVED, CHECK_COMPUTE_STATE
}
 
enum  event_type { ALGO_EVENT, COMPUTE_EVENT }
 

Public Member Functions

 SMESH_subMesh (int Id, SMESH_Mesh *father, SMESHDS_Mesh *meshDS, const TopoDS_Shape &aSubShape)
 
virtual ~ SMESH_subMesh ()
 
int GetId () const
 
SMESH_MeshGetFather ()
 
SMESHDS_SubMeshGetSubMeshDS ()
 
SMESHDS_SubMeshCreateSubMeshDS ()
 
SMESH_subMeshGetFirstToCompute ()
 
const std::map< int, SMESH_subMesh *> & DependsOn ()
 
SMESH_subMeshIteratorPtr getDependsOnIterator (const bool includeSelf, const bool complexShapeFirst)
 Return iterator on the submeshes this one depends on. More...
 
const TopoDS_Shape & GetSubShape () const
 
void SetEventListener (EventListener *listener, EventListenerData *data, SMESH_subMesh *where)
 Sets an event listener and its data to a submesh. More...
 
EventListenerDataGetEventListenerData (EventListener *listener) const
 Return an event listener data. More...
 
void DeleteEventListener (EventListener *listener)
 Unregister the listener and delete it and it's data. More...
 
SMESH_Hypothesis::Hypothesis_Status AlgoStateEngine (int event, SMESH_Hypothesis *anHyp)
 
SMESH_Hypothesis::Hypothesis_Status SubMeshesAlgoStateEngine (int event, SMESH_Hypothesis *anHyp)
 
int GetAlgoState () const
 
int GetComputeState () const
 
SMESH_ComputeErrorPtrGetComputeError ()
 
void DumpAlgoState (bool isMain)
 
bool ComputeStateEngine (int event)
 
bool Evaluate (MapShapeNbElems &aResMap)
 
bool IsConform (const SMESH_Algo *theAlgo)
 
bool CanAddHypothesis (const SMESH_Hypothesis *theHypothesis) const
 
bool IsApplicableHypotesis (const SMESH_Hypothesis *theHypothesis) const
 
SMESH_Hypothesis::Hypothesis_Status CheckConcurentHypothesis (const int theHypType)
 
bool IsEmpty () const
 Return true if no mesh entities is bound to the submesh. More...
 
bool IsMeshComputed () const
 
void SetIsAlwaysComputed (bool isAlCo)
 Allow algo->Compute() if a subshape of lower dim is meshed but none mesh entity is bound to it. More...
 
bool IsAlwaysComputed ()
 

Static Public Member Functions

static bool IsApplicableHypotesis (const SMESH_Hypothesis *theHypothesis, const TopAbs_ShapeEnum theShapeType)
 

Protected Member Functions

void SetEventListener (EventListener *listener, EventListenerData *data)
 Sets an event listener and its data to a submesh. More...
 
void NotifyListenersOnEvent (const int event, const event_type eventType, SMESH_Hypothesis *hyp=0)
 Notify stored event listeners on the occured event. More...
 
void DeleteOwnListeners ()
 Delete event listeners depending on algo of this submesh. More...
 
void InsertDependence (const TopoDS_Shape aSubShape)
 
bool SubMeshesComputed ()
 
bool SubMeshesReady ()
 
void RemoveSubMeshElementsAndNodes ()
 
void UpdateDependantsState (const compute_event theEvent)
 
void UpdateSubMeshState (const compute_state theState)
 
void ComputeSubMeshStateEngine (int event)
 
void CleanDependants ()
 
void CleanDependsOn ()
 
void SetAlgoState (int state)
 
TopoDS_Shape GetCollection (SMESH_Gen *theGen, SMESH_Algo *theAlgo, bool &theSubComputed)
 Return a shape containing all sub-shapes of the MainShape that can be meshed at once along with _subShape. More...
 
bool ApplyToCollection (SMESH_Algo *theAlgo, const TopoDS_Shape &theCollection)
 Apply theAlgo to all subshapes in theCollection. More...
 
bool CheckComputeError (SMESH_Algo *theAlgo, const TopoDS_Shape &theShape=TopoDS_Shape())
 Update compute_state by _computeError. More...
 
const SMESH_HypothesisGetSimilarAttached (const TopoDS_Shape &theShape, const SMESH_Hypothesis *theHyp, const int theHypType=0)
 Return a hypothesis attached to theShape. More...
 

Protected Attributes

std::map< EventListener *, EventListenerData *> myEventListeners
 < event listeners to notify More...
 
std::list< std::pair< SMESH_subMesh *, EventListener *> > myOwnListeners
 
TopoDS_Shape _subShape
 
SMESHDS_SubMesh_subMeshDS
 
SMESH_Mesh_father
 
int _Id
 
std::map< int, SMESH_subMesh *> _mapDepend
 
bool _dependenceAnalysed
 
int _algoState
 
int _computeState
 
SMESH_ComputeErrorPtr _computeError
 
bool _alwaysComputed
 

Detailed Description

Definition at line 59 of file SMESH_subMesh.hxx.

Member Enumeration Documentation

◆ compute_state

Enumerator
NOT_READY 
READY_TO_COMPUTE 
COMPUTE_OK 
FAILED_TO_COMPUTE 

Definition at line 87 of file SMESH_subMesh.hxx.

◆ algo_state

Enumerator
NO_ALGO 
MISSING_HYP 
HYP_OK 

Definition at line 92 of file SMESH_subMesh.hxx.

◆ algo_event

Enumerator
ADD_HYP 
ADD_ALGO 
REMOVE_HYP 
REMOVE_ALGO 
ADD_FATHER_HYP 
ADD_FATHER_ALGO 
REMOVE_FATHER_HYP 
REMOVE_FATHER_ALGO 
MODIF_HYP 

Definition at line 96 of file SMESH_subMesh.hxx.

◆ compute_event

Enumerator
MODIF_ALGO_STATE 
COMPUTE 
CLEAN 
SUBMESH_COMPUTED 
SUBMESH_RESTORED 
MESH_ENTITY_REMOVED 
CHECK_COMPUTE_STATE 

Definition at line 104 of file SMESH_subMesh.hxx.

◆ event_type

Enumerator
ALGO_EVENT 
COMPUTE_EVENT 

Definition at line 110 of file SMESH_subMesh.hxx.

Constructor & Destructor Documentation

◆ SMESH_subMesh()

SMESH_subMesh::SMESH_subMesh ( int  Id,
SMESH_Mesh father,
SMESHDS_Mesh meshDS,
const TopoDS_Shape &  aSubShape 
)

◆ ~ SMESH_subMesh()

virtual SMESH_subMesh::~ SMESH_subMesh ( )
virtual

Member Function Documentation

◆ GetId()

int SMESH_subMesh::GetId ( ) const

◆ GetFather()

SMESH_Mesh* SMESH_subMesh::GetFather ( )

Definition at line 68 of file SMESH_subMesh.hxx.

◆ GetSubMeshDS()

SMESHDS_SubMesh* SMESH_subMesh::GetSubMeshDS ( )

◆ CreateSubMeshDS()

SMESHDS_SubMesh* SMESH_subMesh::CreateSubMeshDS ( )

◆ GetFirstToCompute()

SMESH_subMesh* SMESH_subMesh::GetFirstToCompute ( )

◆ DependsOn()

const std::map< int, SMESH_subMesh * >& SMESH_subMesh::DependsOn ( )

◆ getDependsOnIterator()

SMESH_subMeshIteratorPtr SMESH_subMesh::getDependsOnIterator ( const bool  includeSelf,
const bool  complexShapeFirst 
)

Return iterator on the submeshes this one depends on.

◆ GetSubShape()

const TopoDS_Shape& SMESH_subMesh::GetSubShape ( ) const

◆ SetEventListener() [1/2]

void SMESH_subMesh::SetEventListener ( EventListener listener,
EventListenerData data,
SMESH_subMesh where 
)

Sets an event listener and its data to a submesh.

Parameters
listener- the listener to store
data- the listener data to store
where- the submesh to store the listener and it's data

The method remembers the submesh it puts the listener in order to delete them when HYP_OK algo_state is lost After being set, event listener is notified on each event of submesh.

◆ GetEventListenerData()

EventListenerData* SMESH_subMesh::GetEventListenerData ( EventListener listener) const

Return an event listener data.

Parameters
listener- the listener whose data is
Return values
EventListenerData*- found data, maybe NULL

◆ DeleteEventListener()

void SMESH_subMesh::DeleteEventListener ( EventListener listener)

Unregister the listener and delete it and it's data.

Parameters
listener- the event listener to delete

◆ SetEventListener() [2/2]

void SMESH_subMesh::SetEventListener ( EventListener listener,
EventListenerData data 
)
protected

Sets an event listener and its data to a submesh.

Parameters
listener- the listener to store
data- the listener data to store

After being set, event listener is notified on each event of a submesh.

◆ NotifyListenersOnEvent()

void SMESH_subMesh::NotifyListenersOnEvent ( const int  event,
const event_type  eventType,
SMESH_Hypothesis hyp = 0 
)
protected

Notify stored event listeners on the occured event.

Parameters
event- algo_event or compute_event itself
eventType- algo_event or compute_event
hyp- hypothesis, if eventType is algo_event

◆ DeleteOwnListeners()

void SMESH_subMesh::DeleteOwnListeners ( )
protected

Delete event listeners depending on algo of this submesh.

◆ AlgoStateEngine()

SMESH_Hypothesis::Hypothesis_Status SMESH_subMesh::AlgoStateEngine ( int  event,
SMESH_Hypothesis anHyp 
)

◆ SubMeshesAlgoStateEngine()

SMESH_Hypothesis::Hypothesis_Status SMESH_subMesh::SubMeshesAlgoStateEngine ( int  event,
SMESH_Hypothesis anHyp 
)

◆ GetAlgoState()

int SMESH_subMesh::GetAlgoState ( ) const

Definition at line 187 of file SMESH_subMesh.hxx.

◆ GetComputeState()

int SMESH_subMesh::GetComputeState ( ) const

Definition at line 188 of file SMESH_subMesh.hxx.

◆ GetComputeError()

SMESH_ComputeErrorPtr& SMESH_subMesh::GetComputeError ( )

Definition at line 189 of file SMESH_subMesh.hxx.

◆ DumpAlgoState()

void SMESH_subMesh::DumpAlgoState ( bool  isMain)

◆ ComputeStateEngine()

bool SMESH_subMesh::ComputeStateEngine ( int  event)

◆ Evaluate()

bool SMESH_subMesh::Evaluate ( MapShapeNbElems aResMap)

◆ IsConform()

bool SMESH_subMesh::IsConform ( const SMESH_Algo theAlgo)

◆ CanAddHypothesis()

bool SMESH_subMesh::CanAddHypothesis ( const SMESH_Hypothesis theHypothesis) const

◆ IsApplicableHypotesis() [1/2]

static bool SMESH_subMesh::IsApplicableHypotesis ( const SMESH_Hypothesis theHypothesis,
const TopAbs_ShapeEnum  theShapeType 
)
static

◆ IsApplicableHypotesis() [2/2]

bool SMESH_subMesh::IsApplicableHypotesis ( const SMESH_Hypothesis theHypothesis) const

Definition at line 207 of file SMESH_subMesh.hxx.

◆ CheckConcurentHypothesis()

SMESH_Hypothesis::Hypothesis_Status SMESH_subMesh::CheckConcurentHypothesis ( const int  theHypType)

◆ IsEmpty()

bool SMESH_subMesh::IsEmpty ( ) const

Return true if no mesh entities is bound to the submesh.

◆ IsMeshComputed()

bool SMESH_subMesh::IsMeshComputed ( ) const

◆ SetIsAlwaysComputed()

void SMESH_subMesh::SetIsAlwaysComputed ( bool  isAlCo)

Allow algo->Compute() if a subshape of lower dim is meshed but none mesh entity is bound to it.

◆ IsAlwaysComputed()

bool SMESH_subMesh::IsAlwaysComputed ( )

Definition at line 228 of file SMESH_subMesh.hxx.

◆ InsertDependence()

void SMESH_subMesh::InsertDependence ( const TopoDS_Shape  aSubShape)
protected

◆ SubMeshesComputed()

bool SMESH_subMesh::SubMeshesComputed ( )
protected

◆ SubMeshesReady()

bool SMESH_subMesh::SubMeshesReady ( )
protected

◆ RemoveSubMeshElementsAndNodes()

void SMESH_subMesh::RemoveSubMeshElementsAndNodes ( )
protected

◆ UpdateDependantsState()

void SMESH_subMesh::UpdateDependantsState ( const compute_event  theEvent)
protected

◆ UpdateSubMeshState()

void SMESH_subMesh::UpdateSubMeshState ( const compute_state  theState)
protected

◆ ComputeSubMeshStateEngine()

void SMESH_subMesh::ComputeSubMeshStateEngine ( int  event)
protected

◆ CleanDependants()

void SMESH_subMesh::CleanDependants ( )
protected

◆ CleanDependsOn()

void SMESH_subMesh::CleanDependsOn ( )
protected

◆ SetAlgoState()

void SMESH_subMesh::SetAlgoState ( int  state)
protected

◆ GetCollection()

TopoDS_Shape SMESH_subMesh::GetCollection ( SMESH_Gen theGen,
SMESH_Algo theAlgo,
bool &  theSubComputed 
)
protected

Return a shape containing all sub-shapes of the MainShape that can be meshed at once along with _subShape.

◆ ApplyToCollection()

bool SMESH_subMesh::ApplyToCollection ( SMESH_Algo theAlgo,
const TopoDS_Shape &  theCollection 
)
protected

Apply theAlgo to all subshapes in theCollection.

◆ CheckComputeError()

bool SMESH_subMesh::CheckComputeError ( SMESH_Algo theAlgo,
const TopoDS_Shape &  theShape = TopoDS_Shape() 
)
protected

Update compute_state by _computeError.

Return values
bool- false if there are errors

◆ GetSimilarAttached()

const SMESH_Hypothesis* SMESH_subMesh::GetSimilarAttached ( const TopoDS_Shape &  theShape,
const SMESH_Hypothesis theHyp,
const int  theHypType = 0 
)
protected

Return a hypothesis attached to theShape.

If theHyp is provided, similar but not same hypotheses is returned; else an applicable ones having theHypType is returned

Field Documentation

◆ myEventListeners

std::map< EventListener*, EventListenerData* > SMESH_subMesh::myEventListeners
protected

< event listeners to notify

event listeners to delete when HYP_OK algo_state is lost

Definition at line 149 of file SMESH_subMesh.hxx.

◆ myOwnListeners

std::list< std::pair< SMESH_subMesh*, EventListener* > > SMESH_subMesh::myOwnListeners
protected

Definition at line 151 of file SMESH_subMesh.hxx.

◆ _subShape

TopoDS_Shape SMESH_subMesh::_subShape
protected

Definition at line 281 of file SMESH_subMesh.hxx.

◆ _subMeshDS

SMESHDS_SubMesh* SMESH_subMesh::_subMeshDS
protected

Definition at line 282 of file SMESH_subMesh.hxx.

◆ _father

SMESH_Mesh* SMESH_subMesh::_father
protected

Definition at line 283 of file SMESH_subMesh.hxx.

◆ _Id

int SMESH_subMesh::_Id
protected

Definition at line 284 of file SMESH_subMesh.hxx.

◆ _mapDepend

std::map< int, SMESH_subMesh * > SMESH_subMesh::_mapDepend
protected

Definition at line 286 of file SMESH_subMesh.hxx.

◆ _dependenceAnalysed

bool SMESH_subMesh::_dependenceAnalysed
protected

Definition at line 287 of file SMESH_subMesh.hxx.

◆ _algoState

int SMESH_subMesh::_algoState
protected

Definition at line 289 of file SMESH_subMesh.hxx.

◆ _computeState

int SMESH_subMesh::_computeState
protected

Definition at line 290 of file SMESH_subMesh.hxx.

◆ _computeError

SMESH_ComputeErrorPtr SMESH_subMesh::_computeError
protected

Definition at line 291 of file SMESH_subMesh.hxx.

◆ _alwaysComputed

bool SMESH_subMesh::_alwaysComputed
protected

Definition at line 296 of file SMESH_subMesh.hxx.