_MEDfield23ComputingStepMeshInfo236.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 _MEDfield23ComputingStepMeshInfo236(int dummy,...)
00030 {
00031 
00032 
00033   med_err   _ret=-1,_err=0;
00034   med_size  _num,_nmesh=0;
00035 
00036   med_idt   _datagroup1=0,_meshgid=0,_linkgid=0;
00037   char      _datagroupname1[2*MED_MAX_PARA+1]         ="";
00038   char      _ent_geo       [2*MED_TAILLE_NOM_ENTITE+2]="";
00039   char      _path          [(MED_TAILLE_CHA+MED_TAILLE_NOM+1)+
00040                             (2*MED_TAILLE_NOM_ENTITE+1)+1+(2*MED_MAX_PARA)+1]=MED_CHA;
00041   char     _meshpath [MED_TAILLE_MAA+MED_TAILLE_NOM+1]=MED_MAA;
00042   char     _linkpath [MED_TAILLE_LIENS+MED_TAILLE_NOM+1]=MED_LIENS;
00043   med_size _ncpst=0;
00044   med_bool _checkmultiplemesh=MED_TRUE, _multiplemesh       =MED_FALSE;
00045   med_bool _checkmeshname    =MED_TRUE, _samedefaultmeshname=MED_FALSE;
00046 
00047 
00048   MED_VARGS_DECL(const, med_idt       , , fid       );
00049   MED_VARGS_DECL(const, char * , const  , fieldname );
00050   MED_VARGS_DECL(const, int           , , csit      );
00051   MED_VARGS_DECL(, med_int *, const     , numdt     );
00052   MED_VARGS_DECL(, med_int *, const     , numit     );
00053   MED_VARGS_DECL(, med_float *, const   , dt        );
00054   MED_VARGS_DECL(, med_int *, const     , nmesh     );
00055   MED_VARGS_DECL(, char *, const        , meshname  );
00056   MED_VARGS_DECL(, med_bool *, const    , localmesh );
00057   MED_VARGS_DECL(, med_int *, const     , meshnumdt );
00058   MED_VARGS_DECL(, med_int *, const     , meshnumit );
00059   MED_VARGS_DECL(, med_err *           ,, fret      );
00060 
00061   va_list params;
00062   va_start(params,dummy);
00063 
00064   MED_VARGS_DEF(const, med_idt       , , fid       );
00065   MED_VARGS_DEF(const, char * , const  , fieldname );
00066   MED_VARGS_DEF(const, int           , , csit      );
00067   MED_VARGS_DEF(, med_int *, const     , numdt     );
00068   MED_VARGS_DEF(, med_int *, const     , numit     );
00069   MED_VARGS_DEF(, med_float *, const   , dt        );
00070   MED_VARGS_DEF(, med_int *, const     , nmesh     );
00071   MED_VARGS_DEF(, char *, const        , meshname  );
00072   MED_VARGS_DEF(, med_bool *, const    , localmesh );
00073   MED_VARGS_DEF(, med_int *, const     , meshnumdt );
00074   MED_VARGS_DEF(, med_int *, const     , meshnumit );
00075   MED_VARGS_DEF(, med_err *           ,, fret      );
00076 
00077   _num=csit-1;
00078 
00079   /*
00080    * On inhibe le gestionnaire d'erreur HDF 5
00081    */
00082   _MEDmodeErreurVerrouiller();
00083 
00084   /*
00085    * On construit le nom du datagroup
00086    */
00087   strcat(_path,fieldname);
00088 
00089 /*   if ( _MEDfieldComputingStepCheck236(fid,  fieldname, */
00090 /*                                    &_ncpst, */
00091 /*                                    _checkmultiplemesh, &_multiplemesh, */
00092 /*                                    _checkmeshname,     &_samedefaultmeshname) < 0) { */
00093 /*     MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_FIELD,fieldname); */
00094 /*     goto ERROR; */
00095 /*   } */
00096 
00097 /*
00098  * On suppose que le modèle 2.3.6 est respecté :
00099  * Il y a les mêmes séquences de calcul pour tous les couples
00100  * (typent,typegeo). Autrement dit selon l'utilisation de l'API 2.3.6 :
00101  * A chaque séquence de calcul, on utilise le même ensemble de (typent,typegeo).
00102  * En conséquence si l'on fixe le (typeent,typegeo) les séquences
00103  * de calcul que l'on va trouver seront représentatives de celles
00104  * présentent dans tous les (typent,typegeo) utilisés.
00105  */
00106   if ( _MEDobjectGetName(fid, _path ,0, _ent_geo) < 0 ) {
00107     MED_ERR_(_ret,MED_ERR_ACCESS,MED_ERR_DATAGROUP,_path);
00108     SSCRUTE(_path); SSCRUTE(_ent_geo); goto ERROR;
00109   }
00110 
00111   strcat(_path,"/");
00112   strcat(_path,_ent_geo);
00113 
00114   if ( _MEDobjectGetName(fid, _path ,_num, _datagroupname1) < 0 ) {
00115     MED_ERR_(_ret,MED_ERR_ACCESS,MED_ERR_DATAGROUP,_path);
00116     SSCRUTE(_path); SSCRUTE(_ent_geo); goto ERROR;
00117   }
00118 
00119   strcat(_path,"/");
00120   strcat(_path,_datagroupname1);
00121 
00122   if ((_datagroup1 = _MEDdatagroupOuvrir(fid,_path)) < 0) {
00123     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_path);
00124     goto ERROR;
00125   }
00126 
00127 
00128   /*
00129    * Lecture des attributs
00130    */
00131 
00132   if (_MEDattrEntierLire(_datagroup1,MED_NOM_NDT,(med_int*) numdt) < 0) {
00133     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_NOM_NDT);
00134     SSCRUTE(_path);ISCRUTE(*numdt);goto ERROR;
00135   }
00136 
00137   if (_MEDattrFloatLire(_datagroup1,MED_NOM_PDT,(med_float*) dt) < 0) {
00138     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_NOM_PDT);
00139     SSCRUTE(_path);RSCRUTE(*dt);goto ERROR;
00140   }
00141 
00142   if (_MEDattrEntierLire(_datagroup1,MED_NOM_NOR,(med_int*) numit) < 0) {
00143     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_NOM_NOR);
00144     SSCRUTE(_path);ISCRUTE(*numit);goto ERROR;
00145   }
00146 
00147   if (_MEDattrStringLire(_datagroup1,MED_NOM_MAI,MED_TAILLE_NOM,meshname) < 0) {
00148     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_NOM_MAI);
00149     SSCRUTE(_path);SSCRUTE(meshname);goto ERROR;
00150   }
00151 
00152 
00153   /* Nombre de maillages
00154    * La gestion d'une incohérence sur le nombre de séquences de calcul par couple (entitytype,geotype)
00155    * se fait à partir des appels :
00156    *  MEDfieldnProfile,MEDfieldnValue*
00157    * La vérification complémentaire que l'ensemble des maillages utilisés sont les mêmes pour toutes les séquences
00158    * de calcul identiques est effectué dans MEDfield23nValue
00159    */
00160   if ( (_err=_MEDnObjects(_datagroup1,".",&_nmesh)) <0)
00161     if ( _err == (MED_ERR_COUNT + MED_ERR_DATAGROUP) ) {
00162       MED_ERR_(_ret,MED_ERR_COUNT,MED_ERR_DATAGROUP,_path);
00163       goto ERROR;
00164     }
00165   *nmesh = (med_int) _nmesh;
00166 
00167 
00168   /* Maillage local ou distant */
00169   strcat(_meshpath,meshname);
00170 
00171   /* Le maillage est il distant */
00172   if ( (_meshgid = _MEDdatagroupOuvrir(fid,_meshpath)) < 0)  {
00173 
00174     /* Verifie que le maillage est bien référencé comme distant */
00175     strcat(_linkpath,meshname);
00176     if ((_linkgid = _MEDdatagroupOuvrir(fid,_linkpath)) < 0) {
00177 /*       MED_ERR_(_ret,MED_ERR_DOESNTEXIST,MED_ERR_MESH,MED_ERR_FIELD_MSG); */
00178 /*       SSCRUTE(fieldname);SSCRUTE(_meshpath);SSCRUTE(_linkpath); */
00179 /*       goto ERROR; */
00180       *localmesh = MED_FALSE;
00181     }
00182     *localmesh = MED_FALSE;
00183   } else
00184     *localmesh = MED_TRUE;
00185 
00186   *meshnumdt=MED_NO_DT;
00187   *meshnumit=MED_NO_IT;
00188 
00189   _ret = 0;
00190 
00191  ERROR:
00192 
00193   if (_datagroup1>0)            if (_MEDdatagroupFermer(_datagroup1) < 0) {
00194     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_path);
00195     ISCRUTE_id(_datagroup1);
00196   }
00197 
00198   if (_meshgid>0)            if (_MEDdatagroupFermer(_meshgid) < 0) {
00199     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_meshpath);
00200     ISCRUTE_id(_meshgid);
00201   }
00202 
00203   if (_linkgid>0)            if (_MEDdatagroupFermer(_linkgid) < 0) {
00204     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_linkpath);
00205     ISCRUTE_id(_linkgid);
00206   }
00207 
00208   va_end(params);
00209   *fret = _ret;
00210   return;
00211 
00212 }

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