#include <SMESH_subMesh.hxx>
Data Structures | |
struct | OwnListenerData |
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, COMPUTE_SUBMESH, COMPUTE_NOGEOM, COMPUTE_CANCELED, CLEAN, SUBMESH_COMPUTED, SUBMESH_RESTORED, SUBMESH_LOADED, 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) | |
default constructor: More... | |
virtual | ~SMESH_subMesh () |
int | GetId () const |
SMESH_Mesh * | GetFather () |
SMESHDS_SubMesh * | GetSubMeshDS () |
const SMESHDS_SubMesh * | GetSubMeshDS () const |
SMESHDS_SubMesh * | CreateSubMeshDS () |
SMESH_subMesh * | GetFirstToCompute () |
SMESH_Algo * | GetAlgo () const |
Returns a current algorithm. More... | |
const std::map< int, SMESH_subMesh * > & | DependsOn () |
Returns all sub-meshes this one depend on. More... | |
bool | DependsOn (const SMESH_subMesh *other) const |
bool | DependsOn (const int shapeID) const |
SMESH_subMeshIteratorPtr | getDependsOnIterator (const bool includeSelf, const bool complexShapeFirst=false) const |
Return iterator on the sub-meshes this one depends on. More... | |
const std::vector < SMESH_subMesh * > & | GetAncestors () const |
Returns ancestor sub-meshes. More... | |
void | ClearAncestors () |
Clears the vector of ancestor sub-meshes. 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... | |
EventListenerData * | GetEventListenerData (EventListener *listener, const bool myOwn=false) const |
Return an event listener data. More... | |
EventListenerData * | GetEventListenerData (const std::string &listenerName, const bool myOwn=false) 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 (algo_event event, SMESH_Hypothesis *anHyp) |
Treats modification of hypotheses definition. More... | |
SMESH_Hypothesis::Hypothesis_Status | SubMeshesAlgoStateEngine (algo_event event, SMESH_Hypothesis *anHyp, bool exitOnFatal=false) |
Send an event to sub-meshes. More... | |
algo_state | GetAlgoState () const |
compute_state | GetComputeState () const |
SMESH_ComputeErrorPtr & | GetComputeError () |
void | DumpAlgoState (bool isMain) |
bool | ComputeStateEngine (compute_event event) |
void | ComputeSubMeshStateEngine (compute_event event, const bool includeSelf=false) |
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 () |
bool | SubMeshesComputed (bool *isFailedToCompute=0) const |
Return true if all sub-meshes have been meshed. More... | |
int | GetComputeCost () const |
Return cost of computing this sub-mesh. More... | |
bool | FindIntersection (const SMESH_subMesh *theOther, std::set< const SMESH_subMesh * > &theSetOfCommon) const |
Find common submeshes (based on shared subshapes with other. More... | |
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 occurred event. More... | |
void | deleteOwnListeners () |
Delete event listeners depending on algo of this submesh. More... | |
void | loadDependentMeshes () |
loads dependent meshes on SUBMESH_LOADED event More... | |
void | insertDependence (const TopoDS_Shape aShape, TopAbs_ShapeEnum aSubType, TopAbs_ShapeEnum avoidType=TopAbs_SHAPE) |
Add sub-meshes on sub-shapes of a given type into the dependence map. More... | |
void | removeSubMeshElementsAndNodes () |
void | updateDependantsState (const compute_event theEvent) |
void | updateSubMeshState (const compute_state theState) |
void | cleanDependants () |
void | cleanDependsOn (SMESH_Algo *algoRequiringCleaning=0) |
Remove elements from sub-meshes. More... | |
void | setAlgoState (algo_state state) |
TopoDS_Shape | getCollection (SMESH_Gen *theGen, SMESH_Algo *theAlgo, bool &theSubComputed, bool &theSubFailed, std::vector< SMESH_subMesh * > &theSubs) |
Return a shape containing all sub-shapes of the MainShape that can be meshed at once along with _subShape. More... | |
bool | checkComputeError (SMESH_Algo *theAlgo, const bool theComputeOK, const TopoDS_Shape &theShape=TopoDS_Shape()) |
Update compute_state by _computeError. More... | |
const SMESH_Hypothesis * | getSimilarAttached (const TopoDS_Shape &theShape, const SMESH_Hypothesis *theHyp, const int theHypType=0) |
Return a hypothesis attached to theShape. More... | |
int | computeCost () const |
Return cost of computing this sub-mesh. More... | |
Protected Attributes | |
std::map< EventListener *, EventListenerData * > | _eventListeners |
< event listeners to notify More... | |
std::list< OwnListenerData > | _ownListeners |
TopoDS_Shape | _subShape |
SMESHDS_SubMesh * | _subMeshDS |
SMESH_Mesh * | _father |
int | _Id |
std::map< int, SMESH_subMesh * > | _mapDepend |
bool | _dependenceAnalysed |
std::vector< SMESH_subMesh * > | _ancestors |
SMESH_Algo * | _algo |
algo_state | _algoState |
compute_state | _computeState |
SMESH_ComputeErrorPtr | _computeError |
int | _computeCost |
int | _realComputeCost |
bool | _alwaysComputed |
SMESH_subMesh::SMESH_subMesh | ( | int | Id, |
SMESH_Mesh * | father, | ||
SMESHDS_Mesh * | meshDS, | ||
const TopoDS_Shape & | aSubShape | ||
) |
default constructor:
References SMESH::HYP_OK, and SMESHDS_Mesh::MeshElements().
Referenced by GetAncestors(), and getDependsOnIterator().
|
virtual |
SMESH_Hypothesis::Hypothesis_Status SMESH_subMesh::AlgoStateEngine | ( | algo_event | event, |
SMESH_Hypothesis * | anHyp | ||
) |
Treats modification of hypotheses definition.
[in] | event | - what happens |
[in] | anHyp | - a hypothesis |
Optional description of a problematic situation (if any) can be retrieved via GetComputeError().
References SMESHDS_Mesh::AddHypothesis(), SMESH_HypoFilter::And(), SMESH_HypoFilter::AndNot(), SMESH_HypoFilter::HasType(), SMESH_Hypothesis::HYP_ALREADY_EXIST, SMESH_Hypothesis::HYP_BAD_DIM, SMESH_Hypothesis::HYP_HIDDEN_ALGO, SMESH_Hypothesis::HYP_HIDING_ALGO, SMESH_Hypothesis::HYP_INCOMPATIBLE, SMESH_Hypothesis::HYP_NEED_SHAPE, SMESH_Hypothesis::HYP_NOTCONFORM, SMESH_Hypothesis::HYP_OK, SMESH::HYP_OK, SMESH_HypoFilter::Init(), SMESH_HypoFilter::Is(), SMESH_HypoFilter::IsAlgo(), SMESH_HypoFilter::IsApplicableTo(), SMESH_Hypothesis::IsStatusFatal(), SMESH_MesherHelper::IsSubShape(), MESSAGE, SMESH_HypoFilter::Or(), and SMESHDS_Mesh::RemoveHypothesis().
bool SMESH_subMesh::CanAddHypothesis | ( | const SMESH_Hypothesis * | theHypothesis | ) | const |
References SMESH_Gen::GetShapeDim().
|
protected |
Update compute_state by _computeError.
Update compute_state by _computeError and send proper events to dependent submeshes.
bool | - false if there are errors |
bool | - true if _computeError is NOT set |
References COMPERR_NO_MESH_ON_SHAPE, Edge, SMESH_Algo::isDegenerated(), and SMESH_ComputeError::New().
SMESH_Hypothesis::Hypothesis_Status SMESH_subMesh::CheckConcurentHypothesis | ( | const int | theHypType | ) |
References SMESH_Hypothesis::HYP_CONCURENT, and SMESH_Hypothesis::HYP_OK.
|
protected |
References SMESH_Gen::GetShapeDim().
|
protected |
Remove elements from sub-meshes.
algoRequiringCleaning | - an all-dimensional algorithm whose presence causes the cleaning. |
References SMESH_HypoFilter::And(), SMESH_Gen::GetShapeDim(), SMESH_MesherHelper::GetShapeOfHypothesis(), SMESH_HypoFilter::Init(), SMESH_HypoFilter::IsAlgo(), and SMESH_HypoFilter::IsMoreLocalThan().
void SMESH_subMesh::ClearAncestors | ( | ) |
Clears the vector of ancestor sub-meshes.
References _ancestors.
|
protected |
Return cost of computing this sub-mesh.
The cost depends on the shape type and number of sub-meshes this one DependsOn().
bool SMESH_subMesh::ComputeStateEngine | ( | compute_event | event | ) |
References SMESHDS_Hypothesis::ALGO_1D, SMESHDS_Hypothesis::ALGO_3D, SMDS_Mesh::CheckMemory(), cleanSubMesh(), COMPERR_ALGO_FAILED, COMPERR_BAD_INPUT_MESH, COMPERR_EXCEPTION, COMPERR_MEMORY_PB, COMPERR_OCC_EXCEPTION, COMPERR_OK, COMPERR_SLM_EXCEPTION, COMPERR_STD_EXCEPTION, COMPERR_WARNING, Edge, SMESH::HYP_OK, MESSAGE, SMESHDS_SubMesh::NbNodes(), SMESH_ComputeError::New(), OCC_CATCH_SIGNALS, SMESH_MesherHelper::SetElementsOnShape(), SMESH_MesherHelper::SetSubShape(), SMESH_Comment::Stream(), and SMESH_ComputeError::Worst().
void SMESH_subMesh::ComputeSubMeshStateEngine | ( | compute_event | event, |
const bool | includeSelf = false |
||
) |
SMESHDS_SubMesh * SMESH_subMesh::CreateSubMeshDS | ( | ) |
References SMESHDS_Mesh::NewSubMesh(), and SMESHDS_Mesh::ShapeToIndex().
void SMESH_subMesh::DeleteEventListener | ( | EventListener * | listener | ) |
Unregister the listener and delete it and it's data.
Unregister the listener and delete listener's data.
listener | - the event listener to delete |
listener | - the event listener |
References _eventListeners.
|
protected |
Delete event listeners depending on algo of this submesh.
References _father, _ownListeners, and MESHCUT::d.
const map< int, SMESH_subMesh * > & SMESH_subMesh::DependsOn | ( | ) |
Returns all sub-meshes this one depend on.
bool SMESH_subMesh::DependsOn | ( | const SMESH_subMesh * | other | ) | const |
void SMESH_subMesh::DumpAlgoState | ( | bool | isMain | ) |
References SMESH_Gen::GetShapeDim(), SMESH::HYP_OK, and MESSAGE.
bool SMESH_subMesh::Evaluate | ( | MapShapeNbElems & | aResMap | ) |
References COMPERR_OK, SMESH_Gen::GetShapeDim(), SMESH_ComputeError::New(), SMDSEntity_Last, and SMDSEntity_Node.
bool SMESH_subMesh::FindIntersection | ( | const SMESH_subMesh * | theOther, |
std::set< const SMESH_subMesh * > & | theSetOfCommon | ||
) | const |
Find common submeshes (based on shared subshapes with other.
Find common submeshes (based on shared sub-shapes with other.
theOther | submesh to check |
theCommonIds | set of common submesh IDs NOTE: this method does not cleat set before collect common IDs |
theOther | submesh to check |
theSetOfCommon | set of common submesh |
References _mapDepend.
SMESH_Algo * SMESH_subMesh::GetAlgo | ( | ) | const |
Returns a current algorithm.
References me.
algo_state SMESH_subMesh::GetAlgoState | ( | ) | const |
const std::vector< SMESH_subMesh * > & SMESH_subMesh::GetAncestors | ( | ) | const |
Returns ancestor sub-meshes.
Finds them if not yet found.
References _ancestors, _father, _subShape, me, and SMESH_subMesh().
|
protected |
Return a shape containing all sub-shapes of the MainShape that can be meshed at once along with _subShape.
int SMESH_subMesh::GetComputeCost | ( | ) | const |
Return cost of computing this sub-mesh.
If hypotheses are not well defined, zero is returned
SMESH_ComputeErrorPtr& SMESH_subMesh::GetComputeError | ( | ) |
compute_state SMESH_subMesh::GetComputeState | ( | ) | const |
SMESH_subMeshIteratorPtr SMESH_subMesh::getDependsOnIterator | ( | const bool | includeSelf, |
const bool | reverse = false |
||
) | const |
Return iterator on the sub-meshes this one depends on.
Return iterator on the submeshes this one depends on.
By default most simple sub-meshes go first.
includeSelf | - this submesh to be returned also |
reverse | - if true, complex shape submeshes go first |
References me, and SMESH_subMesh().
EventListenerData* SMESH_subMesh::GetEventListenerData | ( | EventListener * | listener, |
const bool | myOwn = false |
||
) | const |
Return an event listener data.
listener | - the listener whose data is |
myOwn | - if true , returns a listener set by this sub-mesh, else returns a listener listening to events of this sub-mesh |
EventListenerData* | - found data, maybe NULL |
Referenced by VISCOUS_3D::ToClearSubWithMain().
EventListenerData* SMESH_subMesh::GetEventListenerData | ( | const std::string & | listenerName, |
const bool | myOwn = false |
||
) | const |
Return an event listener data.
listenerName | - the listener name |
myOwn | - if true , returns a listener set by this sub-mesh, else returns a listener listening to events of this sub-mesh |
EventListenerData* | - found data, maybe NULL |
SMESH_Mesh* SMESH_subMesh::GetFather | ( | ) |
Referenced by VISCOUS_3D::ToClearSubWithMain().
SMESH_subMesh * SMESH_subMesh::GetFirstToCompute | ( | ) |
int SMESH_subMesh::GetId | ( | ) | const |
|
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
References SMESH_HypoFilter::And(), SMESH_HypoFilter::AndNot(), SMESH_HypoFilter::HasDim(), SMESH_HypoFilter::HasName(), SMESH_HypoFilter::HasType(), SMESH_HypoFilter::Init(), SMESH_HypoFilter::Is(), SMESH_HypoFilter::IsApplicableTo(), and SMESH_HypoFilter::IsAuxiliary().
SMESHDS_SubMesh * SMESH_subMesh::GetSubMeshDS | ( | ) |
const SMESHDS_SubMesh* SMESH_subMesh::GetSubMeshDS | ( | ) | const |
const TopoDS_Shape& SMESH_subMesh::GetSubShape | ( | ) | const |
|
protected |
Add sub-meshes on sub-shapes of a given type into the dependence map.
bool SMESH_subMesh::IsAlwaysComputed | ( | ) |
|
static |
References SMESH_Gen::GetShapeDim(), and SMESHDS_Hypothesis::PARAM_ALGO.
Referenced by SMESH_HypoFilter::ApplicablePredicate::IsOk().
bool SMESH_subMesh::IsApplicableHypotesis | ( | const SMESH_Hypothesis * | theHypothesis | ) | const |
bool SMESH_subMesh::IsConform | ( | const SMESH_Algo * | theAlgo | ) |
bool SMESH_subMesh::IsEmpty | ( | ) | const |
Return true if no mesh entities is bound to the submesh.
bool SMESH_subMesh::IsMeshComputed | ( | ) | const |
References SMESH_Gen::GetShapeDim(), and SMESHDS_Mesh::MeshElements().
|
protected |
loads dependent meshes on SUBMESH_LOADED event
References _father, _ownListeners, and MESHCUT::d.
|
protected |
Notify stored event listeners on the occurred event.
event | - algo_event or compute_event itself |
eventType | - algo_event or compute_event |
hyp | - hypothesis, if eventType is algo_event |
References _eventListeners.
|
protected |
References cleanSubMesh(), and SMESH_Gen::GetShapeDim().
|
protected |
void SMESH_subMesh::SetEventListener | ( | EventListener * | listener, |
EventListenerData * | data, | ||
SMESH_subMesh * | where | ||
) |
Sets an event listener and its data to a submesh.
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 it when HYP_OK algo_state is lost After being set, event listener is notified on each event of submesh.
listener | - the listener to store |
data | - the listener data to store |
where | - the submesh to store the listener and it's data |
It remembers the submesh where 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 where submesh.
References _ownListeners.
Referenced by VISCOUS_3D::ToClearSubWithMain().
|
protected |
Sets an event listener and its data to a submesh.
listener | - the listener to store |
data | - the listener data to store |
After being set, event listener is notified on each event of a submesh.
References _eventListeners, SMESH_subMeshEventListener::GetName(), and SMESH_subMeshEventListenerData::IsDeletable().
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.
Allow algo->Compute() if a sub-shape of lower dim is meshed but none mesh entity is bound to it (PAL13615, 2nd part)
Referenced by StdMeshers_UseExisting_2D::Compute(), and StdMeshers_UseExisting_1D::Compute().
SMESH_Hypothesis::Hypothesis_Status SMESH_subMesh::SubMeshesAlgoStateEngine | ( | algo_event | event, |
SMESH_Hypothesis * | anHyp, | ||
bool | exitOnFatal = false |
||
) |
Send an event to sub-meshes.
[in] | event | - the event |
[in] | anHyp | - an hypothesis |
[in] | exitOnFatal | - to stop iteration on sub-meshes if a sub-mesh reports a fatal result |
Optional description of a problematic situation (if any) can be retrieved via GetComputeError().
References SMESH_Hypothesis::HYP_OK, and SMESH_Hypothesis::IsStatusFatal().
Return true if all sub-meshes have been meshed.
References SMESH_Gen::GetShapeDim(), SMESHDS_SubMesh::NbElements(), and SMESHDS_SubMesh::NbNodes().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Referenced by ClearAncestors(), and GetAncestors().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
< event listeners to notify
event listeners to delete when HYP_OK algo_state is lost
Referenced by DeleteEventListener(), notifyListenersOnEvent(), and setEventListener().
|
protected |
Referenced by deleteOwnListeners(), GetAncestors(), and loadDependentMeshes().
|
protected |
|
protected |
Referenced by FindIntersection().
|
protected |
Referenced by deleteOwnListeners(), loadDependentMeshes(), and SetEventListener().
|
protected |
|
protected |
|
protected |
Referenced by GetAncestors().