00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 #include <med.h>
00020 #include <med_config.h>
00021 #include <med_outils.h>
00022 #include <hdf5.h>
00023 #include <string.h>
00024 
00040 med_err
00041 MEDinterpInfoByName(const med_idt                   fid,
00042                     const char*               const interpname,
00043                            med_geometry_type*       geotype,
00044                            med_bool*          const cellnode,
00045                            med_int*           const nbasisfunc,
00046                            med_int*           const nvariable,
00047                            med_int*           const maxdegree,
00048                            med_int*           const nmaxcoef
00049             )
00050 {
00051   med_idt           _interpid=0;
00052   med_int           _err=-1;
00053   med_err           _ret=-1;
00054   char              _path[MED_TAILLE_INTERP+MED_NAME_SIZE+1]=MED_INTERP;
00055   med_int           _cellnode = 0;
00056   med_size          _tmpn=0;
00057   med_int           _medintgeotype=MED_UNDEF_GEOTYPE;
00058 
00059   
00060 
00061 
00062   _MEDmodeErreurVerrouiller();
00063 
00064 
00065   NOFINALBLANK(interpname,ERROR);
00066   strcat(_path,interpname);
00067   
00068 
00069 
00070   if ((_interpid = _MEDdatagroupOpen(fid,_path)) < 0) {
00071     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,interpname);
00072     SSCRUTE(_path);goto ERROR;
00073   }
00074 
00075   
00076 
00077 
00078   if ( _MEDattrEntierLire(_interpid,MED_NOM_GEO,&_medintgeotype) < 0 ) {
00079     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,_path);
00080     SSCRUTE(MED_NOM_GEO);ISCRUTE(_medintgeotype);
00081     goto ERROR;
00082   }
00083   *geotype=(med_geometry_type) _medintgeotype;
00084 
00085   
00086 
00087 
00088   if ( _MEDattrEntierLire(_interpid,MED_NOM_NBV,nvariable) < 0 ) {
00089     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,_path);
00090     SSCRUTE(MED_NOM_NBV);ISCRUTE(*nvariable);
00091     goto ERROR;
00092   }
00093 
00094   
00095 
00096 
00097   if ( _MEDattrEntierLire(_interpid,MED_NOM_MDG,maxdegree) < 0 ) {
00098     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,_path);
00099     SSCRUTE(MED_NOM_MDG);ISCRUTE(*maxdegree);
00100     goto ERROR;
00101   }
00102 
00103   
00104 
00105 
00106   if ( _MEDattrEntierLire(_interpid,MED_NOM_MCF,nmaxcoef) < 0 ) {
00107     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,_path);
00108     SSCRUTE(MED_NOM_MCF);ISCRUTE(*nmaxcoef);
00109     goto ERROR;
00110   }
00111 
00112   
00113 
00114 
00115   if ( _MEDattrEntierLire(_interpid,MED_NOM_FCN,&_cellnode) < 0 ) {
00116     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,_path);
00117     SSCRUTE(MED_NOM_FCN);ISCRUTE(_cellnode);
00118     goto ERROR;
00119   }
00120   if (_cellnode) *cellnode=MED_TRUE; else *cellnode=MED_FALSE;
00121 
00122   
00123 
00124 
00125 
00126 
00127 
00128 
00129 
00130 
00131   
00132 
00133 
00134   if ((_err=_MEDnObjects(fid,_path,&_tmpn)) <0)
00135     if ( _err == (MED_ERR_COUNT + MED_ERR_DATAGROUP) ) {
00136       MED_ERR_(_ret,MED_ERR_COUNT,MED_ERR_INTERP,_path);
00137       goto ERROR;
00138     }
00139   *nbasisfunc = (med_int) _tmpn;
00140 
00141   _ret = 0;
00142 
00143  ERROR:
00144 
00145   if (_interpid>0)     if (_MEDdatagroupFermer(_interpid) < 0) {
00146     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_path);
00147     ISCRUTE_id(_interpid);
00148   }
00149   return _ret;
00150 
00151 }