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