Salome HOME
c74d398bff88d50be355148ec888b049b941cc48
[modules/smesh.git] / src / SMESH / SMESH_Gen.hxx
1 //=============================================================================
2 // File      : SMESH_Gen.hxx
3 // Created   : jeu mai 16 22:53:13 CEST 2002
4 // Author    : Paul RASCLE, EDF
5 // Project   : SALOME
6 // Copyright : EDF 2002
7 // $Header$
8 //=============================================================================
9
10 #ifndef _SMESH_GEN_HXX_
11 #define _SMESH_GEN_HXX_
12
13 #include "Utils_SALOME_Exception.hxx"
14
15 #include "SMESH_HypothesisFactory.hxx"
16 #include "SMESH_Hypothesis.hxx"
17 #include "SMESH_Algo.hxx"
18 #include "SMESH_1D_Algo.hxx"
19 #include "SMESH_2D_Algo.hxx"
20 #include "SMESH_3D_Algo.hxx"
21 #include "SMESH_Mesh.hxx"
22
23 #include "SMESHDS_Document.hxx"
24
25 #include <TopoDS_Shape.hxx>
26
27 #include <map>
28
29 typedef struct studyContextStruct
30 {
31   map<int, SMESH_Hypothesis*> mapHypothesis;
32   map<int, SMESH_Mesh*> mapMesh;
33   Handle (SMESHDS_Document) myDocument;
34 } StudyContextStruct ;
35
36 class SMESH_Gen
37 {
38 public:
39   SMESH_Gen();
40   ~SMESH_Gen();
41
42   SMESH_Hypothesis* CreateHypothesis(const char* anHyp, int studyId)
43     throw (SALOME_Exception);
44   SMESH_Mesh* Init(int studyId, const TopoDS_Shape& aShape)
45     throw (SALOME_Exception);
46   bool Compute(::SMESH_Mesh& aMesh, const TopoDS_Shape& aShape)
47     throw (SALOME_Exception);
48   StudyContextStruct* GetStudyContext(int studyId);
49
50   static int GetShapeDim(const TopoDS_Shape& aShape);
51   SMESH_Algo* GetAlgo(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape);
52
53   // inherited methods from SALOMEDS::Driver
54
55   void Save(int studyId, const char *aUrlOfFile);
56   void Load(int studyId, const char *aUrlOfFile); 
57   void Close(int studyId); 
58   const char* ComponentDataType();
59
60   const char* IORToLocalPersistentID(const char* IORString, bool& IsAFile);
61   const char* LocalPersistentIDToIOR(const char* aLocalPersistentID);
62
63   SMESH_HypothesisFactory _hypothesisFactory;
64
65   map<int, SMESH_Algo*> _mapAlgo;
66   map<int, SMESH_1D_Algo*> _map1D_Algo;
67   map<int, SMESH_2D_Algo*> _map2D_Algo;
68   map<int, SMESH_3D_Algo*> _map3D_Algo;
69
70 private:
71   int _localId; // unique Id of created objects, within SMESH_Gen entity
72   map<int, StudyContextStruct*> _mapStudyContext;
73   map<int, SMESH_Hypothesis*> _mapHypothesis;
74 };
75
76 #endif