1 //=============================================================================
2 // File : MEDMEM_convert.cxx
3 // Created : mer fév 20 15:47:57 CET 2002
6 // Copyright : EDF 2002
7 // $Header: /export/home/PAL/MED_SRC/src/MEDMEM_I/MEDMEM_convert.cxx
8 //=============================================================================
10 #include "utilities.h"
11 #include "Utils_CorbaException.hxx"
13 #include "MEDMEM_convert.hxx"
16 SALOME_MED::medGeometryElement convertMedEltToIdlElt(medGeometryElement element)
17 throw (SALOME::SALOME_Exception)
21 case MED_NONE : return SALOME_MED::MED_NONE;
22 case MED_POINT1 : return SALOME_MED::MED_POINT1;
23 case MED_SEG2 : return SALOME_MED::MED_SEG2;
24 case MED_SEG3 : return SALOME_MED::MED_SEG3;
25 case MED_TRIA3 : return SALOME_MED::MED_TRIA3;
26 case MED_QUAD4 : return SALOME_MED::MED_QUAD4;
27 case MED_TRIA6 : return SALOME_MED::MED_TRIA6;
28 case MED_QUAD8 : return SALOME_MED::MED_QUAD8;
29 case MED_TETRA4 : return SALOME_MED::MED_TETRA4;
30 case MED_PYRA5 : return SALOME_MED::MED_PYRA5;
31 case MED_PENTA6 : return SALOME_MED::MED_PENTA6;
32 case MED_HEXA8 : return SALOME_MED::MED_HEXA8;
33 case MED_TETRA10 : return SALOME_MED::MED_TETRA10;
34 case MED_PYRA13 : return SALOME_MED::MED_PYRA13;
35 case MED_PENTA15 : return SALOME_MED::MED_PENTA15;
36 case MED_HEXA20 : return SALOME_MED::MED_HEXA20;
37 case MED_ALL_ELEMENTS : return SALOME_MED::MED_ALL_ELEMENTS;
39 { MESSAGE("Unknown Geometry Element");
40 THROW_SALOME_CORBA_EXCEPTION("Unknown Geometry Element",
41 SALOME::INTERNAL_ERROR);
46 medGeometryElement convertIdlEltToMedElt(SALOME_MED::medGeometryElement element)
47 throw (SALOME::SALOME_Exception)
54 case SALOME_MED::MED_NONE : return MED_NONE;
55 case SALOME_MED::MED_POINT1 : return MED_POINT1;
56 case SALOME_MED::MED_SEG2 : return MED_SEG2;
57 case SALOME_MED::MED_SEG3 : return MED_SEG3;
58 case SALOME_MED::MED_TRIA3 : return MED_TRIA3;
59 case SALOME_MED::MED_QUAD4 : return MED_QUAD4;
60 case SALOME_MED::MED_TRIA6 : return MED_TRIA6;
61 case SALOME_MED::MED_QUAD8 : return MED_QUAD8;
62 case SALOME_MED::MED_TETRA4 : return MED_TETRA4;
63 case SALOME_MED::MED_PYRA5 : return MED_PYRA5;
64 case SALOME_MED::MED_PENTA6 : return MED_PENTA6;
65 case SALOME_MED::MED_HEXA8 : return MED_HEXA8;
66 case SALOME_MED::MED_TETRA10 : return MED_TETRA10;
67 case SALOME_MED::MED_PYRA13 : return MED_PYRA13;
68 case SALOME_MED::MED_PENTA15 : return MED_PENTA15;
69 case SALOME_MED::MED_HEXA20 : return MED_HEXA20;
70 case SALOME_MED::MED_ALL_ELEMENTS : return MED_ALL_ELEMENTS;
72 { MESSAGE("unknown Geometry Element");
73 THROW_SALOME_CORBA_EXCEPTION("Unknown Geometry Element",
74 SALOME::INTERNAL_ERROR);
79 SALOME_MED::medEntityMesh convertMedEntToIdlEnt(medEntityMesh entity)
80 throw (SALOME::SALOME_Exception)
84 case MED_CELL : return SALOME_MED::MED_CELL;
85 case MED_FACE : return SALOME_MED::MED_FACE;
86 case MED_EDGE : return SALOME_MED::MED_EDGE;
87 case MED_NODE : return SALOME_MED::MED_NODE;
88 case MED_ALL_ENTITIES : return SALOME_MED::MED_ALL_ENTITIES;
90 { MESSAGE("Unknown entity element");
91 THROW_SALOME_CORBA_EXCEPTION("Unknown Entity Element",
92 SALOME::INTERNAL_ERROR);
97 medEntityMesh convertIdlEntToMedEnt(SALOME_MED::medEntityMesh entity)
98 throw (SALOME::SALOME_Exception)
102 case SALOME_MED::MED_CELL : return MED_CELL;
103 case SALOME_MED::MED_FACE : return MED_FACE;
104 case SALOME_MED::MED_EDGE : return MED_EDGE;
105 case SALOME_MED::MED_NODE : return MED_NODE;
106 case SALOME_MED::MED_ALL_ENTITIES : return MED_ALL_ENTITIES;
108 { MESSAGE("Unknown Entity Element");
109 THROW_SALOME_CORBA_EXCEPTION("Unknown Entity Element",
110 SALOME::INTERNAL_ERROR);
115 medModeSwitch convertIdlModeToMedMode(SALOME_MED::medModeSwitch mode)
116 throw (SALOME::SALOME_Exception)
120 case SALOME_MED::MED_FULL_INTERLACE : return MED_FULL_INTERLACE;
121 case SALOME_MED::MED_NO_INTERLACE : return MED_NO_INTERLACE;
123 { MESSAGE("Unknown interlace mode");
124 THROW_SALOME_CORBA_EXCEPTION("Unknown interlace mode",
125 SALOME::INTERNAL_ERROR);
130 SALOME_MED::medModeSwitch convertMedModeToIdlMode(medModeSwitch mode)
131 throw (SALOME::SALOME_Exception)
135 case MED_FULL_INTERLACE : return SALOME_MED::MED_FULL_INTERLACE;
136 case MED_NO_INTERLACE : return SALOME_MED::MED_NO_INTERLACE;
138 { MESSAGE("Unknown interlace mode");
139 THROW_SALOME_CORBA_EXCEPTION("Unknown interlace mode",
140 SALOME::INTERNAL_ERROR);
144 SALOME_MED::medConnectivity convertMedConnToIdlConn(medConnectivity connectivite)
145 throw (SALOME::SALOME_Exception)
147 switch (connectivite)
149 case MED_NODAL : return SALOME_MED::MED_NODAL;
150 case MED_DESCENDING : return SALOME_MED::MED_DESCENDING;
152 { MESSAGE("Unknown connectivity type");
153 THROW_SALOME_CORBA_EXCEPTION("Unknown connectivity type",
154 SALOME::INTERNAL_ERROR);
158 medConnectivity convertIdlConnToMedConn(SALOME_MED::medConnectivity connectivite)
159 throw (SALOME::SALOME_Exception)
161 switch (connectivite)
163 case SALOME_MED::MED_NODAL : return MED_NODAL;
164 case SALOME_MED::MED_DESCENDING : return MED_DESCENDING;
166 { MESSAGE("Unknown connectivity type");
167 THROW_SALOME_CORBA_EXCEPTION("Unknown connectivity type",
168 SALOME::INTERNAL_ERROR);
172 SALOME_MED::medDriverTypes convertMedDriverToIdlDriver(MEDMEM::driverTypes driverType)
173 throw (SALOME::SALOME_Exception)
177 case MEDMEM::MED_DRIVER : return SALOME_MED::MED_DRIVER;
178 case MEDMEM::VTK_DRIVER : return SALOME_MED::VTK_DRIVER;
179 case MEDMEM::NO_DRIVER : return SALOME_MED::NO_DRIVER;
181 { MESSAGE("Unknown driver type");
182 THROW_SALOME_CORBA_EXCEPTION("Unknown driver type",
183 SALOME::INTERNAL_ERROR);
188 MEDMEM::driverTypes convertIdlDriverToMedDriver(SALOME_MED::medDriverTypes driverType)
189 throw (SALOME::SALOME_Exception)
193 case SALOME_MED::MED_DRIVER : return MEDMEM::MED_DRIVER;
194 case SALOME_MED::VTK_DRIVER : return MEDMEM::VTK_DRIVER;
195 case SALOME_MED::NO_DRIVER : return MEDMEM::NO_DRIVER;
197 { MESSAGE("Unknown driver type");
198 THROW_SALOME_CORBA_EXCEPTION("Unknown driver type",
199 SALOME::INTERNAL_ERROR);
203 bool verifieParam (SALOME_MED::medEntityMesh entity,SALOME_MED::medGeometryElement geomElement)
204 throw (SALOME::SALOME_Exception)
211 case SALOME_MED::MED_FACE :
215 case SALOME_MED::MED_TRIA3 : coherent=true;
216 case SALOME_MED::MED_QUAD4 : coherent=true;
217 case SALOME_MED::MED_TRIA6 : coherent=true;
218 case SALOME_MED::MED_QUAD8 : coherent=true;
222 case SALOME_MED::MED_CELL :
226 case SALOME_MED::MED_POINT1 : coherent=true;
227 case SALOME_MED::MED_SEG2 : coherent=true;
228 case SALOME_MED::MED_SEG3 : coherent=true;
229 case SALOME_MED::MED_TRIA3 : coherent=true;
230 case SALOME_MED::MED_TRIA6 : coherent=true;
231 case SALOME_MED::MED_QUAD4 : coherent=true;
232 case SALOME_MED::MED_QUAD8 : coherent=true;
233 case SALOME_MED::MED_TETRA4 : coherent=true;
234 case SALOME_MED::MED_TETRA10 : coherent=true;
235 case SALOME_MED::MED_HEXA8 : coherent=true;
236 case SALOME_MED::MED_HEXA20 : coherent=true;
237 case SALOME_MED::MED_PENTA6 : coherent=true;
238 case SALOME_MED::MED_PENTA15 : coherent=true;
239 case SALOME_MED::MED_PYRA5 : coherent=true;
240 case SALOME_MED::MED_PYRA13 : coherent=true;
244 case SALOME_MED::MED_EDGE :
248 case SALOME_MED::MED_SEG2 : coherent=true;
249 case SALOME_MED::MED_SEG3 : coherent=true;
253 case SALOME_MED::MED_NODE :
257 case SALOME_MED::MED_POINT1 : coherent=true;
261 case SALOME_MED::MED_ALL_ENTITIES :
265 case SALOME_MED::MED_NONE : coherent=true;
270 { MESSAGE("Unknown geometric entity");
271 THROW_SALOME_CORBA_EXCEPTION("Unknown geometric entity",
272 SALOME::INTERNAL_ERROR);
279 case SALOME_MED::MED_ALL_ELEMENTS : coherent=true;