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

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