Salome HOME
sources v1.2
[modules/smesh.git] / src / SMESH_I / SMESH_MEDMesh_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_MEDMesh_i.hxx
25 //  Module : SMESH
26
27 #ifndef _MED_SMESH_MESH_I_HXX_
28 #define _MED_SMESH_MESH_I_HXX_
29
30 #include <SALOMEconfig.h>
31 #include CORBA_SERVER_HEADER(MED)
32 #include <string>
33 #include <vector>
34 #include <map>
35
36 #include "SMESHDS_Mesh.hxx"
37
38 #include "SMDS_MeshElement.hxx"
39 #include "SMDS_MeshNode.hxx"
40 #include "SMDS_MeshFacesIterator.hxx"
41 #include "SMDS_MeshEdgesIterator.hxx"
42 #include "SMDS_MeshNodesIterator.hxx"
43 #include "SMDS_MeshVolumesIterator.hxx"
44
45 #define MED_NBR_GEOMETRIE_MAILLE 15
46 #define MED_NBR_TYPE 5
47
48
49 class SMESH_Mesh_i;
50
51 class SMESH_MEDMesh_i:
52   public POA_SALOME_MED::MESH,
53   public PortableServer::RefCountServantBase
54 {
55 public :
56
57 private :
58
59 protected:
60   // C++ object containing values
61   ::SMESH_Mesh_i*       _mesh_i;
62   Handle (SMESHDS_Mesh) _meshDS;
63   
64   string                _meshId;
65   bool                  _compte;
66   bool                  _creeFamily;
67   int                   _indexElts; 
68   int                   _indexEnts; 
69   int                   _famIdent;
70
71   map <SALOME_MED::medGeometryElement,int> _mapIndToSeqElts;
72   Engines::long_array_var _seq_elemId[MED_NBR_GEOMETRIE_MAILLE];
73
74   map <SALOME_MED::medEntityMesh,int> _mapNbTypes;
75   map <SALOME_MED::medEntityMesh,int> _mapIndToVectTypes;
76   vector<SALOME_MED::medGeometryElement> _TypesId[MED_NBR_GEOMETRIE_MAILLE];
77
78   vector<SALOME_MED::FAMILY_ptr>   _families;
79 public:
80
81   // Constructors and associated internal methods
82   SMESH_MEDMesh_i();
83   SMESH_MEDMesh_i(SMESH_Mesh_i* m);
84   ~SMESH_MEDMesh_i();
85
86   // IDL Methods 
87   char *        getName()               throw (SALOME::SALOME_Exception);
88   CORBA::Long   getSpaceDimension()     throw (SALOME::SALOME_Exception);
89   CORBA::Long   getMeshDimension()      throw (SALOME::SALOME_Exception);
90
91   char *                  getCoordinateSystem() 
92     throw (SALOME::SALOME_Exception);
93   Engines::double_array* getCoordinates(SALOME_MED::medModeSwitch typeSwitch)
94     throw (SALOME::SALOME_Exception);
95   Engines::string_array* getCoordinatesNames() 
96     throw (SALOME::SALOME_Exception);
97   Engines::string_array* getCoordinatesUnits()
98     throw (SALOME::SALOME_Exception); 
99   CORBA::Long            getNumberOfNodes() 
100     throw (SALOME::SALOME_Exception);
101
102   CORBA::Long            getNumberOfTypes       (SALOME_MED::medEntityMesh entity) 
103     throw   (SALOME::SALOME_Exception);
104   SALOME_MED::medGeometryElement_array* getTypes(SALOME_MED::medEntityMesh entity)
105     throw   (SALOME::SALOME_Exception);
106
107   CORBA::Long      getNumberOfElements (SALOME_MED::medEntityMesh entity,
108                                         SALOME_MED::medGeometryElement geomElement) 
109     throw (SALOME::SALOME_Exception);
110   Engines::long_array*   getConnectivity     (SALOME_MED::medModeSwitch typeSwitch, 
111                                               SALOME_MED::medConnectivity mode, 
112                                               SALOME_MED::medEntityMesh entity, 
113                                               SALOME_MED::medGeometryElement geomElement)
114     throw (SALOME::SALOME_Exception);
115   Engines::long_array*   getConnectivityIndex(SALOME_MED::medConnectivity mode, 
116                                               SALOME_MED::medEntityMesh entity) 
117     throw (SALOME::SALOME_Exception);
118
119   CORBA::Long getElementNumber(SALOME_MED::medConnectivity mode, 
120                                SALOME_MED::medEntityMesh entity, 
121                                SALOME_MED::medGeometryElement type, 
122                                const Engines::long_array & connectivity)
123     throw (SALOME::SALOME_Exception);
124
125   Engines::long_array*   getReverseConnectivity(SALOME_MED::medConnectivity mode)
126
127     throw  (SALOME::SALOME_Exception);
128   Engines::long_array*   getReverseConnectivityIndex(SALOME_MED::medConnectivity mode)
129     throw        (SALOME::SALOME_Exception);
130
131   // Family and Group
132   CORBA::Long        getNumberOfFamilies (SALOME_MED::medEntityMesh entity)
133     throw (SALOME::SALOME_Exception);
134   CORBA::Long        getNumberOfGroups   (SALOME_MED::medEntityMesh entity) 
135     throw (SALOME::SALOME_Exception);
136   SALOME_MED::Family_array* getFamilies  (SALOME_MED::medEntityMesh entity) 
137     throw (SALOME::SALOME_Exception);
138   SALOME_MED::FAMILY_ptr    getFamily    (SALOME_MED::medEntityMesh entity,
139                                           CORBA::Long i) 
140     throw (SALOME::SALOME_Exception);
141   SALOME_MED::Group_array*  getGroups    (SALOME_MED::medEntityMesh entity) 
142     throw (SALOME::SALOME_Exception);
143   SALOME_MED::GROUP_ptr     getGroup     (SALOME_MED::medEntityMesh entity, 
144                                           CORBA::Long i) 
145     throw (SALOME::SALOME_Exception);
146   // 
147   SALOME_MED::FIELD_ptr getVolume        (SALOME_MED::SUPPORT_ptr mySupport)
148     throw (SALOME::SALOME_Exception);
149   SALOME_MED::FIELD_ptr getArea          (SALOME_MED::SUPPORT_ptr mySupport)          
150     throw (SALOME::SALOME_Exception);
151   SALOME_MED::FIELD_ptr getLength        (SALOME_MED::SUPPORT_ptr mySupport)        
152     throw (SALOME::SALOME_Exception);
153   SALOME_MED::FIELD_ptr getNormal        (SALOME_MED::SUPPORT_ptr mySupport)        
154     throw (SALOME::SALOME_Exception);
155   SALOME_MED::FIELD_ptr getBarycenter    (SALOME_MED::SUPPORT_ptr mySupport)    
156     throw (SALOME::SALOME_Exception);
157   SALOME_MED::FIELD_ptr getNeighbourhood (SALOME_MED::SUPPORT_ptr mySupport) 
158     throw (SALOME::SALOME_Exception);
159
160
161   // Others
162   void        addInStudy (SALOMEDS::Study_ptr myStudy, 
163                           SALOME_MED::MESH_ptr myIor) 
164     throw (SALOME::SALOME_Exception);
165   CORBA::Long addDriver  (SALOME_MED::medDriverTypes driverType, 
166                           const char* fileName, const char* meshName)
167     throw (SALOME::SALOME_Exception);
168   void        rmDriver   (CORBA::Long i)        
169     throw (SALOME::SALOME_Exception);
170   void        read       (CORBA::Long i)
171     throw (SALOME::SALOME_Exception);
172   void        write      (CORBA::Long i, const char* driverMeshName)
173     throw (SALOME::SALOME_Exception);
174
175   //                                    Cuisine interne
176   CORBA::Long getCorbaIndex() throw (SALOME::SALOME_Exception);
177
178   //
179   void          calculeNbElts()   throw (SALOME::SALOME_Exception);
180   void          createFamilies()  throw (SALOME::SALOME_Exception);
181 };
182
183 #endif /* _MED_MESH_I_HXX_ */