# famcf.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 nedffamc F77_FUNC(edffamc,EDFFAMC)
    00026 #define nedffame F77_FUNC(edffame,EDFFAME)
    00027 #define nedffaml F77_FUNC(edffaml,EDFFAML)
    00028 #define nedffami F77_FUNC(edffami,EDFFAMI)
    00029 #define nedfnfam F77_FUNC(edfnfam,EDFNFAM)
    00030 #define nedfngro F77_FUNC(edfngro,EDFNGRO)
    00031 #define nedfnatt F77_FUNC(edfnatt,EDFNATT)
    00032
    00033
    00034 #ifdef PPRO_NT
    00035 med_int
    00036 __stdcall EDFFAMC(med_int *fid, char *maa, unsigned int bidon1, med_int *lon1,
    00037                   char *fam, unsigned int bidon2, med_int *lon2,
    00038                   med_int *num, med_int *attr_ident, med_int *attr_val,
    00039                   char *attr_desc, unsigned int bidon3,
    00040                   med_int *lon3, med_int *n_attr, char *groupe ,
    00041                   unsigned int bidon4, med_int *lon4, med_int *n_groupe)
    00042 #else
    00043 med_int
    00044 nedffamc(med_int *fid,char *maa,med_int *lon1,char *fam,med_int *lon2,
    00045          med_int *num,med_int *attr_ident,med_int *attr_val,char *attr_desc,
    00046          med_int *lon3,med_int *n_attr,char *groupe ,med_int *lon4,
    00047          med_int *n_groupe)
    00048 #endif
    00049 {
    00050
    00051
    00052   char *  name = "nedffamc";
    00053   int     dummy;
    00054   med_err fret=-1;
    00055   med_int majeur, mineur, release;
    00056   MedFuncType func;
    00057
    00058   MEDversionLire( (med_idt) *fid, &majeur, &mineur, &release );
    00059
    00060   func = _MEDversionedApi(name,majeur,mineur,release);
    00061   if ( func != (MedFuncType) NULL )
    00062     func (dummy, fid, maa, lon1, fam, lon2,
    00063           num, attr_ident, attr_val, attr_desc,
    00064           lon3, n_attr, groupe , lon4,
    00065           n_groupe , &fret);
    00066
    00067   return fret;
    00068 }
    00069
    00070 #ifdef PPRO_NT
    00071 med_int
    00072 __stdcall EDFFAME (med_int *fid, char *maa, unsigned int bidon, med_int *lon1,
    00073                    med_int *fam, med_int *n, med_int *type_ent,
    00074                    med_int *type_geo)
    00075 #else
    00076 med_int
    00077 nedffame(med_int *fid,char *maa,med_int *lon1,med_int *fam,
    00078          med_int *n, med_int *type_ent,med_int *type_geo)
    00079 #endif
    00080 {
    00081   med_int ret;
    00082   char *  fn1;
    00083
    00084   fn1 = _MED2cstring(maa, (int) * lon1);
    00085   if (!fn1 )
    00086     return(-1);
    00087
    00088   ret = (med_int) MEDfamEcr((med_idt) *fid,fn1,(med_int *)fam,
    00089                            (med_int) *n,
    00090                            (med_entite_maillage) *type_ent,
    00091                            (med_geometrie_element) *type_geo);
    00092
    00093   _MEDcstringFree(fn1);
    00094
    00095   return(ret);
    00096 }
    00097
    00098
    00099 #ifdef PPRO_NT
    00100 med_int
    00101 __stdcall EDFFAML(med_int *fid, char *maa, unsigned int bidon, med_int *lon1,
    00102                   med_int *fam, med_int *n, med_int *type_ent,
    00103                   med_int *type_geo)
    00104 #else
    00105 med_int
    00106 nedffaml(med_int *fid, char *maa, med_int *lon1, med_int *fam,
    00107          med_int *n,med_int *type_ent,med_int *type_geo)
    00108 #endif
    00109 {
    00110   med_int ret;
    00111   char *  fn1;
    00112
    00113   fn1 = _MED2cstring(maa, (int) * lon1);
    00114   if (!fn1 )
    00115     return(-1);
    00116
    00117   ret = (med_int) MEDfamLire((med_idt) *fid,fn1,(med_int*) fam,(med_int) *n,
    00118                              (med_entite_maillage) *type_ent,
    00119                              (med_geometrie_element) *type_geo);
    00120
    00121   _MEDcstringFree(fn1);
    00122
    00123   return(ret);
    00124 }
    00125
    00126
    00127 #ifdef  PPRO_NT
    00128 int
    00129 __stdcall EDFFAMI(med_int *fid, char *maa, unsigned int bidon1, med_int *lon1,
    00130                   med_int *ind, char *fam, unsigned int bidon2, med_int *num,
    00131                   med_int *attr_ident, med_int *attr_val,
    00132                   char *attr_desc, int unsigned bidon3, med_int *n_attr,
    00133                   char *groupe , int unsigned bidon4, med_int *n_groupe)
    00134 #else
    00135 med_int
    00136 nedffami(med_int *fid, char *maa,med_int *lon1,med_int *ind,
    00137          char *fam,med_int *num,med_int *attr_ident,med_int *attr_val,
    00138          char *attr_desc,med_int *n_attr,
    00139          char *groupe ,med_int *n_groupe)
    00140 #endif
    00141 {
    00142   med_int ret;
    00143   char * fn1,* fs1, * fs2;
    00144   char fs3[MED_TAILLE_NOM+1];
    00145   int natt,ngro,j;
    00146   char str[MED_TAILLE_LNOM+1];
    00147
    00148   fn1 = _MED2cstring(maa, (int) * lon1);
    00149   if (!fn1)
    00150     return(-1);
    00151
    00152   if ((ngro = MEDnGroupe  ((med_idt) *fid,fn1,*ind)) < 0) return -1;
    00153   if ((natt = MEDnAttribut((med_idt) *fid,fn1,*ind)) < 0) return -1;
    00154
    00155   fs1 = (char *) malloc(MED_TAILLE_DESC*natt+1);
    00156   fs2 = (char *) malloc(MED_TAILLE_LNOM*ngro+1);
    00157
    00158   ret = (med_int) MEDfamInfo((med_idt) *fid,fn1,(int) *ind, (char *)fs3 ,
    00159                              (med_int *)num,
    00160                              (med_int *) attr_ident,(med_int *) attr_val,
    00161                              (char *) fs1,
    00162                              (med_int *) n_attr,
    00163                              (char *)fs2 ,(med_int *) n_groupe);
    00164
    00165   strncpy(fam,fs3,MED_TAILLE_NOM);
    00166   _MEDfstring(fam,MED_TAILLE_NOM);
    00167   strncpy(attr_desc,fs1,MED_TAILLE_DESC*natt);
    00168   _MEDfstring(attr_desc,MED_TAILLE_DESC*natt);
    00169
    00170   for (j=0;j<ngro;j++) {
    00171       strncpy(str,fs2+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
    00172       _MEDfstring(str,MED_TAILLE_LNOM);
    00173       str[MED_TAILLE_LNOM] = '\0';
    00174       if (j == 0)
    00175               strcpy(groupe,str);
    00176       else
    00177               strcat(groupe,str);
    00178   }
    00179   _MEDfstring(groupe,MED_TAILLE_LNOM*ngro);
    00180   free(fs1);
    00181   free(fs2);
    00182
    00183   _MEDcstringFree(fn1);
    00184
    00185   return(ret);
    00186 }
    00187
    00188 #ifdef PPRO_NT
    00189 int
    00190 __stdcall EDFNFAM(med_int *fid, char *maa, unsigned int bidon, med_int *lon1)
    00191 #else
    00192 med_int
    00193 nedfnfam(med_int *fid,char *maa,med_int *lon1)
    00194 #endif
    00195 {
    00196   med_int ret;
    00197   char *  fn1;
    00198
    00199   fn1 = _MED2cstring(maa, (int) * lon1);
    00200   if (!fn1)
    00201     return(-1);
    00202
    00203   ret = (med_int) MEDnFam((med_idt)*fid,fn1);
    00204
    00205   _MEDcstringFree(fn1);
    00206
    00207   return(ret);
    00208 }
    00209
    00210 #ifdef PPRO_NT
    00211 int
    00212 __stdcall EDFNGRO(med_int *fid, char *maa, unsigned int bidon, med_int *lon1, med_int *indice)
    00213 #else
    00214 med_int
    00215 nedfngro(med_int *fid,char *maa,med_int *lon1,med_int *indice)
    00216 #endif
    00217 {
    00218   med_int ret;
    00219   char *  fn1;
    00220
    00221   fn1 = _MED2cstring(maa, (int) * lon1);
    00222   if (!fn1)
    00223     return(-1);
    00224
    00225   ret = (med_int) MEDnGroupe((med_idt)*fid,fn1,(int)*indice);
    00226
    00227   _MEDcstringFree(fn1);
    00228
    00229   return(ret);
    00230 }
    00231
    00232
    00233 #ifdef PPRO_NT
    00234 int
    00235 __stdcall EDFNATT(med_int *fid, char *maa, unsigned int bidon, med_int *lon1, med_int *indice)
    00236 #else
    00237 med_int
    00238 nedfnatt(med_int *fid,char *maa,med_int *lon1,med_int *indice)
    00239 #endif
    00240 {
    00241   med_int ret;
    00242   char *  fn1;
    00243
    00244   fn1 = _MED2cstring(maa, (int) * lon1);
    00245   if (!fn1)
    00246     return(-1);
    00247
    00248   ret = (med_int) MEDnAttribut((med_idt)*fid,fn1,(int)*indice);
    00249
    00250   _MEDcstringFree(fn1);
    00251
    00252   return(ret);
    00253 }
    00254
    00255
    00256
    00257
    00258