# maacf.c

Aller à la documentation de ce fichier.

    00001 /*  This file is part of MED.
    00002  *
    00003  *  COPYRIGHT (C) 1999 - 2011  EDF R&D, CEA/DEN
    00004  *  MED is free software: you can redistribute it and/or modify
    00005  *  it under the terms of the GNU Lesser General Public License as published by
    00006  *  the Free Software Foundation, either version 3 of the License, or
    00007  *  (at your option) any later version.
    00008  *
    00009  *  MED is distributed in the hope that it will be useful,
    00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00012  *  GNU Lesser General Public License for more details.
    00013  *
    00014  *  You should have received a copy of the GNU Lesser General Public License
    00015  *  along with MED.  If not, see <http://www.gnu.org/licenses/>.
    00016  */
    00017
    00018
    00019 #include <med.h>
    00020 #include <med_config.h>
    00021 #include <med_outils.h>
    00022 #include <stdlib.h>
    00023 #include <string.h>
    00024
    00025
    00026 #define nedfdiml F77_FUNC(edfdiml,EDFDIML)
    00027 #define nedfmaac F77_FUNC(edfmaac,EDFMAAC)
    00028 #define nedfnmaa F77_FUNC(edfnmaa,EDFNMAA)
    00029 #define nedfmaai F77_FUNC(edfmaai,EDFMAAI)
    00030 #define nedfnnsl F77_FUNC(edfnnsl,EDFNNSL)
    00031 #define nedfnnse F77_FUNC(edfnnse,EDFNNSE)
    00032 #define nedfnnil F77_FUNC(edfnnil,EDFNNIL)
    00033 #define nedfnnie F77_FUNC(edfnnie,EDFNNIE)
    00034 #define nedfnnml F77_FUNC(edfnnml,EDFNNML)
    00035 #define nedfnnme F77_FUNC(edfnnme,EDFNNME)
    00036 #define nedfunvc F77_FUNC(edfunvc,EDFUNVC)
    00037 #define nedfunvl F77_FUNC(edfunvl,EDFUNVL)
    00038 #define nedfespc F77_FUNC(edfespc,EDFESPC)
    00039 #define nedfespl F77_FUNC(edfespl,EDFESPL)
    00040 #define nedfnage F77_FUNC(edfnage,EDFNAGE)
    00041 #define nedfnagl F77_FUNC(edfnagl,EDFNAGL)
    00042
    00043
    00044 #ifdef PPRO_NT
    00045 med_int
    00046 __stdcall EDFDIML(med_int *fid, char *maa, unsigned int bidon,
    00047                   med_int *lon)
    00048 #else
    00049 med_int
    00050 nedfdiml(med_int *fid, char *maa,med_int *lon)
    00051 #endif
    00052 {
    00053   char *fn;
    00054   med_int ret;
    00055
    00056   fn = _MED2cstring(maa, (int) * lon);
    00057   if (!fn)
    00058     return(-1);
    00059
    00060   ret = (med_int) MEDdimLire((med_idt) *fid,fn);
    00061
    00062   _MEDcstringFree(fn);
    00063
    00064   return(ret);
    00065 }
    00066
    00067 #ifdef PPRO_NT
    00068 med_int
    00069 __stdcall EDFMAAC(med_int *fid , char *nom, unsigned int bidon,
    00070                   med_int *lon, med_int * dim, med_int *type,
    00071                   char *desc, unsigned int bidon2, med_int *lon2)
    00072 #else
    00073 med_int
    00074 nedfmaac(med_int *fid , char *nom, med_int *lon, med_int * dim, med_int *type,
    00075          char *desc, med_int *lon2)
    00076 #endif
    00077 {
    00078   char *fn1, *fn2;
    00079   med_int ret;
    00080
    00081   fn1 = _MED2cstring(nom, (int) * lon);
    00082   fn2 = _MED2cstring(desc,(int) * lon2);
    00083
    00084   if (!fn1)
    00085     return(-1);
    00086
    00087   if (!fn2)
    00088     return -1;
    00089
    00090   ret = (med_int) MEDmaaCr((med_idt) *fid, fn1, (med_int) *dim,
    00091                            (med_maillage) *type,fn2);
    00092
    00093   _MEDcstringFree(fn1);
    00094   _MEDcstringFree(fn2);
    00095
    00096   return(ret);
    00097 }
    00098
    00099 #ifdef PPRO_NT
    00100 med_int
    00101 __stdcall EDFMAAI(med_int *fid, med_int *indice, char *maa,
    00102                   unsigned int bidon, med_int *dim, med_int *type,
    00103                   char *desc, unsigned int bidon2)
    00104 #else
    00105 med_int
    00106 nedfmaai(med_int *fid,med_int *indice, char *maa,med_int *dim,
    00107          med_int *type,char *desc)
    00108 #endif
    00109 {
    00110   med_int ret;
    00111   char fs1[MED_TAILLE_NOM+1];
    00112   char fs2[MED_TAILLE_DESC+1];
    00113   med_maillage local_type;
    00114
    00115   ret = (med_int) MEDmaaInfo((med_idt)*fid,(med_int) *indice, (char *) fs1,
    00116                              (med_int *) dim,&local_type,
    00117                              (char *) fs2);
    00118
    00119   *type = (med_int) local_type;
    00120
    00121   strncpy(maa,fs1,MED_TAILLE_NOM);
    00122   _MEDfstring(maa,MED_TAILLE_NOM);
    00123
    00124   strncpy(desc,fs2,MED_TAILLE_DESC);
    00125   _MEDfstring(desc,MED_TAILLE_DESC);
    00126
    00127   return(ret);
    00128 }
    00129
    00130 #ifdef PPRO_NT
    00131 med_int
    00132 __stdcall EDFNMAA(med_int *fid)
    00133 #else
    00134 med_int
    00135 nedfnmaa(med_int *fid)
    00136 #endif
    00137 {
    00138   med_int ret;
    00139
    00140   ret = (med_int) MEDnMaa((med_idt) *fid);
    00141
    00142   return(ret);
    00143 }
    00144
    00145 #ifdef PPRO_NT
    00146 med_int
    00147 __stdcall EDFNNSL(med_int *fid,char *maa,unsigned int bidon1, med_int *lon1)
    00148 #else
    00149 med_int
    00150 nedfnnsl(med_int *fid,char *maa,med_int *lon1)
    00151 #endif
    00152 {
    00153   med_int ret;
    00154   char *fn1;
    00155
    00156   fn1 = _MED2cstring((char *)maa,(int)*lon1);
    00157
    00158   if (!fn1)
    00159     return -1;
    00160
    00161   ret = (med_int) MEDnbnosoLire((med_idt) *fid,(char *)fn1);
    00162
    00163   _MEDcstringFree(fn1);
    00164
    00165   return ret;
    00166 }
    00167
    00168 #ifdef PPRO_NT
    00169 med_int
    00170 __stdcall EDFNNSE(med_int *fid,char *maa, unsigned int bidon1,
    00171                   med_int *lon1,med_int *n)
    00172 #else
    00173 med_int
    00174 nedfnnse(med_int *fid,char *maa,med_int *lon1,med_int *n)
    00175 #endif
    00176 {
    00177   med_int ret;
    00178   char *fn1;
    00179
    00180   fn1 = _MED2cstring((char *)maa,(int)*lon1);
    00181
    00182   if (!fn1)
    00183     return -1;
    00184
    00185   ret = (med_int) MEDnbnosoEcr((med_idt) *fid,(char *)fn1,(med_int)*n);
    00186
    00187   _MEDcstringFree(fn1);
    00188
    00189   return ret;
    00190 }
    00191
    00192 #ifdef PPRO_NT
    00193 med_int
    00194 __stdcall EDFNNIL(med_int *fid,char *maa,unsigned bidon1, med_int *lon1)
    00195 #else
    00196 med_int
    00197 nedfnnil(med_int *fid,char *maa,med_int *lon1)
    00198 #endif
    00199 {
    00200   med_int ret;
    00201   char *fn1;
    00202
    00203   fn1 = _MED2cstring((char *)maa,(int)*lon1);
    00204
    00205   if (!fn1)
    00206     return -1;
    00207
    00208   ret = (med_int) MEDnbnosoLire((med_idt) *fid,(char *)fn1);
    00209
    00210   _MEDcstringFree(fn1);
    00211
    00212   return ret;
    00213 }
    00214
    00215
    00216 #ifdef PPRO_NT
    00217 med_int
    00218 __stdcall EDFNNIE(med_int *fid, char *maa, unsigned int bidon1,
    00219                   med_int *lon1,med_int *n)
    00220 #else
    00221 med_int
    00222 nedfnnie(med_int *fid,char *maa,med_int *lon1,med_int *n)
    00223 #endif
    00224 {
    00225   med_int ret;
    00226   char *fn1;
    00227
    00228   fn1 = _MED2cstring((char *)maa,(int)*lon1);
    00229
    00230   if (!fn1)
    00231     return -1;
    00232
    00233   ret = (med_int) MEDnbnosoEcr((med_idt) *fid,(char *)fn1,(med_int)*n);
    00234
    00235   _MEDcstringFree(fn1);
    00236
    00237   return ret;
    00238 }
    00239
    00240 #ifdef PPRO_NT
    00241 med_int
    00242 __stdcall EDFNNML(med_int *fid,char *maa,unsigned int bidon1,med_int *lon1)
    00243 #else
    00244 med_int
    00245 nedfnnml(med_int *fid,char *maa,med_int *lon1)
    00246 #endif
    00247 {
    00248   med_int ret;
    00249   char *fn1;
    00250
    00251   fn1 = _MED2cstring((char *)maa,(int)*lon1);
    00252
    00253   if (!fn1)
    00254     return -1;
    00255
    00256   ret = (med_int) MEDnbnosoLire((med_idt) *fid,(char *)fn1);
    00257
    00258   _MEDcstringFree(fn1);
    00259
    00260   return ret;
    00261 }
    00262
    00263 #ifdef PPRO_NT
    00264 med_int
    00265 __stdcall EDFNNME(med_int *fid,char *maa,unsigned int bidon1,
    00266                   med_int *lon1,med_int *n)
    00267 #else
    00268 med_int
    00269 nedfnnme(med_int *fid,char *maa,med_int *lon1,med_int *n)
    00270 #endif
    00271 {
    00272   med_int ret;
    00273   char *fn1;
    00274
    00275   fn1 = _MED2cstring((char *)maa,(int)*lon1);
    00276
    00277   if (!fn1)
    00278     return -1;
    00279
    00280   ret = (med_int) MEDnbnosoEcr((med_idt) *fid,(char *)fn1,(med_int)*n);
    00281
    00282   _MEDcstringFree(fn1);
    00283
    00284   return ret;
    00285 }
    00286
    00287
    00288 #ifdef PPRO_NT
    00289 med_int
    00290 __stdcall EDFUNVC(med_int *fid , char *nom, unsigned int bidon, med_int *lon)
    00291 #else
    00292 med_int
    00293 nedfunvc(med_int *fid , char *nom, med_int *lon)
    00294 #endif
    00295 {
    00296   char *fn;
    00297   med_int ret;
    00298
    00299   fn = _MED2cstring(nom, (int) * lon);
    00300
    00301   if (!fn)
    00302     return(-1);
    00303
    00304   ret = (med_int) MEDunvCr((med_idt) *fid, fn);
    00305
    00306   _MEDcstringFree(fn);
    00307
    00308   return(ret);
    00309 }
    00310
    00311 #ifdef PPRO_NT
    00312 med_int
    00313 __stdcall EDFUNVL(med_int *fid,char *nom, unsigned int bidon, med_int *lon,
    00314                   char *nomu, unsigned int bidon1, med_int *lonu)
    00315 #else
    00316 med_int
    00317 nedfunvl(med_int *fid,char *nom,med_int *lon,char *nomu,med_int *lonu)
    00318 #endif
    00319 {
    00320   char *fn;
    00321   char *fs1;
    00322   med_int ret;
    00323
    00324   fn = _MED2cstring(nom, (int) * lon);
    00325   fs1 = (char *) malloc(sizeof(char)*MED_TAILLE_LNOM+1);
    00326
    00327   if (!(fn&&fs1))
    00328     return(-1);
    00329
    00330   ret = (med_int) MEDunvLire((med_idt)*fid,fn,fs1);
    00331
    00332   strncpy(nomu,fs1,MED_TAILLE_LNOM);
    00333   _MEDfstring(nomu,MED_TAILLE_LNOM);
    00334
    00335   _MEDcstringFree(fn);
    00336   free(fs1);
    00337
    00338   return(ret);
    00339 }
    00340
    00341 #ifdef PPRO_NT
    00342 med_int
    00343 __stdcall EDFESPC(med_int *fid, char *maa, unsigned int bidon,
    00344                   med_int *lon, med_int *dim)
    00345 #else
    00346 med_int
    00347 nedfespc(med_int *fid, char *maa,med_int *lon,med_int *dim)
    00348 #endif
    00349 {
    00350   char *fn;
    00351   med_int ret;
    00352
    00353   fn = _MED2cstring(maa, (int) * lon);
    00354
    00355   if (!fn)
    00356     return(-1);
    00357
    00358   ret = (med_int) MEDdimEspaceCr((med_idt) *fid, fn, (med_int) *dim);
    00359
    00360   _MEDcstringFree(fn);
    00361
    00362   return(ret);
    00363 }
    00364
    00365 #ifdef PPRO_NT
    00366 med_int
    00367 __stdcall EDFESPL(med_int *fid, char *maa, unsigned int bidon,
    00368                   med_int *lon)
    00369 #else
    00370 med_int
    00371 nedfespl(med_int *fid, char *maa,med_int *lon)
    00372 #endif
    00373 {
    00374   char *fn;
    00375   med_int ret;
    00376
    00377   fn = _MED2cstring(maa, (int) * lon);
    00378
    00379   if (!fn)
    00380     return(-1);
    00381
    00382   ret = (med_int) MEDdimEspaceLire((med_idt) *fid,fn);
    00383
    00384   _MEDcstringFree(fn);
    00385
    00386   return(ret);
    00387 }
    00388
    00389 #ifdef PPRO_NT
    00390 med_int
    00391 __stdcall EDFNAGE(med_int *fid,char *maa, unsigned int bidon1,
    00392                   med_int *lon1,med_int *type)
    00393 #else
    00394 med_int
    00395 nedfnage(med_int *fid,char *maa,med_int *lon1,med_int *type)
    00396 #endif
    00397 {
    00398   med_int ret;
    00399   char *fn1;
    00400
    00401   fn1 = _MED2cstring((char *)maa,(int)*lon1);
    00402
    00403   if (!fn1)
    00404     return -1;
    00405
    00406   ret = (med_int) MEDnatureGrilleEcr((med_idt) *fid,(char *)fn1,(med_type_grille)*type);
    00407
    00408   _MEDcstringFree(fn1);
    00409
    00410   return ret;
    00411 }
    00412
    00413 #ifdef PPRO_NT
    00414 med_int
    00415 __stdcall EDFNAGL(med_int *fid,char *maa, unsigned int bidon1,
    00416                   med_int *lon1,med_int *type)
    00417 #else
    00418 med_int
    00419 nedfnagl(med_int *fid,char *maa,med_int *lon1,med_int *type)
    00420 #endif
    00421 {
    00422   med_int ret;
    00423   char *fn1;
    00424
    00425   fn1 = _MED2cstring((char *)maa,(int)*lon1);
    00426
    00427   if (!fn1)
    00428     return -1;
    00429
    00430   ret = (med_int) MEDnatureGrilleLire((med_idt) *fid,(char *)fn1,(med_type_grille *)type);
    00431
    00432   _MEDcstringFree(fn1);
    00433
    00434   return ret;
    00435 }