1 //=============================================================================
2 // File : SMESH_subMesh.hxx
3 // Created : jeu mai 30 13:28:36 CEST 2002
4 // Author : Paul RASCLE, EDF
6 // Copyright : EDF 2002
8 //=============================================================================
10 #ifndef _SMESH_SUBMESH_HXX_
11 #define _SMESH_SUBMESH_HXX_
13 #include "SMESHDS_Mesh.hxx"
14 #include "SMESHDS_SubMesh.hxx"
15 #include "Utils_SALOME_Exception.hxx"
16 #include <TopoDS_Shape.hxx>
17 #include <TColStd_IndexedMapOfTransient.hxx>
18 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
25 class SMESH_Hypothesis;
32 const Handle(SMESHDS_Mesh)& meshDS,
33 const TopoDS_Shape & aSubShape);
34 virtual ~SMESH_subMesh();
38 // bool Contains(const TopoDS_Shape & aSubShape)
39 // throw (SALOME_Exception);
41 const Handle(SMESHDS_SubMesh)& GetSubMeshDS()
42 throw (SALOME_Exception);
44 SMESH_subMesh* GetFirstToCompute()
45 throw (SALOME_Exception);
47 const map<int, SMESH_subMesh*>& DependsOn();
48 const map<int, SMESH_subMesh*>& Dependants();
50 const TopoDS_Shape& GetSubShape();
52 bool _vertexSet; // only for vertex subMesh, set to false for dim > 0
54 enum compute_state { NOT_READY, READY_TO_COMPUTE,
55 COMPUTE_OK, FAILED_TO_COMPUTE };
56 enum algo_state { NO_ALGO, MISSING_HYP, HYP_OK };
57 enum algo_event {ADD_HYP, ADD_ALGO,
58 REMOVE_HYP, REMOVE_ALGO,
59 ADD_FATHER_HYP, ADD_FATHER_ALGO,
60 REMOVE_FATHER_HYP, REMOVE_FATHER_ALGO};
61 enum compute_event {MODIF_HYP, MODIF_ALGO_STATE, COMPUTE,
62 CLEAN, CLEANDEP, SUBMESH_COMPUTED};
64 bool AlgoStateEngine(int event, SMESH_Hypothesis* anHyp)
65 throw (SALOME_Exception);
67 void SubMeshesAlgoStateEngine(int event, SMESH_Hypothesis* anHyp)
68 throw (SALOME_Exception);
70 void DumpAlgoState(bool isMain);
72 bool ComputeStateEngine(int event)
73 throw (SALOME_Exception);
75 int GetComputeState() {return _computeState;};
78 void InsertDependence(const TopoDS_Shape aSubShape);
79 // void FinalizeDependence(list<TopoDS_Shape>& shapeList);
81 bool SubMeshesComputed()
82 throw (SALOME_Exception);
84 bool SubMeshesReady();
86 void RemoveSubMeshElementsAndNodes();
87 void UpdateDependantsState();
88 void CleanDependants();
89 void ExtractDependants(const TopTools_IndexedDataMapOfShapeListOfShape& M,
90 const TopAbs_ShapeEnum etype);
91 void SetAlgoState(int state);
93 TopoDS_Shape _subShape;
94 Handle (SMESHDS_Mesh) _meshDS;
95 Handle (SMESHDS_SubMesh) _subMeshDS;
98 map<int, SMESH_subMesh*> _mapDepend;
99 map<int, SMESH_subMesh*> _mapDependants;
100 bool _dependenceAnalysed;
101 bool _dependantsFound;