Salome HOME
Merge br_enable_import_mesh. Enable import mesh and save/load SMESH study.
[modules/smesh.git] / src / SMESH_I / SMESH_Mesh_i.hxx
1 //  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
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_Mesh_i.hxx
25 //  Author : Paul RASCLE, EDF
26 //  Module : SMESH
27 //  $Header$
28
29 #ifndef _SMESH_MESH_I_HXX_
30 #define _SMESH_MESH_I_HXX_
31
32 #include <SALOMEconfig.h>
33 #include CORBA_SERVER_HEADER(SMESH_Mesh)
34 #include CORBA_SERVER_HEADER(SMESH_Hypothesis)
35 #include CORBA_CLIENT_HEADER(GEOM_Gen)
36 #include CORBA_CLIENT_HEADER(GEOM_Shape)
37 #include CORBA_CLIENT_HEADER(MED)
38
39 class SMESH_Gen_i;
40
41 #include "SMESH_Mesh.hxx"
42 #include "SMESH_Gen_i.hxx"
43 #include "SMESH_subMesh_i.hxx"
44 #include "SMESH_subMesh.hxx"
45 #include "SMESH_topo.hxx"
46
47 #include <map>
48
49 class SMESH_Mesh_i:
50   public POA_SMESH::SMESH_Mesh
51 {
52 public:
53   SMESH_Mesh_i();
54   SMESH_Mesh_i(SMESH_Gen_i* myGen_i,
55                GEOM::GEOM_Gen_ptr geomEngine,
56                CORBA::Long studyId,
57                int localId);
58
59   virtual ~SMESH_Mesh_i();
60
61   // --- CORBA
62
63   CORBA::Boolean AddHypothesis(GEOM::GEOM_Shape_ptr aSubShape,
64                                SMESH::SMESH_Hypothesis_ptr anHyp)
65     throw (SALOME::SALOME_Exception);
66
67   CORBA::Boolean  RemoveHypothesis(GEOM::GEOM_Shape_ptr aSubShape,
68                                    SMESH::SMESH_Hypothesis_ptr anHyp)
69     throw (SALOME::SALOME_Exception);
70
71   SMESH::ListOfHypothesis* GetHypothesisList(GEOM::GEOM_Shape_ptr aSubShape)
72     throw (SALOME::SALOME_Exception);
73
74   SMESH::SMESH_subMesh_ptr GetElementsOnShape(GEOM::GEOM_Shape_ptr aSubShape)
75     throw (SALOME::SALOME_Exception);
76
77 //    SMESH::string_array* GetLog(CORBA::Boolean clearAfterGet)
78 //      throw (SALOME::SALOME_Exception);
79
80   SMESH::log_array* GetLog(CORBA::Boolean clearAfterGet)
81     throw (SALOME::SALOME_Exception);
82
83   SMESH::SMESH_MeshEditor_ptr GetMeshEditor();
84
85   void ClearLog()
86     throw (SALOME::SALOME_Exception);
87
88   CORBA::Long GetId()
89     throw (SALOME::SALOME_Exception);
90
91   CORBA::Long GetStudyId()
92     throw (SALOME::SALOME_Exception);
93
94   void Export(const char* fileName, const char* fileType)
95         throw (SALOME::SALOME_Exception);
96
97   // --- C++ interface
98
99   void SetImpl(::SMESH_Mesh* impl);
100
101   ::SMESH_Mesh& GetImpl();         // :: force no namespace here
102   GEOM::GEOM_Gen_ptr GetGeomEngine();
103   void SetIor(SMESH::SMESH_Mesh_ptr myIor);
104   SMESH::SMESH_Mesh_ptr GetIor();
105
106   SALOME_MED::MESH_ptr GetMEDMesh()
107     throw (SALOME::SALOME_Exception);
108   
109   CORBA::Long NbNodes()
110     throw (SALOME::SALOME_Exception);
111   
112   CORBA::Long NbEdges()
113     throw (SALOME::SALOME_Exception);
114   
115   CORBA::Long NbFaces()
116     throw (SALOME::SALOME_Exception);
117
118   CORBA::Long NbTriangles()
119     throw (SALOME::SALOME_Exception);
120
121   CORBA::Long NbQuadrangles()
122     throw (SALOME::SALOME_Exception);
123   
124   CORBA::Long NbVolumes()
125     throw (SALOME::SALOME_Exception);
126
127   CORBA::Long NbTetras()
128     throw (SALOME::SALOME_Exception);
129
130   CORBA::Long NbHexas()
131     throw (SALOME::SALOME_Exception);
132   
133   CORBA::Long NbSubMesh()
134     throw (SALOME::SALOME_Exception);
135   
136
137   map<int, SMESH_subMesh_i*> _mapSubMesh_i; //NRI
138   map<int, ::SMESH_subMesh*> _mapSubMesh;   //NRI
139
140 private:
141   SMESH::log_array_var createUpdateAllCommand(SMESH::log_array_var log, int * index);
142   ::SMESH_Mesh* _impl;  // :: force no namespace here
143   SMESH_Gen_i* _gen_i;
144   //   CORBA::ORB_ptr _orb;
145 //   SMESH_topo* _topo;   // all local TopoDS_Shape of subShapes
146   int _id;          // id given by creator (unique within the creator instance)
147   GEOM::GEOM_Gen_var _geom;
148   int _studyId;
149   //  int _localId; // id attributed to all objects created by Mesh_i
150   map<int, SMESH::SMESH_subMesh_ptr> _mapSubMeshIor;
151   SMESH::SMESH_Mesh_var _myIor;
152 };
153
154 #endif
155