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

Généré le Mon May 16 17:10:22 2011 pour MED fichier par  doxygen 1.6.1