Salome HOME
NRI : Change lGeometryClient by lGEOMClient.
[modules/smesh.git] / src / SMESH / SMESH_subMesh.hxx
1 //=============================================================================
2 // File      : SMESH_subMesh.hxx
3 // Created   : jeu mai 30 13:28:36 CEST 2002
4 // Author    : Paul RASCLE, EDF
5 // Project   : SALOME
6 // Copyright : EDF 2002
7 // $Header$
8 //=============================================================================
9
10 #ifndef _SMESH_SUBMESH_HXX_
11 #define _SMESH_SUBMESH_HXX_
12
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>
19
20 #include <set>
21 #include <list>
22 #include <map>
23
24 class SMESH_Mesh;
25 class SMESH_Hypothesis;
26
27 class SMESH_subMesh
28 {
29 public:
30   SMESH_subMesh(int Id,
31                 SMESH_Mesh* father,
32                 const Handle(SMESHDS_Mesh)& meshDS,
33                 const TopoDS_Shape & aSubShape);
34   virtual ~SMESH_subMesh();
35
36   int GetId();
37
38 //   bool Contains(const TopoDS_Shape & aSubShape)
39 //     throw (SALOME_Exception);
40
41   const Handle(SMESHDS_SubMesh)& GetSubMeshDS()
42     throw (SALOME_Exception);
43
44   SMESH_subMesh* GetFirstToCompute()
45     throw (SALOME_Exception);
46
47   const map<int, SMESH_subMesh*>& DependsOn();
48   const map<int, SMESH_subMesh*>& Dependants();
49
50   const TopoDS_Shape& GetSubShape();
51
52   bool _vertexSet;   // only for vertex subMesh, set to false for dim > 0
53
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};
63
64   bool AlgoStateEngine(int event, SMESH_Hypothesis* anHyp)
65     throw (SALOME_Exception);
66
67   void SubMeshesAlgoStateEngine(int event, SMESH_Hypothesis* anHyp)
68     throw (SALOME_Exception);
69
70   void DumpAlgoState(bool isMain);
71
72   bool ComputeStateEngine(int event)
73     throw (SALOME_Exception);
74
75   int GetComputeState() {return _computeState;};
76
77 protected:
78   void InsertDependence(const TopoDS_Shape aSubShape);
79 //   void FinalizeDependence(list<TopoDS_Shape>& shapeList);
80
81   bool SubMeshesComputed()
82     throw (SALOME_Exception);
83
84   bool SubMeshesReady();
85
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);
92
93   TopoDS_Shape _subShape;
94   Handle (SMESHDS_Mesh) _meshDS;
95   Handle (SMESHDS_SubMesh) _subMeshDS;
96   int _Id;
97   SMESH_Mesh* _father;
98   map<int, SMESH_subMesh*> _mapDepend;
99   map<int, SMESH_subMesh*> _mapDependants;
100   bool _dependenceAnalysed;
101   bool _dependantsFound;
102
103   int _algoState;
104   int _oldAlgoState;
105   int _computeState;
106
107 };
108
109 #endif