MED fichier
medlocalizationcf.c
Aller à la documentation de ce fichier.
1 /* This file is part of MED.
2  *
3  * COPYRIGHT (C) 1999 - 2016 EDF R&D, CEA/DEN
4  * MED is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * MED 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
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with MED. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 
19 #include <med.h>
20 #include "med_config.h"
21 #include "med_outils.h"
22 #include <string.h>
23 #include <stdlib.h>
24 
25 /*
26 From Fortran call of following C functions :
27 - MEDlocalizationWr
28 - MEDlocalizationInfo
29 - MEDlocalizationRd
30 - MEDnLocalization
31 - MEDlocalizationInfoByName
32 */
33 
34 #define nmlcflow F77_FUNC(mlcflow,MLCFLOW)
35 #define nmlcflor F77_FUNC(mlcflor,MLCFLOR)
36 #define nmlcfnlc F77_FUNC(mlcfnlc,MLCFNLC)
37 #define nmlcflci F77_FUNC(mlcflci,MLCFLCI)
38 #define nmlcflni F77_FUNC(mlcflni,MLCFLNI)
39 
40 #ifdef PPRO_NT
41 med_int
42 MLCFLOW(med_idt *fid, char *lname, unsigned int bidon1, med_int *lnamelen,
43  med_int *gtype, med_int *sdim, med_float *ecoo,
44  med_int *swm, med_int *nip, med_float *icoo,
45  med_float *wght, char * giname, unsigned int bidon2, med_int *ginamelen,
46  char * isname,unsigned int bidon3, med_int *isnamelen)
47 #else
48 med_int
49 nmlcflow(med_idt *fid, char *lname,med_int *lnamelen,
50  med_int *gtype, med_int *sdim, med_float *ecoo,
51  med_int *swm, med_int *nip, med_float *icoo,
52  med_float *wght,char * giname, med_int *ginamelen,
53  char * isname, med_int *isnamelen)
54 #endif
55 {
56  med_err _ret=0;
57  char *_fn1,*_fn2,*_fn3;
58  med_switch_mode _swm = (med_switch_mode) *swm;
59  med_geometry_type _gtype = (med_geometry_type) *gtype;
60 
61  _fn1 = _MED2cstring((char *) lname, (int) *lnamelen);
62  if (!_fn1) return(-1);
63  _fn2 = _MED2cstring((char *) giname, (int) *ginamelen);
64  if (!_fn2) return(-1);
65  _fn3 = _MED2cstring((char *) isname, (int) *isnamelen);
66  if (!_fn3) return(-1);
67 
68  _ret = (med_int) MEDlocalizationWr((const med_idt) *fid,
69  _fn1,
70  _gtype,
71  (med_int) *sdim,
72  (med_float *) ecoo,
73  _swm,
74  (med_int) *nip,
75  (med_float *) icoo,
76  (med_float *) wght,
77  _fn2,
78  _fn3);
79 
80  _MEDcstringFree(_fn1);
81  _MEDcstringFree(_fn2);
82  _MEDcstringFree(_fn3);
83 
84  return (_ret);
85 }
86 
87 
88 
89 #ifdef PPRO_NT
90 med_int
91 MLCFNLC(med_int *fid)
92 #else
93 med_int
95 #endif
96 {
97  med_int _ret;
98 
99  _ret = (med_int) MEDnLocalization((const med_idt) *fid);
100 
101  return(_ret);
102 }
103 
104 
105 
106 #ifdef PPRO_NT
107 med_int
108 MLCFLCI(med_int *fid, med_int *it, char*lname, unsigned int bidon1,
109  med_int *gtype, med_int *sdim, med_int nip,
110  char * giname, unsigned int bidon2,
111  char * isname, unsigned int bidon3,
112  med_int *nsmc, med_int *sgtype)
113 #else
114 med_int
115 nmlcflci(med_int *fid, med_int *it, char *lname, med_int *gtype, med_int *sdim,
116  med_int *nip,char * giname, char * isname,
117  med_int *nsmc, med_int *sgtype)
118 
119 #endif
120 {
121  med_int _ret;
122  char _fs1[MED_NAME_SIZE+1]="";
123  char _fs2[MED_NAME_SIZE+1]="";
124  char _fs3[MED_NAME_SIZE+1]="";
125  med_geometry_type _gtype,_sgtype;
126 
127  _ret = (med_int) MEDlocalizationInfo((med_idt) *fid,
128  (med_int) *it,
129  _fs1,
130  &_gtype,
131  (med_int *) sdim,
132  (med_int *) nip,
133  _fs2,
134  _fs3,
135  (med_int *) nsmc,
136  &_sgtype);
137 
138  _MEDc2fString(_fs1,lname,MED_NAME_SIZE);
139  _MEDc2fString(_fs2,giname,MED_NAME_SIZE);
140  _MEDc2fString(_fs3,isname,MED_NAME_SIZE);
141 
142  *gtype = (med_int) _gtype;
143  *sgtype = (med_int) _sgtype;
144 
145  return _ret;
146 }
147 
148 #ifdef PPRO_NT
149 med_int
150 MLCFLNI(med_int *fid, char*lname, unsigned int bidon1, med_int *lnamelen,
151  med_int *gtype, med_int *sdim, med_int nip,
152  char * giname, unsigned int bidon2,
153  char * isname, unsigned int bidon3,
154  med_int *nsmc, med_int *sgtype)
155 #else
156 med_int
157 nmlcflni(med_int *fid, char *lname, med_int *lnamelen, med_int *gtype, med_int *sdim,
158  med_int *nip,char * giname, char * isname,
159  med_int *nsmc, med_int *sgtype)
160 #endif
161 {
162  med_int _ret;
163  char *_fn1;
164  char _fs2[MED_NAME_SIZE+1]="";
165  char _fs3[MED_NAME_SIZE+1]="";
166  med_geometry_type _gtype,_sgtype;
167 
168  _fn1 = _MED2cstring((char *) lname, (int) *lnamelen);
169  if (!_fn1)
170  return(-1);
171 
172  _ret = (med_int) MEDlocalizationInfoByName((med_idt) *fid,
173  _fn1,
174  &_gtype,
175  (med_int *) sdim,
176  (med_int *) nip,
177  _fs2,
178  _fs3,
179  (med_int *) nsmc,
180  &_sgtype);
181 
182  _MEDcstringFree(_fn1);
183  _MEDc2fString(_fs2,giname,MED_NAME_SIZE);
184  _MEDc2fString(_fs3,isname,MED_NAME_SIZE);
185 
186  *gtype = (med_int) _gtype;
187  *sgtype = (med_int) _sgtype;
188 
189  return _ret;
190 }
191 
192 
193 
194 #ifdef PPRO_NT
195 med_int
196 MLCFLOR(med_idt *fid, char *lname, unsigned int bidon1, med_int *lnamelen,
197  med_int *swm, med_float *ecoo, med_float *icoo, med_float *wght)
198 #else
199 med_int
200 nmlcflor(med_idt *fid, char *lname, med_int *lnamelen,
201  med_int *swm, med_float *ecoo, med_float *icoo, med_float *wght)
202 #endif
203 {
204  med_err _ret=0;
205  char *_fn1;
206  med_switch_mode _swm = (med_switch_mode) *swm;
207 
208  _fn1 = _MED2cstring((char *) lname, (int) *lnamelen);
209  if (!_fn1)
210  return(-1);
211 
212  _ret = (med_int) MEDlocalizationRd((const med_idt) *fid,
213  _fn1,
214  _swm,
215  (med_float *) ecoo,
216  (med_float *) icoo,
217  (med_float *) wght);
218 
219  _MEDcstringFree(_fn1);
220 
221  return (_ret);
222 }
223 
herr_t med_err
Definition: med.h:310
MEDC_EXPORT med_err _MEDcstringFree(char *chaine)
#define nmlcfnlc
MEDC_EXPORT med_int MEDnLocalization(const med_idt fid)
Cette routine permet de lire le nombre de localisations de points d'intégration contenues dans un fic...
#define nmlcflor
med_switch_mode
Definition: med.h:89
double med_float
Definition: med.h:314
#define nmlcflow
int med_int
Definition: med.h:316
#define nmlcflni
#define nmlcflci
MEDC_EXPORT med_err MEDlocalizationRd(const med_idt fid, const char *const localizationname, const med_switch_mode switchmode, med_float *const elementcoordinate, med_float *const ipointcoordinate, med_float *const weight)
Cette routine permet la lecture d'une localisation localizationname de points d'intégration dans/auto...
MEDC_EXPORT med_err _MEDc2fString(const char *const chainec, char *const chainef, med_int longueur_buffer77)
MEDC_EXPORT med_err MEDlocalizationInfoByName(const med_idt fid, const char *const localizationname, med_geometry_type *const geotype, med_int *const spacedimension, med_int *const nipoint, char *const geointerpname, char *const sectionmeshname, med_int *const nsectionmeshcell, med_geometry_type *const sectiongeotype)
Cette routine permet d'obtenir la description d'une localisation de points d'intégration nommée local...
hid_t med_idt
Definition: med.h:309
#define MED_NAME_SIZE
Definition: med.h:74
MEDC_EXPORT med_err MEDlocalizationInfo(const med_idt fid, const int localizationit, char *const localizationname, med_geometry_type *const geotype, med_int *const spacedimension, med_int *const nipoint, char *const geointerpname, char *const sectionmeshname, med_int *const nsectionmeshcell, med_geometry_type *const sectiongeotype)
Cette routine permet d'obtenir la description de la localisation de points d'intégration n° localizat...
MEDC_EXPORT med_err MEDlocalizationWr(const med_idt fid, const char *const localizationname, const med_geometry_type geotype, const med_int spacedimension, const med_float *const elementcoordinate, const med_switch_mode switchmode, const med_int nipoint, const med_float *const ipointcoordinate, const med_float *const weight, const char *const geointerpname, const char *const ipointstructmeshname)
Cette routine permet l'écriture d'une localisation localizationname de points d'intégration dans/auto...
MEDC_EXPORT char * _MED2cstring(char *chaine, int longueur)
Definition: MED2cstring.c:35
int med_geometry_type
Definition: med.h:179