]> SALOME platform Git repositories - modules/smesh.git/blob - src/SMESH_I/SMESH_Mesh_i.hxx
Salome HOME
Improve crossplatform library name of plugin
[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 "SMESH.hxx"
33
34 #include <SALOMEconfig.h>
35 #include CORBA_SERVER_HEADER(SMESH_Mesh)
36 #include CORBA_SERVER_HEADER(SMESH_Group)
37 #include CORBA_SERVER_HEADER(SMESH_Hypothesis)
38 #include CORBA_CLIENT_HEADER(GEOM_Gen)
39 #include CORBA_CLIENT_HEADER(MED)
40
41 #include "SMESH_Hypothesis.hxx"
42 #include "SMESH_Mesh.hxx"
43 #include "SMESH_subMesh_i.hxx"
44 #include "SMESH_subMesh.hxx"
45
46 #include "SALOME_GenericObj_i.hh"
47
48 class SMESH_Gen_i;
49 class SMESH_GroupBase_i;
50
51 #include <map>
52
53 class SMESH_I_EXPORT SMESH_Mesh_i:
54   public virtual POA_SMESH::SMESH_Mesh,
55   public virtual SALOME::GenericObj_i
56 {
57   SMESH_Mesh_i();
58   SMESH_Mesh_i(const SMESH_Mesh_i&);
59 public:
60   SMESH_Mesh_i( PortableServer::POA_ptr thePOA,
61                 SMESH_Gen_i*            myGen_i,
62                 CORBA::Long             studyId );
63
64   virtual ~SMESH_Mesh_i();
65
66   // --- CORBA
67   void SetShape( GEOM::GEOM_Object_ptr theShapeObject )
68     throw (SALOME::SALOME_Exception);
69
70   GEOM::GEOM_Object_ptr GetShapeToMesh()
71     throw (SALOME::SALOME_Exception);
72
73   SMESH::Hypothesis_Status AddHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
74                                          SMESH::SMESH_Hypothesis_ptr anHyp)
75     throw (SALOME::SALOME_Exception);
76
77   SMESH::Hypothesis_Status RemoveHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
78                                             SMESH::SMESH_Hypothesis_ptr anHyp)
79     throw (SALOME::SALOME_Exception);
80
81   SMESH::ListOfHypothesis* GetHypothesisList(GEOM::GEOM_Object_ptr aSubShapeObject)
82     throw (SALOME::SALOME_Exception);
83
84   SMESH::SMESH_subMesh_ptr GetSubMesh(GEOM::GEOM_Object_ptr aSubShapeObject, const char* theName)
85     throw (SALOME::SALOME_Exception);
86
87   void RemoveSubMesh( SMESH::SMESH_subMesh_ptr theSubMesh )
88     throw (SALOME::SALOME_Exception);
89
90   SMESH::SMESH_Group_ptr CreateGroup( SMESH::ElementType theElemType, const char* theName )
91     throw (SALOME::SALOME_Exception);
92   
93   SMESH::SMESH_GroupOnGeom_ptr CreateGroupFromGEOM(SMESH::ElementType    theElemType,
94                                                    const char*           theName,
95                                                    GEOM::GEOM_Object_ptr theGeomObj )
96     throw (SALOME::SALOME_Exception);
97
98   void RemoveGroup( SMESH::SMESH_GroupBase_ptr theGroup )
99     throw (SALOME::SALOME_Exception);
100   
101   void RemoveGroupWithContents( SMESH::SMESH_GroupBase_ptr theGroup )
102     throw (SALOME::SALOME_Exception);
103   
104   SMESH::SMESH_Group_ptr UnionGroups( SMESH::SMESH_GroupBase_ptr theGroup1, 
105                                       SMESH::SMESH_GroupBase_ptr theGroup2, 
106                                       const char* theName )
107     throw (SALOME::SALOME_Exception);
108   
109   SMESH::SMESH_Group_ptr IntersectGroups( SMESH::SMESH_GroupBase_ptr theGroup1, 
110                                           SMESH::SMESH_GroupBase_ptr theGroup2, 
111                                           const char* theName )
112     throw (SALOME::SALOME_Exception);
113   
114   SMESH::SMESH_Group_ptr CutGroups( SMESH::SMESH_GroupBase_ptr theGroup1, 
115                                     SMESH::SMESH_GroupBase_ptr theGroup2, 
116                                    const char* theName )
117     throw (SALOME::SALOME_Exception);
118
119 //    SMESH::string_array* GetLog(CORBA::Boolean clearAfterGet)
120 //      throw (SALOME::SALOME_Exception);
121
122   SMESH::log_array* GetLog(CORBA::Boolean clearAfterGet)
123     throw (SALOME::SALOME_Exception);
124
125   SMESH::SMESH_MeshEditor_ptr GetMeshEditor();
126
127   void ClearLog()
128     throw (SALOME::SALOME_Exception);
129
130   CORBA::Long GetId()
131     throw (SALOME::SALOME_Exception);
132
133   CORBA::Long GetStudyId()
134     throw (SALOME::SALOME_Exception);
135
136   // --- C++ interface
137
138   void SetImpl(::SMESH_Mesh* impl);
139   ::SMESH_Mesh& GetImpl();         // :: force no namespace here
140
141   SMESH_Gen_i* GetGen() { return _gen_i; }
142   
143   int ImportUNVFile( const char* theFileName )
144     throw (SALOME::SALOME_Exception);
145
146   int ImportSTLFile( const char* theFileName )
147     throw (SALOME::SALOME_Exception);
148
149   /*!
150    * consult DriverMED_R_SMESHDS_Mesh::ReadStatus for returned value
151    */
152   SMESH::DriverMED_ReadStatus ImportMEDFile( const char* theFileName, const char* theMeshName )
153     throw (SALOME::SALOME_Exception);
154
155   void ExportToMED( const char* file, CORBA::Boolean auto_groups, SMESH::MED_VERSION theVersion )
156     throw (SALOME::SALOME_Exception);
157   void ExportMED( const char* file, CORBA::Boolean auto_groups )
158     throw (SALOME::SALOME_Exception);
159
160   void ExportDAT( const char* file )
161     throw (SALOME::SALOME_Exception);
162   void ExportUNV( const char* file )
163     throw (SALOME::SALOME_Exception);
164   void ExportSTL( const char* file, bool isascii )
165     throw (SALOME::SALOME_Exception);
166
167   SALOME_MED::MESH_ptr GetMEDMesh()
168     throw (SALOME::SALOME_Exception);
169
170   CORBA::Long NbNodes()
171     throw (SALOME::SALOME_Exception);
172
173   CORBA::Long NbElements()
174     throw (SALOME::SALOME_Exception);
175
176   CORBA::Long NbEdges()
177     throw (SALOME::SALOME_Exception);
178
179   CORBA::Long NbFaces()
180     throw (SALOME::SALOME_Exception);
181
182   CORBA::Long NbTriangles()
183     throw (SALOME::SALOME_Exception);
184
185   CORBA::Long NbQuadrangles()
186     throw (SALOME::SALOME_Exception);
187
188   CORBA::Long NbPolygons()
189     throw (SALOME::SALOME_Exception);
190
191   CORBA::Long NbVolumes()
192     throw (SALOME::SALOME_Exception);
193
194   CORBA::Long NbTetras()
195     throw (SALOME::SALOME_Exception);
196
197   CORBA::Long NbHexas()
198     throw (SALOME::SALOME_Exception);
199
200   CORBA::Long NbPyramids()
201     throw (SALOME::SALOME_Exception);
202
203   CORBA::Long NbPrisms()
204     throw (SALOME::SALOME_Exception);
205
206   CORBA::Long NbPolyhedrons()
207     throw (SALOME::SALOME_Exception);
208
209   CORBA::Long NbSubMesh()
210     throw (SALOME::SALOME_Exception);
211
212   SMESH::long_array* GetElementsId()
213     throw (SALOME::SALOME_Exception);
214
215   SMESH::long_array* GetElementsByType( SMESH::ElementType theElemType )
216     throw (SALOME::SALOME_Exception);
217   
218   SMESH::long_array* GetNodesId()
219     throw (SALOME::SALOME_Exception);
220   
221   SMESH::ElementType GetElementType( CORBA::Long id, bool iselem )
222     throw (SALOME::SALOME_Exception);
223   
224   char* Dump();
225   
226   // Internal methods not available through CORBA
227   // They are called by corresponding interface methods
228   SMESH_Hypothesis::Hypothesis_Status addHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
229                                                     SMESH::SMESH_Hypothesis_ptr anHyp);
230
231   SMESH_Hypothesis::Hypothesis_Status removeHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
232                                                        SMESH::SMESH_Hypothesis_ptr anHyp);
233   
234   int importMEDFile( const char* theFileName, const char* theMeshName );
235
236   SMESH::SMESH_subMesh_ptr createSubMesh( GEOM::GEOM_Object_ptr theSubShapeObject );
237
238   void removeSubMesh(SMESH::SMESH_subMesh_ptr theSubMesh,
239                      GEOM::GEOM_Object_ptr theSubShapeObject );
240
241   SMESH::SMESH_GroupBase_ptr createGroup(SMESH::ElementType  theElemType,
242                                          const char*         theName,
243                                          const TopoDS_Shape& theShape = TopoDS_Shape());
244
245   void removeGroup( const int theId );
246
247   SMESH::SMESH_subMesh_ptr getSubMesh(int shapeID);
248   // return an existing subMesh object for the shapeID. shapeID == submeshID.
249
250   const map<int, SMESH::SMESH_GroupBase_ptr>& getGroups() { return _mapGroups; }
251   // return an existing group object.
252
253   virtual SMESH::long_array* GetIDs();
254
255   map<int, SMESH_subMesh_i*> _mapSubMesh_i; //NRI
256   map<int, ::SMESH_subMesh*> _mapSubMesh;   //NRI
257
258 private:
259   static int myIdGenerator;
260   ::SMESH_Mesh* _impl;  // :: force no namespace here
261   SMESH_Gen_i* _gen_i;
262   int _id;          // id given by creator (unique within the creator instance)
263   int _studyId;
264   map<int, SMESH::SMESH_subMesh_ptr>    _mapSubMeshIor;
265   map<int, SMESH::SMESH_GroupBase_ptr>  _mapGroups;
266   map<int, SMESH::SMESH_Hypothesis_ptr> _mapHypo;
267 };
268
269 #endif
270