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

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