# jntcf.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 #define nedfjntc F77_FUNC(edfjntc,EDFJNTC)
    00026 #define nedfnjnt F77_FUNC(edfnjnt,EDFNJNT)
    00027 #define nedfjnti F77_FUNC(edfjnti,EDFJNTI)
    00028 #define nedfjnte F77_FUNC(edfjnte,EDFJNTE)
    00029 #define nedfjntl F77_FUNC(edfjntl,EDFJNTL)
    00030 #define nedfjnco F77_FUNC(edfjnco,EDFJNCO)
    00031 #define nedfjtco F77_FUNC(edfjtco,EDFJTCO)
    00032 #define nedfgnme F77_FUNC(edfgnme,EDFGNME)
    00033 #define nedfgnml F77_FUNC(edfgnml,EDFGNML)
    00034
    00035 /* creation d'un joint */
    00036
    00037 #ifdef PPRO_NT
    00038 med_int
    00039 __stdcall EDFJNTC (med_int *fid,
    00040                    char *maa_lcl,  unsigned int bidon1, med_int *lon1,
    00041                    char *jn,   unsigned int bidon2, med_int *lon2,
    00042                    char *desc, unsigned int bidon3, med_int *lon3,
    00043                    med_int *dom,
    00044                    char *maa_dist,  unsigned int bidon4, med_int *lon4
    00045                    )
    00046 #else
    00047 med_int
    00048 nedfjntc (med_int *fid,
    00049           char *maa_lcl,med_int *lon1,
    00050           char *jn,med_int *lon2,
    00051           char *desc, med_int *lon3,
    00052           med_int *dom,
    00053           char *maa_dist, med_int *lon4
    00054           )
    00055 #endif
    00056 {
    00057   med_int ret;
    00058   char *fn1, *fn2, *fn3, *fn4;
    00059
    00060   fn1 = _MED2cstring(maa_lcl, (int) * lon1);
    00061   fn2 = _MED2cstring(jn,  (int) * lon2);
    00062   fn3 = _MED1cstring(desc, (int) * lon3,MED_TAILLE_DESC);
    00063   fn4 = _MED2cstring(maa_dist, (int) * lon4);
    00064
    00065   if (!fn1 || !fn2 || !fn3 || !fn4)
    00066     return(-1);
    00067
    00068   ret = (med_int) MEDjointCr((med_idt) *fid,
    00069                              (char *)fn1,(char *)fn2,
    00070                              (char *)fn3,(med_int) *dom,
    00071                              (char *)fn4);
    00072
    00073   _MEDcstringFree(fn1);
    00074   _MEDcstringFree(fn2);
    00075   _MEDcstringFree(fn3);
    00076   _MEDcstringFree(fn4);
    00077
    00078   return(ret);
    00079 }
    00080
    00081
    00082
    00083 /* Lecture du nombre de joints dans un maillage */
    00084
    00085 #ifdef PPRO_NT
    00086 med_int
    00087 __stdcall EDFNJNT (med_int *fid,
    00088                    char *maa_lcl,  unsigned int bidon1, med_int *lon1,
    00089                    med_int *n
    00090                    )
    00091 #else
    00092 med_int
    00093 nedfnjnt (med_int *fid,
    00094           char *maa_lcl,med_int *lon1,
    00095           med_int *n
    00096           )
    00097 #endif
    00098 {
    00099   char *fn1;
    00100
    00101   fn1 = _MED2cstring(maa_lcl, (int) * lon1);
    00102
    00103
    00104   if (!fn1)
    00105     return(-1);
    00106
    00107   *n = (med_int) MEDnJoint((med_idt) *fid,
    00108                            (char *)fn1);
    00109
    00110   _MEDcstringFree(fn1);
    00111
    00112   return(*n);
    00113 }
    00114
    00115
    00116 /* Lecture des informations relatives à un joint */
    00117
    00118
    00119 #ifdef PPRO_NT
    00120 med_int
    00121 __stdcall EDFJNTI (med_int *fid,
    00122                    char *maa_lcl,  unsigned int bidon1, med_int *lon1,
    00123                    med_int *ind,
    00124                    char *jn,
    00125                    char *desc,
    00126                    med_int *dom,
    00127                    char *maa_dist
    00128                    )
    00129 #else
    00130 med_int
    00131 nedfjnti (med_int *fid,
    00132           char *maa_lcl,med_int *lon1,
    00133           med_int *ind,
    00134           char *jn,
    00135           char *desc,
    00136           med_int *dom,
    00137           char *maa_dist
    00138           )
    00139 #endif
    00140 {
    00141   med_int ret;
    00142   char *fn1;
    00143   char fs1[MED_TAILLE_NOM+1];   /* nom du joint OUT */
    00144   char fs2[MED_TAILLE_DESC+1];  /* nom de la description   OUT */
    00145   char fs3[MED_TAILLE_NOM+1];   /* nom du maillage distant OUT */
    00146
    00147
    00148   /* nom maillage IN */
    00149   fn1 = _MED2cstring(maa_lcl, (int) * lon1);
    00150
    00151   if (!fn1)
    00152     return(-1);
    00153
    00154   ret = (med_int) MEDjointInfo((med_idt) *fid,
    00155                                (char *)   fn1,     /* maillage local IN */
    00156                                (med_int) *ind,      /* indice du joint dans le maillage IN */
    00157                                (char *)fs1,        /* nom joint OUT */
    00158                                (char *)fs2,        /* desc joint OUT */
    00159                                (med_int * ) dom,   /* numero ss domaine distant OUT */
    00160                                (char *)fs3);        /* nom maillage distant OUT */
    00161
    00162   strncpy(jn,fs1,MED_TAILLE_NOM);
    00163   _MEDfstring(jn,MED_TAILLE_NOM);
    00164   strncpy(desc,fs2,MED_TAILLE_DESC);
    00165   _MEDfstring(desc,MED_TAILLE_DESC);
    00166   strncpy(maa_dist,fs3,MED_TAILLE_NOM);
    00167   _MEDfstring(maa_dist,MED_TAILLE_NOM);
    00168
    00169
    00170   _MEDcstringFree(fn1);
    00171
    00172
    00173   return(ret);
    00174 }
    00175
    00176
    00177
    00178
    00179
    00180
    00181
    00182 /* ecriture du contenu d'une correspondance */
    00183
    00184 #ifdef PPRO_NT
    00185 med_int
    00186 __stdcall EDFJNTE (med_int *fid,
    00187                    char *maa_local,unsigned int bidon1, med_int *lon1,
    00188                    char *jn,     unsigned int bidon2, med_int *lon2,
    00189                    med_int *corrtab, med_int *n,
    00190                    med_int * typ_ent_local, med_int * typ_geo_local,
    00191                    med_int * typ_ent_distant, med_int * typ_geo_distant)
    00192 #else
    00193 med_int
    00194 nedfjnte (med_int *fid,
    00195           char *maa_local,med_int *lon1,
    00196           char *jn,med_int *lon2,
    00197           med_int *corrtab, med_int *n,
    00198           med_int * typ_ent_local, med_int * typ_geo_local,
    00199           med_int * typ_ent_distant, med_int * typ_geo_distant)
    00200 #endif
    00201 {
    00202   med_int ret;
    00203   char *fn1, *fn2;
    00204
    00205   fn1 = _MED2cstring(maa_local, (int) *lon1);
    00206   fn2 = _MED2cstring(jn,  (int) *lon2);
    00207
    00208   if (!fn1 || !fn2)
    00209     return(-1);
    00210
    00211   ret = (med_int) MEDjointEcr((med_idt) *fid, (char *)fn1, (char *) fn2,  (med_int *) corrtab, (med_int) *n,
    00212                                   (med_entite_maillage) *typ_ent_local,   (med_geometrie_element) *typ_geo_local,
    00213                                   (med_entite_maillage) *typ_ent_distant, (med_geometrie_element) *typ_geo_distant);
    00214
    00215   _MEDcstringFree(fn1);
    00216   _MEDcstringFree(fn2);
    00217
    00218   return(ret);
    00219 }
    00220
    00221
    00222 /* lecture du contenu d'une correspondance */
    00223
    00224
    00225 #ifdef PPRO_NT
    00226 med_int
    00227 __stdcall EDFJNTL (med_int *fid,
    00228                    char *maa_local,unsigned int bidon1, med_int *lon1,
    00229                    char *jn,     unsigned int bidon2, med_int *lon2,
    00230                    med_int *corrtab, med_int *n,
    00231                    med_int * typ_ent_local, med_int * typ_geo_local,
    00232                    med_int * typ_ent_distant, med_int * typ_geo_distant)
    00233 #else
    00234 med_int
    00235 nedfjntl (med_int *fid,
    00236           char *maa_local,med_int *lon1,
    00237           char *jn,med_int *lon2,
    00238           med_int *corrtab, med_int *n,
    00239           med_int * typ_ent_local, med_int * typ_geo_local,
    00240           med_int * typ_ent_distant, med_int * typ_geo_distant)
    00241 #endif
    00242 {
    00243   med_int ret;
    00244   char *fn1, *fn2;
    00245
    00246   fn1 = _MED2cstring(maa_local, (int) * lon1);
    00247   fn2 = _MED2cstring(jn,  (int) * lon2);
    00248
    00249   if (!fn1 || !fn2 )
    00250     return(-1);
    00251
    00252   ret = (med_int) MEDjointLire((med_idt) *fid, (char *)fn1, (char *) fn2, (med_int *) corrtab, (med_int) *n,
    00253                                (med_entite_maillage) *typ_ent_local,   (med_geometrie_element) *typ_geo_local,
    00254                                (med_entite_maillage) *typ_ent_distant, (med_geometrie_element) *typ_geo_distant);
    00255
    00256   _MEDcstringFree(fn1);
    00257   _MEDcstringFree(fn2);
    00258
    00259   return(ret);
    00260 }
    00261
    00262
    00263
    00264
    00265 /* Lecture du nombre de correspondances pour deux types en regard dans   un joint */
    00266
    00267
    00268 #ifdef PPRO_NT
    00269 med_int
    00270 __stdcall EDFJNCO (med_int *fid,
    00271                    char *maa_lcl,  unsigned int bidon1, med_int *lon1,
    00272                    char *jn,   unsigned int bidon2, med_int *lon2,
    00273                    med_int * typ_ent_local, med_int * typ_geo_local,
    00274                    med_int * typ_ent_distant, med_int * typ_geo_distant
    00275                    )
    00276 #else
    00277 med_int
    00278 nedfjnco (med_int *fid,
    00279           char *maa_lcl,med_int *lon1,
    00280           char *jn, med_int *lon2,
    00281           med_int * typ_ent_local, med_int * typ_geo_local,
    00282           med_int * typ_ent_distant, med_int * typ_geo_distant
    00283           )
    00284 #endif
    00285 {
    00286   med_int ret;
    00287   char *fn1;
    00288   char *fn2;                   /* nom joint IN */
    00289
    00290
    00291   /* nom maillage IN */
    00292   fn1 = _MED2cstring(maa_lcl, (int) * lon1);
    00293
    00294   /* nom joint IN */
    00295   fn2 = _MED2cstring(jn, (int) * lon2);
    00296
    00297   if (!fn1)
    00298     return(-1);
    00299
    00300   ret = (med_int) MEDjointnCorres((med_idt) *fid,
    00301                                   (char *)   fn1,     /* maillage local IN */
    00302                                   (char *)   fn2,    /* nom du joint IN */
    00303                                   (med_entite_maillage)   *typ_ent_local,
    00304                                   (med_geometrie_element) *typ_geo_local,
    00305                                   (med_entite_maillage)   *typ_ent_distant,
    00306                                   (med_geometrie_element) *typ_geo_distant
    00307                                   );
    00308
    00309
    00310
    00311   _MEDcstringFree(fn1);
    00312   _MEDcstringFree(fn2);
    00313
    00314
    00315   return(ret);
    00316 }
    00317
    00318
    00319
    00320
    00321
    00322
    00323
    00324 /* Lecture du type des elements en regard dans un joint */
    00325
    00326
    00327 #ifdef PPRO_NT
    00328 med_int
    00329 __stdcall EDFJTCO (med_int *fid,
    00330                    char *maa_lcl,  unsigned int bidon1, med_int *lon1,
    00331                    char *jn,   unsigned int bidon2, med_int *lon2,
    00332                    int *ind,
    00333                    med_int * typ_ent_local, med_int * typ_geo_local,
    00334                    med_int * typ_ent_distant, med_int * typ_geo_distant
    00335                    )
    00336 #else
    00337 med_int
    00338 nedfjtco (med_int *fid,
    00339           char *maa_lcl,med_int *lon1,
    00340           char *jn, med_int *lon2,
    00341           int *ind,
    00342           med_int * typ_ent_local,   med_int * typ_geo_local,
    00343           med_int * typ_ent_distant, med_int * typ_geo_distant
    00344           )
    00345 #endif
    00346 {
    00347   med_int ret;
    00348   char *fn1;
    00349   char *fn2;            /* nom joint IN */
    00350   med_entite_maillage   _typ_ent_local;
    00351   med_geometrie_element _typ_geo_local;
    00352   med_entite_maillage   _typ_ent_distant;
    00353   med_geometrie_element _typ_geo_distant;
    00354
    00355   /* nom maillage IN */
    00356   fn1 = _MED2cstring(maa_lcl, (int) * lon1);
    00357
    00358   /* nom joint IN */
    00359   fn2 = _MED2cstring(jn, (int) * lon2);
    00360
    00361   if (!fn1) return(-1);
    00362
    00363   ret = (med_int) MEDjointTypeCorres((med_idt) *fid,
    00364                                      (char *)   fn1,    /* maillage local IN */
    00365                                      (char *)   fn2,    /* nom du joint IN */
    00366                                      (int) *ind,        /* numero de la correspondance  IN*/
    00367                                      &_typ_ent_local,   /* type entite local OUT */
    00368                                      &_typ_geo_local,   /* type geometrie local OUT */
    00369                                      &_typ_ent_distant, /* type entite distant OUT */
    00370                                      &_typ_geo_distant  /* type geometrie distant OUT */
    00371                                   );
    00372    *typ_ent_local = (med_int) _typ_ent_local;
    00373    *typ_geo_local = (med_int) _typ_geo_local;
    00374    *typ_ent_distant = (med_int) _typ_ent_distant;
    00375    *typ_geo_distant = (med_int) _typ_geo_distant;
    00376
    00377   _MEDcstringFree(fn1);
    00378   _MEDcstringFree(fn2);
    00379
    00380
    00381   return(ret);
    00382
    00383 }
    00384
    00385
    00386 /* ecriture d'une numerotation globale */
    00387
    00388 #ifdef PPRO_NT
    00389 med_int
    00390 __stdcall EDFGNME (med_int *fid,
    00391                    char *maa, unsigned int bidon1, med_int *lon1,
    00392                    med_int *numtab, med_int *n,
    00393                    med_int * typ_ent, med_int * typ_geo)
    00394 #else
    00395 med_int
    00396 nedfgnme (med_int *fid,
    00397           char *maa,med_int *lon1,
    00398           med_int *numtab, med_int *n,
    00399           med_int * typ_ent, med_int * typ_geo)
    00400
    00401 #endif
    00402 {
    00403   med_int ret;
    00404   char *fn1;
    00405
    00406   fn1 = _MED2cstring(maa, (int) * lon1);
    00407
    00408   if (!fn1 )
    00409     return(-1);
    00410
    00411   ret = (med_int) MEDglobalNumEcr((med_idt) *fid, (char *)fn1,
    00412                                   (med_int *) numtab, (med_int) *n,
    00413                                   (med_entite_maillage) *typ_ent,   (med_geometrie_element) *typ_geo);
    00414
    00415   _MEDcstringFree(fn1);
    00416
    00417   return(ret);
    00418 }
    00419
    00420
    00421
    00422 /* lecture d'une numerotation globale */
    00423
    00424 #ifdef PPRO_NT
    00425 med_int
    00426 __stdcall EDFGNML (med_int *fid,
    00427                    char *maa, unsigned int bidon1, med_int *lon1,
    00428                    med_int *numtab, med_int *n,
    00429                    med_int * typ_ent, med_int * typ_geo)
    00430 #else
    00431 med_int
    00432 nedfgnml (med_int *fid,
    00433           char *maa,med_int *lon1,
    00434           med_int *numtab, med_int *n,
    00435           med_int * typ_ent, med_int * typ_geo)
    00436
    00437 #endif
    00438 {
    00439   med_int ret;
    00440   char *fn1;
    00441
    00442   fn1 = _MED2cstring(maa, (int) * lon1);
    00443
    00444   if (!fn1 )
    00445     return(-1);
    00446
    00447   ret = (med_int) MEDglobalNumLire((med_idt) *fid, (char *)fn1,
    00448                                   (med_int *) numtab, (med_int) *n,
    00449                                   (med_entite_maillage) *typ_ent,   (med_geometrie_element) *typ_geo);
    00450
    00451   _MEDcstringFree(fn1);
    00452
    00453   return(ret);
    00454 }
    00455
    00456
    00457
    00458
    00459