Salome HOME
Merge from V6_main_20120808 08Aug12
[modules/smesh.git] / src / SMESH_I / SMESH_MEDMesh_i.hxx
1 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 //  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
24 //  File   : SMESH_MEDMesh_i.hxx
25 //  Module : SMESH
26 //
27 #ifndef _MED_SMESH_MESH_I_HXX_
28 #define _MED_SMESH_MESH_I_HXX_
29
30 #include "SMESH.hxx"
31
32 #include <SALOMEconfig.h>
33 #include CORBA_SERVER_HEADER(MED)
34 #include <string>
35 #include <vector>
36 #include <map>
37
38 #include "SMESHDS_Mesh.hxx"
39
40 #include "SMDS_MeshElement.hxx"
41 #include "SMDS_MeshNode.hxx"
42 #include "SALOME_GenericObj_i.hh"
43
44 #define MED_NBR_GEOMETRIE_MAILLE 15
45 #define MED_NBR_TYPE 5
46
47 class SMESH_Mesh_i;
48
49 class SMESH_I_EXPORT SMESH_MEDMesh_i:
50   public virtual POA_SALOME_MED::MESH, 
51   public virtual SALOME::GenericObj_i
52 {
53 protected:
54   // C++ object containing values
55   ::SMESH_Mesh_i * _mesh_i;
56   SMESHDS_Mesh *_meshDS;
57   
58   std::string _meshId;
59   bool _compte;
60   bool _creeFamily;
61   int _indexElts;
62   int _indexEnts;
63   int _famIdent;
64   
65   std::map < SALOME_MED::medGeometryElement, int >_mapIndToSeqElts;
66   SALOME_TYPES::ListOfLong_var _seq_elemId[MED_NBR_GEOMETRIE_MAILLE];
67   
68   std::map < SALOME_MED::medEntityMesh, int >_mapNbTypes;
69   std::map < SALOME_MED::medEntityMesh, int >_mapIndToVectTypes;
70   std::vector < SALOME_MED::medGeometryElement >
71   _TypesId[MED_NBR_GEOMETRIE_MAILLE];
72   
73   std::vector < SALOME_MED::FAMILY_ptr > _families;
74 public:
75   
76   // Constructors and associated internal methods
77   SMESH_MEDMesh_i();
78   SMESH_MEDMesh_i(SMESH_Mesh_i * m);
79   ~SMESH_MEDMesh_i();
80   
81   // IDL Methods
82   void setProtocol(SALOME::TypeOfCommunication typ) {}
83   void release() {}
84   SALOME::SenderDouble_ptr getSenderForCoordinates(SALOME_MED::medModeSwitch) {return SALOME::SenderDouble::_nil();}
85   SALOME::SenderInt_ptr getSenderForConnectivity(SALOME_MED::medConnectivity, 
86                                                  SALOME_MED::medEntityMesh, 
87                                                  SALOME_MED::medGeometryElement) 
88   {
89     return SALOME::SenderInt::_nil();
90   }  
91   SALOME::SenderInt_ptr getSenderForConnectivityIndex(SALOME_MED::medConnectivity,
92                                                       SALOME_MED::medEntityMesh,
93                                                       SALOME_MED::medGeometryElement)
94   {
95     return SALOME::SenderInt::_nil();
96   }  
97   SALOME::SenderInt_ptr getSenderForPolygonsConnectivity(SALOME_MED::medConnectivity, SALOME_MED::medEntityMesh) {return SALOME::SenderInt::_nil();}
98   SALOME::SenderInt_ptr getSenderForPolygonsConnectivityIndex(SALOME_MED::medConnectivity, SALOME_MED::medEntityMesh) {return SALOME::SenderInt::_nil();}
99   SALOME::SenderInt_ptr getSenderForPolyhedronConnectivity(SALOME_MED::medConnectivity) {return SALOME::SenderInt::_nil();}
100   SALOME::SenderInt_ptr getSenderForPolyhedronIndex(SALOME_MED::medConnectivity) {return SALOME::SenderInt::_nil();}
101   SALOME::SenderInt_ptr getSenderForPolyhedronFacesIndex() {return SALOME::SenderInt::_nil();}
102   
103   char *getName() throw(SALOME::SALOME_Exception);
104   CORBA::Long getSpaceDimension() throw(SALOME::SALOME_Exception);
105   
106   CORBA::Long getMeshDimension() throw(SALOME::SALOME_Exception);
107   
108   CORBA::Boolean  getIsAGrid() throw (SALOME::SALOME_Exception);
109   
110   CORBA::Boolean
111   existConnectivity(SALOME_MED::medConnectivity connectivityType,
112                     SALOME_MED::medEntityMesh entity)
113     throw (SALOME::SALOME_Exception);
114   
115   char *getCoordinatesSystem() throw(SALOME::SALOME_Exception);
116   
117   CORBA::Double getCoordinate(CORBA::Long Number, CORBA::Long Axis)
118     throw (SALOME::SALOME_Exception);
119   
120   SALOME_TYPES::ListOfDouble * getCoordinates(SALOME_MED::medModeSwitch typeSwitch)
121     throw(SALOME::SALOME_Exception);
122
123   SALOME_TYPES::ListOfString * getCoordinatesNames()
124     throw(SALOME::SALOME_Exception);
125   
126   SALOME_TYPES::ListOfString * getCoordinatesUnits()
127     throw(SALOME::SALOME_Exception);
128   
129   CORBA::Long getNumberOfNodes() throw(SALOME::SALOME_Exception);
130   
131   CORBA::Long getNumberOfTypes(SALOME_MED::medEntityMesh entity)
132     throw(SALOME::SALOME_Exception);
133   
134   SALOME_MED::medGeometryElement_array *
135   getTypes(SALOME_MED::medEntityMesh entity) throw(SALOME::
136                                                    SALOME_Exception);
137   
138   SALOME_MED::medGeometryElement
139   getElementType(SALOME_MED::medEntityMesh entity,
140                  CORBA::Long number)
141     throw   (SALOME::SALOME_Exception);
142   
143   CORBA::Long getNumberOfElements(SALOME_MED::medEntityMesh entity,
144                                   SALOME_MED::medGeometryElement geomElement)
145     throw(SALOME::SALOME_Exception);
146   
147   SALOME_TYPES::ListOfLong *
148   getConnectivity(SALOME_MED::medConnectivity mode,
149                   SALOME_MED::medEntityMesh entity,
150                   SALOME_MED::medGeometryElement geomElement)
151     throw(SALOME::SALOME_Exception);
152   
153   SALOME_TYPES::ListOfLong *
154   getConnectivityIndex(SALOME_MED::medConnectivity mode,
155                        SALOME_MED::medEntityMesh entity)
156     throw(SALOME::SALOME_Exception);
157   
158   SALOME_TYPES::ListOfLong*
159   getGlobalNumberingIndex(SALOME_MED::medEntityMesh entity)
160     throw (SALOME::SALOME_Exception);
161   
162   CORBA::Long getElementNumber(SALOME_MED::medConnectivity mode,
163                                SALOME_MED::medEntityMesh entity,
164                                SALOME_MED::medGeometryElement type,
165                                const SALOME_TYPES::ListOfLong & connectivity)
166     throw(SALOME::SALOME_Exception);
167   
168   SALOME_TYPES::ListOfLong *
169   getReverseConnectivity(SALOME_MED::medConnectivity mode)
170     throw(SALOME::SALOME_Exception);
171   
172   SALOME_TYPES::ListOfLong *
173   getReverseConnectivityIndex(SALOME_MED::medConnectivity mode) 
174     throw(SALOME::SALOME_Exception);
175   
176   // Family and Group
177   CORBA::Long getNumberOfFamilies(SALOME_MED::medEntityMesh entity)
178     throw(SALOME::SALOME_Exception);
179   
180   CORBA::Long getNumberOfGroups(SALOME_MED::medEntityMesh entity)
181     throw(SALOME::SALOME_Exception);
182   
183   SALOME_MED::Family_array *
184   getFamilies(SALOME_MED::medEntityMesh entity)
185     throw(SALOME::SALOME_Exception);
186   
187   SALOME_MED::FAMILY_ptr getFamily(SALOME_MED::medEntityMesh entity,
188                                    CORBA::Long i) 
189     throw(SALOME::SALOME_Exception);
190   
191   SALOME_MED::Group_array * getGroups(SALOME_MED::medEntityMesh entity)
192     throw(SALOME::SALOME_Exception);
193   
194   SALOME_MED::GROUP_ptr getGroup(SALOME_MED::medEntityMesh entity,
195                                  CORBA::Long i) 
196     throw(SALOME::SALOME_Exception);
197   
198   SALOME_MED::SUPPORT_ptr
199   getBoundaryElements(SALOME_MED::medEntityMesh entity)
200     throw (SALOME::SALOME_Exception);
201   
202   SALOME_MED::SUPPORT_ptr
203   getSupportOnAll(SALOME_MED::medEntityMesh entity)
204     throw (SALOME::SALOME_Exception);
205   
206   SALOME_MED::SUPPORT_ptr getSkin(SALOME_MED::SUPPORT_ptr mySupport3D)
207     throw (SALOME::SALOME_Exception);
208   
209   SALOME_MED::FIELD_ptr getVolume(SALOME_MED::SUPPORT_ptr mySupport)
210     throw(SALOME::SALOME_Exception);
211   
212   SALOME_MED::FIELD_ptr getArea(SALOME_MED::SUPPORT_ptr mySupport)
213     throw(SALOME::SALOME_Exception);
214   
215   SALOME_MED::FIELD_ptr getLength(SALOME_MED::SUPPORT_ptr mySupport)
216     throw(SALOME::SALOME_Exception);
217   
218   SALOME_MED::FIELD_ptr getNormal(SALOME_MED::SUPPORT_ptr mySupport)
219     throw(SALOME::SALOME_Exception);
220   
221   SALOME_MED::FIELD_ptr getBarycenter(SALOME_MED::SUPPORT_ptr mySupport)
222     throw(SALOME::SALOME_Exception);
223   
224   SALOME_MED::FIELD_ptr getNeighbourhood(SALOME_MED::SUPPORT_ptr mySupport)
225     throw(SALOME::SALOME_Exception);
226   
227   // Others
228   void addInStudy(SALOMEDS::Study_ptr myStudy,
229                   SALOME_MED::GMESH_ptr myIor) 
230     throw(SALOME::SALOME_Exception);
231   CORBA::Long addDriver(SALOME_MED::medDriverTypes driverType,
232                         const char *fileName, const char *meshName)
233     throw(SALOME::SALOME_Exception);
234   void rmDriver(CORBA::Long i) throw(SALOME::SALOME_Exception);
235   void read(CORBA::Long i) throw(SALOME::SALOME_Exception);
236   void write(CORBA::Long i, const char *driverMeshName)
237     throw(SALOME::SALOME_Exception);
238   
239   //                    Cuisine interne
240   CORBA::Long getCorbaIndex() 
241     throw(SALOME::SALOME_Exception);
242   
243   SALOME_MED::GMESH::meshInfos * getMeshGlobal()
244     throw (SALOME::SALOME_Exception);
245   
246   bool areEquals(SALOME_MED::GMESH_ptr other) { return false;};
247   
248   SALOME_MED::MESH_ptr convertInMESH() throw (SALOME::SALOME_Exception);
249   
250   SALOME_MED::GMESH::coordinateInfos * getCoordGlobal()
251     throw (SALOME::SALOME_Exception);
252   
253   SALOME_MED::MESH::connectivityInfos *
254   getConnectGlobal(SALOME_MED::medEntityMesh entity)
255     throw (SALOME::SALOME_Exception);
256   
257   //
258   void calculeNbElts() throw(SALOME::SALOME_Exception);
259   void createFamilies() throw(SALOME::SALOME_Exception);
260 };
261
262 #endif /* _MED_MESH_I_HXX_ */