MED fichier
medinterpcf.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 - MEDinterpCr
28 - MEDinterpBaseFunctionWr
29 - MEDinterpBaseFunctionRd
30 - MEDnInterp
31 - MEDinterpInfo
32 - MEDinterpInfoByName
33 - MEDinterpBaseFunctionCoeffSize
34 */
35 
36 #define nmipfcre F77_FUNC(mipfcre,MIPFCRE)
37 #define nmipfbfw F77_FUNC(mipfbfw,MIPFBFW)
38 #define nmipfbfr F77_FUNC(mipfbfr,MIPFBFR)
39 #define nmipfnip F77_FUNC(mipfnip,MIPFNIP)
40 #define nmipfiin F77_FUNC(mipfiin,MIPFIIN)
41 #define nmipfipi F77_FUNC(mipfipi,MIPFIPI)
42 #define nmipfcsz F77_FUNC(mipfcsz,MIPFCSZ)
43 
44 
45 #ifdef PPRO_NT
46 med_int
47 MIPFCRE(med_int *fid,
48  char *name, unsigned int bidon1, med_int *lon1,
49  med_int *gtype, med_int *cnode, med_int *nvar,
50  med_int *mdeg, med_int *nmaxc)
51 #else
52 med_int
54  char *name, med_int *lon1,
55  med_int *gtype, med_int *cnode, med_int *nvar,
56  med_int *mdeg, med_int *nmaxc)
57 #endif
58 {
59  med_int _ret;
60  char *_fn1;
61  med_geometry_type _gtype = (med_geometry_type) *gtype;
62  med_bool _cnode = (med_bool) *cnode;
63 
64  _fn1 = _MED2cstring(name, (int) * lon1);
65 
66  if (!_fn1 )
67  return(-1);
68 
69  _ret = (med_int) MEDinterpCr((med_idt) *fid,
70  _fn1,
71  _gtype,
72  _cnode,
73  (med_int) *nvar,
74  (med_int) *mdeg,
75  (med_int) *nmaxc );
76 
77  _MEDcstringFree(_fn1);
78 
79  return(_ret);
80 }
81 
82 
83 #ifdef PPRO_NT
84 med_int
85 MIPFBFW(med_int *fid,
86  char *name, unsigned int bidon1, med_int *lon1,
87  med_int *it, med_int *nc, med_int *pw, med_float *co)
88 #else
89 med_int
91  char *name, med_int *lon1,
92  med_int *it, med_int *nc, med_int *pw, med_float *co)
93 #endif
94 {
95  med_int _ret;
96  char *_fn1;
97 
98  _fn1 = _MED2cstring(name, (int) * lon1);
99 
100  if (!_fn1 )
101  return(-1);
102 
103  _ret = (med_int) MEDinterpBaseFunctionWr((med_idt) *fid,
104  _fn1,
105  (med_int) *it,
106  (med_int) *nc,
107  (med_int *) pw,
108  (med_float *) co );
109 
110  _MEDcstringFree(_fn1);
111 
112  return(_ret);
113 }
114 
115 
116 #ifdef PPRO_NT
117 med_int
118 MIPFBFR(med_int *fid,
119  char *name, unsigned int bidon1, med_int *lon1,
120  med_int *it, med_int *nc, med_int *pw, med_float *co)
121 #else
122 med_int
124  char *name, med_int *lon1,
125  med_int *it, med_int *nc, med_int *pw, med_float *co)
126 #endif
127 {
128  med_int _ret;
129  char *_fn1;
130 
131  _fn1 = _MED2cstring(name, (int) * lon1);
132 
133  if (!_fn1 )
134  return(-1);
135 
136  _ret = (med_int) MEDinterpBaseFunctionRd((med_idt) *fid,
137  _fn1,
138  (med_int) *it,
139  (med_int *) nc,
140  (med_int *) pw,
141  (med_float *) co );
142 
143  _MEDcstringFree(_fn1);
144 
145  return(_ret);
146 }
147 
148 
149 
150 #ifdef PPRO_NT
151 med_int
152 MIPFNIP(med_int *fid)
153 #else
154 med_int
156 #endif
157 {
158  med_int _ret;
159 
160  _ret = (med_int) MEDnInterp((const med_idt) *fid);
161 
162  return(_ret);
163 }
164 
165 
166 
167 #ifdef PPRO_NT
168 med_int
169 MIPFIIN(med_int *fid,
170  char *name, unsigned int bidon1, med_int *lon1,
171  med_int *gtype, med_int *cnode, med_int *nbf, med_int *nvar,
172  med_int *mdeg, med_int *nmaxc)
173 #else
174 med_int
176  char *name, med_int *lon1,
177  med_int *gtype, med_int *cnode, med_int *nbf, med_int *nvar,
178  med_int *mdeg, med_int *nmaxc)
179 #endif
180 {
181  med_int _ret;
182  char *_fn1;
183  med_geometry_type _gtype;
184  med_bool _cnode;
185 
186  _fn1 = _MED2cstring(name, (int) * lon1);
187 
188  if (!_fn1 )
189  return(-1);
190 
191  _ret = (med_int) MEDinterpInfoByName((med_idt) *fid,
192  _fn1,
193  &_gtype,
194  &_cnode,
195  (med_int*) nbf,
196  (med_int*) nvar,
197  (med_int*) mdeg,
198  (med_int*) nmaxc );
199 
200  *gtype = (med_int) _gtype;
201  *cnode = (med_int) _cnode;
202 
203  _MEDcstringFree(_fn1);
204 
205  return(_ret);
206 }
207 
208 
209 
210 #ifdef PPRO_NT
211 med_int
212 MIPFIPI(med_int *fid, med_int *it,
213  char *name, unsigned int bidon1,
214  med_int *gtype, med_int *cnode, med_int *nbf, med_int *nvar,
215  med_int *mdeg, med_int *nmaxc)
216 #else
217 med_int
218 nmipfipi(med_int *fid, med_int *it, char *name,
219  med_int *gtype, med_int *cnode, med_int *nbf, med_int *nvar,
220  med_int *mdeg, med_int *nmaxc)
221 #endif
222 {
223  med_int _ret;
224  char _fs1[MED_NAME_SIZE+1];
225  med_geometry_type _gtype;
226  med_bool _cnode;
227 
228  _ret = (med_int) MEDinterpInfo((med_idt) *fid,
229  (med_int) *it,
230  _fs1,
231  &_gtype,
232  &_cnode,
233  (med_int *) nbf,
234  (med_int *) nvar,
235  (med_int *) mdeg,
236  (med_int *) nmaxc );
237 
238  _MEDc2fString(_fs1,name,MED_NAME_SIZE);
239  *gtype = (med_int) _gtype;
240  *cnode = (med_int) _cnode;
241 
242  return(_ret);
243 }
244 
245 
246 
247 #ifdef PPRO_NT
248 med_int
249 MIPFCSZ(med_int *fid,
250  char *name, unsigned int bidon1, med_int *lon1,
251  med_int *it)
252 #else
253 med_int
255  char *name, med_int *lon1,
256  med_int *it)
257 #endif
258 {
259  med_int _ret;
260  char *_fn1;
261 
262  _fn1 = _MED2cstring(name, (int) *lon1);
263 
264  if (!_fn1 )
265  return(-1);
266 
268  _fn1,
269  (med_int) *it);
270 
271  _MEDcstringFree(_fn1);
272 
273  return(_ret);
274 }
275 
276 
MEDC_EXPORT med_err _MEDcstringFree(char *chaine)
MEDC_EXPORT med_err MEDinterpBaseFunctionRd(const med_idt fid, const char *const interpname, const int basisfuncit, med_int *const ncoef, med_int *const power, med_float *const coefficient)
Cette routine permet la lecture d'une fonction de base/forme de l'interpolation interpname.
MEDC_EXPORT med_err MEDinterpInfo(const med_idt fid, const int interpit, char *const interpname, med_geometry_type *const geotype, med_bool *const cellnode, med_int *const nbasisfunc, med_int *const nvariable, med_int *const maxdegree, med_int *const nmaxcoef)
Cette fonction informe des caractéristiques de la fonction d'interpolation n° interpit.
Definition: MEDinterpInfo.c:43
double med_float
Definition: med.h:314
#define nmipfbfw
Definition: medinterpcf.c:37
#define nmipfipi
Definition: medinterpcf.c:41
MEDC_EXPORT med_err MEDinterpBaseFunctionWr(const med_idt fid, const char *const interpname, const med_int basisfuncit, const med_int ncoef, const med_int *const power, const med_float *const coefficient)
Cette routine permet l'écriture d'une fonction de base/forme de l'interpolation interpname.
MEDC_EXPORT med_int MEDnInterp(const med_idt fid)
Cette routine renvoie le nombre d'interpolations disponibles dans le fichier.
Definition: MEDnInterp.c:34
int med_int
Definition: med.h:316
#define nmipfcsz
Definition: medinterpcf.c:42
#define nmipfnip
Definition: medinterpcf.c:39
MEDC_EXPORT med_err MEDinterpCr(const med_idt fid, const char *const interpname, const med_geometry_type geotype, const med_bool cellnodes, const med_int nvariable, const med_int maxdegree, const med_int nmaxcoef)
Cette routine permet de créer une nouvelle fonction d'interpolation polynômiale nommée interpname...
Definition: MEDinterpCr.c:43
#define nmipfiin
Definition: medinterpcf.c:40
#define nmipfbfr
Definition: medinterpcf.c:38
MEDC_EXPORT med_int MEDinterpBaseFunctionCoefSize(const med_idt fid, const char *const interpname, const med_int basisfuncit)
Cette routine retourne ne nombre de coefficients/monômes de la fonction de base/forme n° basisfunctit...
MEDC_EXPORT med_err _MEDc2fString(const char *const chainec, char *const chainef, med_int longueur_buffer77)
hid_t med_idt
Definition: med.h:309
#define MED_NAME_SIZE
Definition: med.h:74
#define nmipfcre
Definition: medinterpcf.c:36
MEDC_EXPORT med_err MEDinterpInfoByName(const med_idt fid, const char *const interpname, med_geometry_type *const geotype, med_bool *const cellnode, med_int *const nbasisfunc, med_int *const nvariable, med_int *const maxdegree, med_int *const nmaxcoef)
Cette fonction informe des caractéristiques de la fonction d'interpolation nommée interpname...
med_bool
Definition: med.h:240
MEDC_EXPORT char * _MED2cstring(char *chaine, int longueur)
Definition: MED2cstring.c:35
int med_geometry_type
Definition: med.h:179