_MEDfield23nProfile236.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 <string.h>
00023 
00024 #include <2.3.6/med23v30.h>
00025 #include <2.3.6/med23v30_proto.h>
00026 #include "2.3.6/med23v30_misc.h"
00027 
00028 void
00029 _MEDfield23nProfile236(int dummy, ...) {
00030 
00031 
00032   med_int  _ret=-1,_err=-1;
00033   med_idt  _gid=0,_datagroup1=0;
00034   char     _path[(MED_TAILLE_CHA+MED_NAME_SIZE+1)+(2*MED_MAX_PARA+1)+1]=MED_CHA;
00035   char     _datagroupname1  [2*MED_TAILLE_NOM_ENTITE+2]="";
00036   char     _nomdatagroup2   [2*MED_MAX_PARA+1]         ="";
00037   char     _geotype         [MED_TAILLE_NOM_ENTITE+1]  ="";
00038   char     _profilename     [MED_NAME_SIZE+1]          ="";
00039   char     _meshname        [MED_NAME_SIZE+1]          ="";
00040   char     _localizationname[MED_NAME_SIZE+1]          ="";
00041   med_int  _numdt=0, _numit=0;
00042   med_size _n=0,_ncpst=0;
00043   med_bool _checkmultiplemesh=MED_TRUE, _multiplemesh        =MED_FALSE;
00044   med_bool _checkmeshname    =MED_TRUE,  _samedefaultmeshname=MED_FALSE;
00045   char     _tmp1         [MED_TAILLE_NOM_ENTITE+1]="";
00046 /*   med_size _rank; */
00047   int      _num;
00048 
00049 
00050   MED_VARGS_DECL(const, med_idt           , , fid                     );
00051   MED_VARGS_DECL(const, char * , const      , fieldname               );
00052   MED_VARGS_DECL(const, med_int           , , numdt                   );
00053   MED_VARGS_DECL(const, med_int           , , numit                   );
00054   MED_VARGS_DECL(const, med_entity_type   , , entitype                );
00055   MED_VARGS_DECL(const, med_geometry_type , , geotype                 );
00056   MED_VARGS_DECL(const, int               , , meshit                  );
00057   MED_VARGS_DECL(, char *, const      , meshname                      );
00058   MED_VARGS_DECL(, char *, const      , defaultprofilename            );
00059   MED_VARGS_DECL(, char *, const      , defaultlocalizationname       );
00060   MED_VARGS_DECL(, med_int *         ,, fret                          );
00061 
00062   va_list params;
00063   va_start(params,dummy);
00064 
00065   MED_VARGS_DEF(const, med_idt           , , fid                     );
00066   MED_VARGS_DEF(const, char * , const      , fieldname               );
00067   MED_VARGS_DEF(const, med_int           , , numdt                   );
00068   MED_VARGS_DEF(const, med_int           , , numit                   );
00069   MED_VARGS_DEF(const, med_entity_type   , , entitype                );
00070   MED_VARGS_DEF(const, med_geometry_type , , geotype                 );
00071   MED_VARGS_DEF(const, int               , , meshit                  );
00072   MED_VARGS_DEF(, char *, const      , meshname                      );
00073   MED_VARGS_DEF(, char *, const      , defaultprofilename            );
00074   MED_VARGS_DEF(, char *, const      , defaultlocalizationname       );
00075   MED_VARGS_DEF(, med_int *         ,, fret                          );
00076 
00077   _num = meshit -1;
00078 
00079   /*
00080    * On inhibe le gestionnaire d'erreur HDF 5
00081    */
00082   _MEDmodeErreurVerrouiller();
00083 
00084   NOFINALBLANK(fieldname,ERROR);
00085 
00086   strcat(_path,fieldname);
00087   strcat(_path,"/");
00088 
00089   if (_MEDnomEntite(_datagroupname1,entitype) < 0) {
00090     MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ENTITY,MED_ERR_VALUE_MSG);
00091     ISCRUTE_int(entitype);SSCRUTE(_path);goto ERROR;
00092   };
00093 
00094   if ((entitype != MED_NOEUD)) {
00095     if (_MEDnomGeometrie30(_tmp1,geotype) < 0) {
00096       MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_GEOMETRIC,MED_ERR_VALUE_MSG);
00097       ISCRUTE_int(geotype);SSCRUTE(_path);goto ERROR;
00098     }
00099     strcat(_datagroupname1,".");
00100     strcat(_datagroupname1,_tmp1);
00101   }
00102   strcat(_path,_datagroupname1);
00103 
00104   if ((_datagroup1 = _MEDdatagroupOuvrir(fid,_path)) < 0) {
00105     _ret = 0;
00106     goto ERROR;
00107   }
00108 
00109   strcat(_path,"/");
00110 
00111   /*TODO : Vérifier IFORMAT */
00112   sprintf(_nomdatagroup2,"%*li%*li",MED_MAX_PARA,(long ) numdt,MED_MAX_PARA,(long ) numit);
00113 
00114   strcat(_path,_nomdatagroup2);
00115 
00116 /*   if (  _MEDobjectGetRank(fid, */
00117 /*                        _path, */
00118 /*                        _rank ) < 0 ) { */
00119 /*     MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"_MEDobjectGetRank"); */
00120 /*     goto ERROR; */
00121 /*   } */
00122 
00123   if ((_gid = _MEDdatagroupOuvrir(fid,_path)) < 0) {
00124     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_ERR_FIELD_MSG);
00125     SSCRUTE(fieldname);SSCRUTE(_path); goto ERROR;
00126   }
00127   strcat(_path,"/");
00128 
00129   /*Lit l'attribut MED_NOM_NDT  */
00130   if ( _MEDattrEntierLire(_gid,MED_NOM_NDT, &_numdt) < 0) {
00131     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
00132     SSCRUTE(fieldname);SSCRUTE(_path);SSCRUTE(MED_NOM_NDT);
00133     ISCRUTE(_numdt);goto ERROR;
00134   }
00135 
00136   if ( _numdt != numdt) {
00137     MED_ERR_(_ret,MED_ERR_NOTEQUAL,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
00138     SSCRUTE(fieldname);ISCRUTE(_numdt);ISCRUTE(numdt);goto ERROR;
00139   }
00140 
00141   /*Lit l'attribut MED_NOM_NOR */
00142   if ( _MEDattrEntierLire(_gid,MED_NOM_NOR, &_numit) < 0) {
00143     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
00144     SSCRUTE(fieldname);SSCRUTE(_path);SSCRUTE(MED_NOM_NOR);
00145     ISCRUTE(_numit); goto ERROR;
00146   }
00147 
00148   if ( _numit != numit) {
00149     MED_ERR_(_ret,MED_ERR_NOTEQUAL,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
00150     SSCRUTE(fieldname);ISCRUTE(_numit);ISCRUTE(numit);goto ERROR;
00151   }
00152 
00153   /*
00154    * On recupere le nom du maillage si _num >=0 sinon il nous est donné
00155    */
00156   if ( (_num >= 0 ) )
00157     if ( _MEDobjectGetName(_gid, "." ,_num, meshname) < 0 ) {
00158       MED_ERR_(_ret,MED_ERR_ACCESS,MED_ERR_DATAGROUP,_path);ISCRUTE_int(meshit);
00159       goto ERROR;
00160     }
00161 
00162   strcat(_path,meshname);
00163 
00164   if ( _MEDattributeStringRdByName(fid, _path, MED_NOM_GAU, MED_TAILLE_NOM, _localizationname) < 0 ) {
00165     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_ATTRIBUTE, MED_ERR_NAME_MSG );
00166     SSCRUTE(MED_NOM_GAU);SSCRUTE(_localizationname);goto ERROR;
00167   }
00168 
00169   if ( ! strcmp(_localizationname,MED_NOGAUSSi))
00170     strcpy(defaultlocalizationname,MED_NO_LOCALIZATION);
00171   else
00172     strcpy(defaultlocalizationname,_localizationname);
00173 
00174 
00175   if ( _MEDattributeStringRdByName(fid, _path, MED_NOM_PFL, MED_TAILLE_NOM, _profilename) < 0 ) {
00176     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_ATTRIBUTE, MED_ERR_NAME_MSG );
00177     SSCRUTE(MED_NOM_PFL);SSCRUTE(_profilename);goto ERROR;
00178   }
00179 
00180   if ( strcmp(_profilename,MED_NOPFLi) &&
00181        strcmp(_profilename,"") ) /* le test MED_NOPFLi pour des raisons de compatibilité */
00182     {
00183       strcpy(defaultprofilename,_profilename);
00184     }  else {
00185     strcpy(defaultprofilename, MED_NO_PROFILE);
00186   }
00187 
00188 
00189   _ret = (med_int) 1;
00190 
00191  ERROR:
00192 
00193 
00194   if (_datagroup1>0)            if (_MEDdatagroupFermer(_datagroup1) < 0) {
00195     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_path);
00196     SSCRUTE(_datagroupname1); ISCRUTE_id(_datagroup1);
00197   }
00198 
00199   if (_gid>0)            if (_MEDdatagroupFermer(_gid) < 0) {
00200     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_path);
00201     ISCRUTE_id(_gid);
00202   }
00203 
00204   va_end(params);
00205   *fret = _ret;
00206   return;
00207 }

Généré le Mon Nov 7 16:21:23 2011 pour MED fichier par  doxygen 1.6.1