Salome HOME
Merge br_enable_import_mesh. Enable import mesh and save/load SMESH study.
[modules/smesh.git] / src / SMESH / SMESH_Gen.hxx
1 //  SMESH SMESH : implementaion of SMESH idl descriptions
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : SMESH_Gen.hxx
25 //  Author : Paul RASCLE, EDF
26 //  Module : SMESH
27 //  $Header$
28
29 #ifndef _SMESH_GEN_HXX_
30 #define _SMESH_GEN_HXX_
31
32 #include "Utils_SALOME_Exception.hxx"
33
34 #include "SMESH_HypothesisFactory.hxx"
35 #include "SMESH_Hypothesis.hxx"
36 #include "SMESH_Algo.hxx"
37 #include "SMESH_1D_Algo.hxx"
38 #include "SMESH_2D_Algo.hxx"
39 #include "SMESH_3D_Algo.hxx"
40 #include "SMESH_Mesh.hxx"
41
42 #include "SMESHDS_Document.hxx"
43
44 #include <TopoDS_Shape.hxx>
45
46 #include <map>
47 using namespace std;
48
49 typedef struct studyContextStruct
50 {
51         map < int, SMESH_Hypothesis * >mapHypothesis;
52           map < int, SMESH_Mesh * >mapMesh;
53           SMESHDS_Document * myDocument;
54 } StudyContextStruct;
55
56 class SMESH_Gen
57 {
58   public:
59         SMESH_Gen();
60         ~SMESH_Gen();
61
62         SMESH_Hypothesis *CreateHypothesis(const char *anHyp, int studyId)
63                 throw(SALOME_Exception);
64         SMESH_Mesh *Init(int studyId, const TopoDS_Shape & aShape)
65                 throw(SALOME_Exception);
66         bool Compute(::SMESH_Mesh & aMesh, const TopoDS_Shape & aShape)
67                 throw(SALOME_Exception);
68         StudyContextStruct *GetStudyContext(int studyId);
69
70         static int GetShapeDim(const TopoDS_Shape & aShape);
71         SMESH_Algo *GetAlgo(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape);
72         SMESH_Mesh *Import(int studyId, const char * fileName, const char * fileType);
73  
74         // inherited methods from SALOMEDS::Driver
75
76         void Save(int studyId, const char *aUrlOfFile);
77         void Load(int studyId, const char *aUrlOfFile);
78         void Close(int studyId);
79         const char *ComponentDataType();
80
81         const char *IORToLocalPersistentID(const char *IORString, bool & IsAFile);
82         const char *LocalPersistentIDToIOR(const char *aLocalPersistentID);
83
84         SMESH_HypothesisFactory _hypothesisFactory;
85
86           map < int, SMESH_Algo * >_mapAlgo;
87           map < int, SMESH_1D_Algo * >_map1D_Algo;
88           map < int, SMESH_2D_Algo * >_map2D_Algo;
89           map < int, SMESH_3D_Algo * >_map3D_Algo;
90
91   private:
92         int _localId;                           // unique Id of created objects, within SMESH_Gen entity
93           map < int, StudyContextStruct * >_mapStudyContext;
94           map < int, SMESH_Hypothesis * >_mapHypothesis;
95 };
96
97 #endif