# intercf.c

Aller à la documentation de ce fichier.

    00001 /*  This file is part of MED.
    00002  *
    00003  *  COPYRIGHT (C) 1999 - 2012  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 #define nedfnent F77_FUNC(edfnent,EDFNENT)
    00026 #define nedfnoel F77_FUNC(edfnoel,EDFNOEL)
    00027 #define nedfnoee F77_FUNC(edfnoee,EDFNOEE)
    00028 #define nedfelee F77_FUNC(edfelee,EDFELEE)
    00029 #define nedfelel F77_FUNC(edfelel,EDFELEL)
    00030 #define nedfg2fc F77_FUNC(edfg2fc,EDFG2FC)
    00031
    00032
    00033 #ifdef PPRO_NT
    00034 med_int
    00035  EDFNENT(med_int *fid,char *maa, unsigned int bidon1,
    00036                   med_int *lon1, med_int *typ_ent,
    00037                   med_int *typ_con)
    00038 #else
    00039 med_int
    00040 nedfnent(med_int *fid,char *maa, med_int *lon1, med_int *typ_ent,
    00041          med_int *typ_con)
    00042 #endif
    00043 {
    00044   char *fn1;
    00045   med_int ret;
    00046
    00047   fn1 = _MED2cstring((char *)maa,(int) *lon1);
    00048
    00049   if (! fn1)
    00050     return -1;
    00051
    00052   ret = (med_int) MEDnEntites((med_idt)*fid, (char*)fn1,
    00053                               (med_entite_maillage) *typ_ent,
    00054                               (med_connectivite) *typ_con);
    00055
    00056   _MEDcstringFree(fn1);
    00057
    00058   return (ret);
    00059
    00060 }
    00061
    00062 #ifdef PPRO_NT
    00063 med_int
    00064  EDFNOEL(med_int *fid,char *maa,unsigned int bidon1,
    00065                   med_int *lon1, med_int *mdim, med_float *coo,
    00066                   med_int *modcoo,
    00067                   med_int *rep, char *nomcoo, unsigned int bidon2,
    00068                   char *unicoo, unsigned int bidon3,
    00069                   char *nom, unsigned int bidon4,
    00070                   med_int *inom,
    00071                   med_int *num, med_int *inum, med_int *fam, med_int *nnoe)
    00072 #else
    00073 med_int
    00074 nedfnoel(med_int *fid,char *maa,med_int *lon1,med_int *mdim,med_float *coo,
    00075          med_int *modcoo,
    00076          med_int *rep,char *nomcoo,char *unicoo,char *nom,med_int *inom,
    00077          med_int *num,med_int *inum,med_int *fam,med_int *nnoe)
    00078 #endif
    00079 {
    00080   med_int ret;
    00081   char *fn1;
    00082   char *fs1,*fs2,*fs3;
    00083   med_booleen _inom=MED_FAUX,_inum=MED_FAUX;
    00084
    00085   fn1 = _MED2cstring((char *)maa,(int) *lon1);
    00086   fs1 = (char *) malloc(sizeof(char)*MED_TAILLE_PNOM*(*mdim)+1);
    00087   fs2 = (char *) malloc(sizeof(char)*MED_TAILLE_PNOM*(*mdim)+1);
    00088   fs3 = (char *) malloc(sizeof(char)*MED_TAILLE_PNOM*(*nnoe)+1);
    00089
    00090   if (!(fn1&&fs1&&fs2&&fs3))
    00091      return -1;
    00092
    00093   ret = (med_int) MEDnoeudsLire((med_idt)*fid,(char*)fn1,(med_int)*mdim,
    00094                                 (med_float *)coo,(med_mode_switch)*modcoo,
    00095                                 (med_repere*)rep,(char*)fs1,
    00096                                 (char*)fs2,(char*)fs3,
    00097                                 (med_booleen*)&_inom,(med_int*)num,(med_booleen*)&_inum,
    00098                                 (med_int*)fam,(med_int)*nnoe);
    00099
    00100   strncpy(nomcoo,fs1,MED_TAILLE_PNOM*(*mdim));
    00101   strncpy(unicoo,fs2,MED_TAILLE_PNOM*(*mdim));
    00102   strncpy(nom   ,fs3,MED_TAILLE_PNOM*(*nnoe));
    00103   _MEDfstring(nomcoo,MED_TAILLE_PNOM*(*mdim));
    00104   _MEDfstring(unicoo,MED_TAILLE_PNOM*(*mdim));
    00105   _MEDfstring(nom   ,MED_TAILLE_PNOM*(*nnoe));
    00106   *inom=_inom;
    00107   *inum=_inum;
    00108
    00109   _MEDcstringFree(fn1);
    00110   free(fs1);
    00111   free(fs2);
    00112   free(fs3);
    00113
    00114   return ret;
    00115 }
    00116
    00117 #ifdef PPRO_NT
    00118 med_int
    00119  EDFNOEE(med_int *fid, char *maa, unsigned int bidon1,
    00120                   med_int *lon1, med_int *mdim, med_float *coo,
    00121                   med_int *modcoo,
    00122                   med_int *rep, char *nomcoo, unsigned int bidon2,
    00123                   med_int *lon2, char *unicoo, unsigned int bidon3,
    00124                   med_int *lon3,
    00125                   char *nom, unsigned int bidon4, med_int *lon4,
    00126                   med_int *inom,med_int *num,med_int *inum,
    00127                   med_int *fam,med_int *nnoe)
    00128 #else
    00129 med_int
    00130 nedfnoee(med_int *fid,char *maa,med_int *lon1,med_int *mdim,med_float *coo,
    00131          med_int *modcoo,
    00132          med_int *rep,char *nomcoo,med_int *lon2,char *unicoo,med_int *lon3,
    00133          char *nom,med_int *lon4,med_int *inom,med_int *num,med_int *inum,
    00134          med_int *fam,med_int *nnoe)
    00135 #endif
    00136 {
    00137   med_int ret;
    00138   char *fn1,*fn2,*fn3,*fn4;
    00139   med_booleen _inom=(med_booleen) *inom,_inum=(med_booleen)*inum;
    00140
    00141   fn1 = _MED2cstring((char*)maa,(int)*lon1);
    00142   fn2 = _MED1cstring((char*)nomcoo,(int)*lon2,(int)*mdim*MED_TAILLE_PNOM);
    00143   fn3 = _MED1cstring((char*)unicoo,(int)*lon3,(int)*mdim*MED_TAILLE_PNOM);
    00144   fn4 = _MED1cstring((char*)nom,(int)*lon4,(int)*nnoe*MED_TAILLE_PNOM);
    00145
    00146   if (!(fn1&&fn2&&fn3&&fn4))
    00147      return -1;
    00148
    00149   ret = (med_int) MEDnoeudsEcr((med_idt)*fid,(char*)fn1,(med_int)*mdim,
    00150                                (med_float *)coo,(med_mode_switch)*modcoo,
    00151                                (med_repere)*rep,(char*)fn2,
    00152                                (char*)fn3,(char*)fn4,(med_booleen)_inom,
    00153                                (med_int*)num,(med_booleen)_inum,
    00154                                (med_int*)fam,(med_int)*nnoe);
    00155
    00156   _MEDcstringFree(fn1);
    00157   _MEDcstringFree(fn2);
    00158   _MEDcstringFree(fn3);
    00159   _MEDcstringFree(fn4);
    00160
    00161   return ret;
    00162 }
    00163
    00164
    00165 #ifdef PPRO_NT
    00166 med_int
    00167  EDFELEE(med_int *fid, char *maa, unsigned int bidon1,
    00168                   med_int*lon1, med_int*mdim, med_int*conn,med_int *mode_switch,
    00169                   char*nom, unsigned int bidon2, med_int*lon2, med_int*inom,
    00170                   med_int *num, med_int*inum, med_int*fam, med_int*nele,
    00171                   med_int*typent,
    00172                   med_int*typgeo,med_int*typcon)
    00173 #else
    00174 med_int
    00175 nedfelee(med_int *fid,char *maa,med_int*lon1,med_int*mdim,med_int*conn,med_int *mode_switch,
    00176          char*nom,med_int*lon2,med_int*inom,
    00177          med_int *num,med_int*inum,med_int*fam,med_int*nele,med_int*typent,
    00178          med_int*typgeo,med_int*typcon)
    00179 #endif
    00180 {
    00181   med_int ret;
    00182   char *fn1,*fn2;
    00183   med_booleen _inom=(med_booleen) *inom,_inum=(med_booleen)*inum;
    00184
    00185   fn1 = _MED2cstring((char*)maa,(int)*lon1);
    00186   fn2 = _MED1cstring((char*)nom,(int)*lon2,*nele*MED_TAILLE_PNOM);
    00187
    00188   if (!(fn1&&fn2))
    00189      return -1;
    00190
    00191   ret = (med_int) MEDelementsEcr((med_idt)*fid,(char*)fn1,(med_int)*mdim,
    00192                                  (med_int*)conn,(med_mode_switch) *mode_switch,
    00193                                  (char*)fn2,(med_booleen)_inom,
    00194                                  (med_int*)num,(med_booleen)_inum,
    00195                                  (med_int*)fam,(med_int)*nele,
    00196                                  (med_entite_maillage)*typent,
    00197                                  (med_geometrie_element)*typgeo,
    00198                                  (med_connectivite)*typcon);
    00199
    00200   _MEDcstringFree(fn1);
    00201   _MEDcstringFree(fn2);
    00202
    00203   return ret;
    00204 }
    00205
    00206 #ifdef PPRO_NT
    00207 med_int
    00208  EDFELEL(med_int *fid,char *maa, unsigned int bidon1,
    00209                   med_int*lon1, med_int*mdim, med_int*conn,med_int *mode_switch,
    00210                   char*nom, unsigned int bidon2, med_int*inom,
    00211                   med_int *num, med_int*inum, med_int*fam, med_int*nele,
    00212                   med_int*typent, med_int*typgeo,med_int*typcon)
    00213 #else
    00214 med_int
    00215 nedfelel(med_int *fid,char *maa,med_int*lon1,med_int*mdim,med_int*conn,
    00216          med_int *mode_switch,
    00217          char*nom,med_int*inom,
    00218          med_int *num,med_int*inum,med_int*fam,med_int*nele,med_int*typent,
    00219          med_int*typgeo,med_int*typcon)
    00220 #endif
    00221 {
    00222   med_int ret;
    00223   char *fn1,*fs1;
    00224   med_booleen _inom=MED_FAUX,_inum=MED_FAUX;
    00225
    00226   fn1 = _MED2cstring((char*)maa,(int)*lon1);
    00227   fs1 = (char *) malloc(sizeof(char)*MED_TAILLE_PNOM*(*nele)+1);
    00228
    00229   if (!(fn1&&fs1))
    00230      return -1;
    00231
    00232   ret = (med_int) MEDelementsLire((med_idt)*fid,(char*)fn1,(med_int)*mdim,
    00233                                  (med_int*)conn,(med_mode_switch) *mode_switch,
    00234                                  (char*)fs1,(med_booleen*)&_inom,
    00235                                  (med_int*)num,(med_booleen*)&_inum,
    00236                                  (med_int*)fam,(med_int)*nele,
    00237                                  (med_entite_maillage)*typent,
    00238                                  (med_geometrie_element)*typgeo,
    00239                                  (med_connectivite)*typcon);
    00240
    00241   strncpy(nom,fs1,MED_TAILLE_PNOM*(*nele));
    00242   _MEDfstring(nom,MED_TAILLE_PNOM*(*nele));
    00243   *inom=_inom;
    00244   *inum=_inum;
    00245
    00246   _MEDcstringFree(fn1);
    00247   free(fs1);
    00248
    00249   return ret;
    00250 }
    00251
    00252
    00253 #ifdef PPRO_NT
    00254 med_int
    00255  EDFG2FC(med_int *fid, char *maa, unsigned int bidon1,med_int *lon1,
    00256                   char *groupes, unsigned int bidon2,med_int *lon2,
    00257                   med_int *index, med_int *ngroup,med_int *entites,
    00258                   med_int *nent, med_int *type_ent,med_int *type_geo,
    00259                   med_int *indexgeo, med_int *ngeo)
    00260 #else
    00261 med_int
    00262 nedfg2fc(med_int *fid, char *maa,med_int *lon1,
    00263          char *groupes,med_int *lon2,
    00264          med_int *index, med_int *ngroup,med_int *entites,
    00265          med_int *nent, med_int *type_ent,med_int *type_geo,
    00266          med_int *indexgeo, med_int *ngeo)
    00267 #endif
    00268 {
    00269   med_int ret,i;
    00270   char *fn1,*fn2;
    00271   med_geometrie_element *types = (med_geometrie_element *) malloc (*ngeo*sizeof(med_geometrie_element));
    00272
    00273   fn1 = _MED2cstring((char*)maa,(int)*lon1);
    00274   fn2 = _MED1cstring((char*)groupes,(int)*lon2,(int)*ngroup*MED_TAILLE_LNOM);
    00275
    00276   if (!(fn1&&fn2))
    00277      return -1;
    00278
    00279   for (i=0;i<*ngeo;i++)
    00280     *(types+i) = (med_geometrie_element) *(type_geo+i);
    00281
    00282   ret = (med_int) MEDgro2famCr((med_idt)*fid,(char*)fn1,
    00283                                (char*)fn2,(med_int*)index,
    00284                                (med_int)*ngroup,(med_int *)entites,
    00285                                (med_int) *nent,
    00286                                (med_entite_maillage)*type_ent,
    00287                                (med_geometrie_element *)types,
    00288                                (med_int *)indexgeo,(med_int) *ngeo);
    00289
    00290   _MEDcstringFree(fn1);
    00291   _MEDcstringFree(fn2);
    00292   free(types);
    00293
    00294   return ret;
    00295 }