Salome HOME
Integration of PAL/SALOME V2.1.0c from OCC
[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_Group)
35 #include CORBA_SERVER_HEADER(SMESH_Hypothesis)
36 #include CORBA_CLIENT_HEADER(GEOM_Gen)
37 #include CORBA_CLIENT_HEADER(MED)
38
39 #include "SMESH_Hypothesis.hxx"
40 #include "SMESH_Mesh.hxx"
41 #include "SMESH_subMesh_i.hxx"
42 #include "SMESH_subMesh.hxx"
43
44 #include "SALOME_GenericObj_i.hh"
45
46 class SMESH_Gen_i;
47 class SMESH_Group_i;
48
49 #include <map>
50
51 class SMESH_Mesh_i:
52   public virtual POA_SMESH::SMESH_Mesh,
53   public virtual SALOME::GenericObj_i
54 {
55   SMESH_Mesh_i();
56   SMESH_Mesh_i(const SMESH_Mesh_i&);
57 public:
58   SMESH_Mesh_i( PortableServer::POA_ptr thePOA,
59                 SMESH_Gen_i*            myGen_i,
60                 CORBA::Long             studyId );
61
62   virtual ~SMESH_Mesh_i();
63
64   // --- CORBA
65   void SetShape( GEOM::GEOM_Object_ptr theShapeObject )
66     throw (SALOME::SALOME_Exception);
67
68   SMESH::Hypothesis_Status AddHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
69                                          SMESH::SMESH_Hypothesis_ptr anHyp)
70     throw (SALOME::SALOME_Exception);
71
72   SMESH::Hypothesis_Status RemoveHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
73                                             SMESH::SMESH_Hypothesis_ptr anHyp)
74     throw (SALOME::SALOME_Exception);
75
76   SMESH::ListOfHypothesis* GetHypothesisList(GEOM::GEOM_Object_ptr aSubShapeObject)
77     throw (SALOME::SALOME_Exception);
78
79   SMESH::SMESH_subMesh_ptr GetSubMesh(GEOM::GEOM_Object_ptr aSubShapeObject, const char* theName)
80     throw (SALOME::SALOME_Exception);
81
82   void RemoveSubMesh( SMESH::SMESH_subMesh_ptr theSubMesh )
83     throw (SALOME::SALOME_Exception);
84
85   SMESH::SMESH_Group_ptr CreateGroup( SMESH::ElementType theElemType, const char* theName )
86     throw (SALOME::SALOME_Exception);
87   
88   SMESH::SMESH_Group_ptr CreateGroupFromGEOM( SMESH::ElementType theElemType,  const char* theName,                     
89                                               GEOM::GEOM_Object_ptr theGEOMGroup )
90     throw (SALOME::SALOME_Exception); 
91
92   void RemoveGroup( SMESH::SMESH_Group_ptr theGroup )
93     throw (SALOME::SALOME_Exception);
94   
95   void RemoveGroupWithContents( SMESH::SMESH_Group_ptr theGroup )
96     throw (SALOME::SALOME_Exception);
97   
98   SMESH::SMESH_Group_ptr UnionGroups( SMESH::SMESH_Group_ptr theGroup1, 
99                                       SMESH::SMESH_Group_ptr theGroup2, 
100                                       const char* theName )
101     throw (SALOME::SALOME_Exception);
102   
103   SMESH::SMESH_Group_ptr IntersectGroups( SMESH::SMESH_Group_ptr theGroup1, 
104                                           SMESH::SMESH_Group_ptr theGroup2, 
105                                           const char* theName )
106     throw (SALOME::SALOME_Exception);
107   
108   SMESH::SMESH_Group_ptr CutGroups( SMESH::SMESH_Group_ptr theGroup1, 
109                                     SMESH::SMESH_Group_ptr theGroup2, 
110                                     const char* theName )
111     throw (SALOME::SALOME_Exception);
112
113 //    SMESH::string_array* GetLog(CORBA::Boolean clearAfterGet)
114 //      throw (SALOME::SALOME_Exception);
115
116   SMESH::log_array* GetLog(CORBA::Boolean clearAfterGet)
117     throw (SALOME::SALOME_Exception);
118
119   SMESH::SMESH_MeshEditor_ptr GetMeshEditor();
120
121   void ClearLog()
122     throw (SALOME::SALOME_Exception);
123
124   CORBA::Long GetId()
125     throw (SALOME::SALOME_Exception);
126
127   CORBA::Long GetStudyId()
128     throw (SALOME::SALOME_Exception);
129
130   // --- C++ interface
131
132   void SetImpl(::SMESH_Mesh* impl);
133   ::SMESH_Mesh& GetImpl();         // :: force no namespace here
134
135   SMESH_Gen_i* GetGen() { return _gen_i; }
136   
137   int ImportUNVFile( const char* theFileName )
138     throw (SALOME::SALOME_Exception);
139
140   int ImportSTLFile( const char* theFileName )
141     throw (SALOME::SALOME_Exception);
142
143   /*!
144    * consult DriverMED_R_SMESHDS_Mesh::ReadStatus for returned value
145    */
146   SMESH::DriverMED_ReadStatus ImportMEDFile( const char* theFileName, const char* theMeshName )
147     throw (SALOME::SALOME_Exception);
148
149   void ExportMED( const char* file, CORBA::Boolean auto_groups )
150     throw (SALOME::SALOME_Exception);
151   void ExportDAT( const char* file )
152     throw (SALOME::SALOME_Exception);
153   void ExportUNV( const char* file )
154     throw (SALOME::SALOME_Exception);
155   void ExportSTL( const char* file, const bool isascii )
156     throw (SALOME::SALOME_Exception);
157
158   SALOME_MED::MESH_ptr GetMEDMesh()
159     throw (SALOME::SALOME_Exception);
160   
161   CORBA::Long NbNodes()
162     throw (SALOME::SALOME_Exception);
163   
164   CORBA::Long NbEdges()
165     throw (SALOME::SALOME_Exception);
166   
167   CORBA::Long NbFaces()
168     throw (SALOME::SALOME_Exception);
169
170   CORBA::Long NbTriangles()
171     throw (SALOME::SALOME_Exception);
172
173   CORBA::Long NbQuadrangles()
174     throw (SALOME::SALOME_Exception);
175   
176   CORBA::Long NbVolumes()
177     throw (SALOME::SALOME_Exception);
178
179   CORBA::Long NbTetras()
180     throw (SALOME::SALOME_Exception);
181
182   CORBA::Long NbHexas()
183     throw (SALOME::SALOME_Exception);
184   
185   CORBA::Long NbPyramids()
186     throw (SALOME::SALOME_Exception);
187   
188   CORBA::Long NbPrisms()
189     throw (SALOME::SALOME_Exception);
190   
191   CORBA::Long NbSubMesh()
192     throw (SALOME::SALOME_Exception);
193
194   char* Dump();
195   
196   // Internal methods not available through CORBA
197   // They are called by corresponding interface methods
198   SMESH_Hypothesis::Hypothesis_Status addHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
199                                                     SMESH::SMESH_Hypothesis_ptr anHyp);
200
201   SMESH_Hypothesis::Hypothesis_Status removeHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
202                                                        SMESH::SMESH_Hypothesis_ptr anHyp);
203   
204   bool setShape( GEOM::GEOM_Object_ptr theShapeObject );
205
206   int importMEDFile( const char* theFileName, const char* theMeshName );
207
208   SMESH::SMESH_subMesh_ptr createSubMesh( GEOM::GEOM_Object_ptr theSubShapeObject );
209
210   void removeSubMesh( SMESH::SMESH_subMesh_ptr theSubMesh, GEOM::GEOM_Object_ptr theSubShapeObject );
211
212   SMESH::SMESH_Group_ptr createGroup( SMESH::ElementType theElemType, const char* theName );
213
214   void removeGroup( const int theId );
215
216   map<int, SMESH_subMesh_i*> _mapSubMesh_i; //NRI
217   map<int, ::SMESH_subMesh*> _mapSubMesh;   //NRI
218
219 private:
220   static int myIdGenerator;
221   ::SMESH_Mesh* _impl;  // :: force no namespace here
222   SMESH_Gen_i* _gen_i;
223   int _id;          // id given by creator (unique within the creator instance)
224   int _studyId;
225   map<int, SMESH::SMESH_subMesh_ptr>    _mapSubMeshIor;
226   map<int, SMESH::SMESH_Group_ptr>      _mapGroups;
227   map<int, SMESH::SMESH_Hypothesis_ptr> _mapHypo;
228 };
229
230 #endif
231