_MEDmeshEntityInfo236.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 <string.h>
00022 #include <stdlib.h>
00023 #include <med_outils.h>
00024 
00025 #include <2.3.6/med23v30.h>
00026 #include <2.3.6/med23v30_proto.h>
00027 #include "2.3.6/med23v30_misc.h"
00028 
00029 void
00030 _MEDmeshEntityInfo236(int dummy, ...) {
00031 
00032   va_list params;
00033   va_start(params,dummy);
00034 
00035   const med_idt                   fid         = va_arg(params,const med_idt                    );
00036   const char *              const meshname    = 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 int                       geotypeit   = va_arg(params,const int                        );
00041         char              * const geotypename = va_arg(params,      char              * const  );
00042         med_geometry_type * const geotype     = va_arg(params,      med_geometry_type * const  );
00043         med_err  *                fret        = va_arg(params, med_err *);
00044 
00045   med_access_mode       _MED_ACCESS_MODE;
00046   med_int               _ret=-1;
00047   med_idt               _meshid=0, _datagroup2=0,_datagroup3=0;
00048   char                  _meshpath         [MED_TAILLE_SUP_MAA+MED_NAME_SIZE+1]=MED_MAA;
00049   char                  _datagroupname2   [MED_TAILLE_NOM_ENTITE+1]="";
00050   char                  _datagroupname3   [MED_TAILLE_NOM_ENTITE+1]="";
00051 
00052   int                   _num        = geotypeit -1;
00053 
00054   /*
00055    * On inhibe le gestionnaire d'erreur HDF 5
00056    */
00057   _MEDmodeErreurVerrouiller();
00058 
00059   if ( (_MED_ACCESS_MODE = _MEDmodeAcces(fid) ) == MED_ACC_UNDEF ) {
00060     MED_ERR_(_ret,MED_ERR_UNRECOGNIZED,MED_ERR_ACCESSMODE,MED_ERR_FILE_MSG);
00061     goto ERROR;
00062   }
00063 
00064   /*
00065    * Ouverture du datagroup de niveau 1 <_meshpath>/<meshname>
00066    */
00067   NOFINALBLANK(meshname,ERROR);
00068   strcat(_meshpath,meshname);
00069   if ((_meshid = _MEDdatagroupOuvrir(fid,_meshpath)) < 0) {
00070     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_meshpath);
00071     ISCRUTE_id(_meshid);goto ERROR;
00072   }
00073 
00074   /*
00075    *  Ouverture du datagroup de niveau 3 <entitype>
00076    */
00077   if (_MEDgetEntityTypeName(_datagroupname2,entitype) < 0) {
00078     MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ENTITY,MED_ERR_VALUE_MSG);
00079     ISCRUTE_int(entitype);SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);goto ERROR;
00080   }
00081 
00082   if ((_datagroup2 = _MEDdatagroupOuvrir(_meshid,_datagroupname2)) < 0) {
00083     MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_ERR_MESH_MSG);
00084     SSCRUTE(meshname);ISCRUTE(numit);ISCRUTE(numdt);SSCRUTE(_datagroupname2);
00085     goto ERROR;
00086   }
00087 
00088   if ( entitype == MED_NODE ) {
00089     if ( _num ) {
00090       MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ENTITY,"");
00091       ISCRUTE_int(entitype);ISCRUTE_int(geotypeit);
00092       goto ERROR;
00093     } else {
00094       *geotype = MED_UNDEF_GEOMETRY_TYPE;
00095       *geotypename='\0';
00096     }
00097   } else {
00098 
00099     /*
00100      * On recupere le nom du type géométrique
00101      */
00102     if ( _MEDobjectGetName(_datagroup2, "." ,_num, _datagroupname3) < 0 ) {
00103       MED_ERR_(_ret,MED_ERR_ACCESS,MED_ERR_DATAGROUP,_datagroupname3);
00104       ISCRUTE_int(geotypeit);
00105       goto ERROR;
00106     }
00107 
00108     strncpy(geotypename,_datagroupname3,MED_TAILLE_NOM_ENTITE+1);
00109 
00110     *geotype =  MEDgetGeometryTypeFromName(geotypename);
00111 
00112   }
00113 
00114   _ret = 0;
00115 
00116  ERROR:
00117 
00118   if (_datagroup3>0)     if (_MEDdatagroupFermer(_datagroup3) < 0) {
00119     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_datagroupname3);
00120     ISCRUTE_id(_datagroup3);
00121   }
00122 
00123   if (_datagroup2>0)     if (_MEDdatagroupFermer(_datagroup2) < 0) {
00124     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_datagroupname2);
00125     ISCRUTE_id(_datagroup2);
00126   }
00127 
00128   if (_meshid>0)            if (_MEDdatagroupFermer(_meshid) < 0) {
00129     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_meshpath);
00130     ISCRUTE_id(_meshid);
00131   }
00132 
00133   *fret = _ret;
00134   va_end(params);
00135   return;
00136 }
00137 

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