Salome HOME
57f360ffed058209334c9b4c84ead1d7d9561cbe
[modules/med.git] / src / MEDWrapper / V2_1 / MEDparametresGeometrie.cxx
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either 
7 // version 2.1 of the License.
8 // 
9 // This library is distributed in the hope that it will be useful 
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public  
15 // License along with this library; if not, write to the Free Software 
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/
19 //
20 /*************************************************************************
21 * COPYRIGHT (C) 1999 - 2002  EDF R&D
22 * THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
23 * IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE 
24 * AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION; 
25 * EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
26 *  
27 * THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
28 * WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
29 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
30 * LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
31 *
32 * YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
33 * ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
34 * INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
35 *
36 *************************************************************************/
37
38 #include "med.hxx"
39 #include "med_outils.hxx"
40
41 /*
42  * - Nom de la fonction : _MEDparametresGeometrie
43  * - Description : fournit les parametres geometriques des differents
44  *                 entites et elements MED
45  * - Parametres :
46  *     - typ_ent (IN)  : type d'entite de l'element
47  *     - type_geo (IN) : le type geometrique de l'element
48  *     - dim (OUT)     : dimension de l'element
49  *     - nnoe (OUT)    : nombre de noeuds composant l'element (connectivite 
50  *                       nodale)
51  *     - ndes (OUT)    : nombre de composants dans l'elements (connectivite
52  *                       descendante)
53  * - Resultat : 0 en cas de succes, -1 sinon
54  */
55
56 namespace med_2_1{
57
58 med_err 
59 _MEDparametresGeometrie(med_entite_maillage type_ent,
60                         med_geometrie_element type_geo, int *dim, 
61                         int *nnoe,int *ndes)
62 {
63   *nnoe = type_geo % 100;
64   *dim = type_geo / 100;
65
66   switch(type_ent)
67     {
68     case MED_MAILLE :
69       switch (type_geo)
70         {
71         case MED_POINT1 :
72           *ndes = 0;
73           break;
74           
75         case MED_SEG2 :
76           *ndes = 2;
77           break;
78           
79         case MED_SEG3 :
80           *ndes = 3;
81           break;
82           
83         case MED_TRIA3 :
84           *ndes = 3;
85           break;
86           
87         case MED_TRIA6 :
88           *ndes = 3;
89           break;
90           
91         case MED_QUAD4 :
92           *ndes = 4;
93           break;
94           
95         case MED_QUAD8 :
96           *ndes = 4;
97           break;
98           
99         case MED_TETRA4 :
100           *ndes = 4;
101           break;
102           
103         case MED_TETRA10 :
104           *ndes = 4;
105           break;
106           
107         case MED_HEXA8 :
108           *ndes = 6;
109           break;
110           
111         case MED_HEXA20 :
112           *ndes = 6;
113           break;
114           
115         case MED_PENTA6 :
116           *ndes = 5;
117           break;
118           
119         case MED_PENTA15 :
120           *ndes = 5;
121           break;
122           
123         case MED_PYRA5 :
124           *ndes = 5;
125           break;
126           
127         case MED_PYRA13 :
128           *ndes = 5;
129           break;
130           
131         default :
132           return -1;
133         }
134       break;
135       
136     case MED_FACE :
137       switch(type_geo)
138         {
139         case MED_TRIA3 :
140           *ndes = 3;
141           break;
142           
143         case MED_TRIA6 :
144           *ndes = 3;
145           break;
146           
147         case MED_QUAD4 :
148           *ndes = 4;
149           break;
150           
151         case MED_QUAD8 :
152           *ndes = 4;
153           break;
154           
155         default :
156           return -1;
157         }
158       break;
159       
160     case MED_ARETE :
161       switch(type_geo)
162         {
163         case MED_SEG2 :
164           *ndes = 2;
165           break;
166           
167         case MED_SEG3 :
168           *ndes = 3;
169           break;
170           
171         default :
172           return -1;
173         }
174       break;
175       
176     default :
177       return -1;
178     }
179   
180   return 0;
181 }
182
183 }