_MEDmeshnAxisByName30.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 
00023 #include <string.h>
00024 #include <stdlib.h>
00025 
00026 void
00027 _MEDmeshnAxisByName30(int dummy, ...)
00028 {
00029 
00030   med_int  _ret=0;
00031   med_idt _meshid=0;
00032   char    _meshpath[MED_TAILLE_SUP_MAA+MED_NAME_SIZE+1]="";
00033   char    _meshname[MED_NAME_SIZE+1]="";
00034   med_int _spacedim =-1;
00035 
00036 
00037   MED_VARGS_DECL(const, med_idt      , , fid       );
00038   MED_VARGS_DECL(const, char * , const , meshname  );
00039   MED_VARGS_DECL(const, med_bool     , , isasupportmesh );
00040   MED_VARGS_DECL(, med_int *          ,, fret      );
00041 
00042   va_list params;
00043   va_start(params,dummy);
00044 
00045   MED_VARGS_DEF(const, med_idt      , , fid       );
00046   MED_VARGS_DEF(const, char * , const , meshname  );
00047   MED_VARGS_DEF(const, med_bool     , , isasupportmesh );
00048   MED_VARGS_DEF(, med_int *          ,, fret      );
00049 
00050   /*
00051    * On inhibe le gestionnaire d'erreur
00052    */
00053   _MEDmodeErreurVerrouiller();
00054 
00055   /*
00056    * On regarde si le groupe existe => erreur si non
00057    */
00058   if (! isasupportmesh) {
00059     strcpy(_meshpath,MED_MAA);
00060     strcat(_meshpath,meshname);
00061     if ((_meshid = _MEDdatagroupOuvrir(fid,_meshpath)) < 0) {
00062       MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_ERR_MESH_MSG);
00063       SSCRUTE(meshname);SSCRUTE(_meshpath); goto ERROR;
00064     }
00065   } else {
00066     strcpy(_meshpath,MED_SUP_MAA);
00067     strcat(_meshpath,meshname);
00068     if ((_meshid = _MEDdatagroupOuvrir(fid,_meshpath)) < 0) {
00069       MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_ERR_MESH_MSG);
00070       SSCRUTE(meshname);SSCRUTE(_meshpath); goto ERROR;
00071     }
00072   }
00073 
00074   /*
00075    * On va lire l'attribut dimension de l'espace
00076    */
00077   if (_MEDattrEntierLire(_meshid,MED_NOM_ESP,&_spacedim) < 0) {
00078     MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_MESH_MSG);
00079     SSCRUTE(meshname);SSCRUTE(MED_NOM_ESP);goto ERROR;
00080   }
00081 
00082   _ret = _spacedim;
00083  ERROR:
00084 
00085   if (_meshid>0)            if (_MEDdatagroupFermer(_meshid) < 0) {
00086     MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_meshpath);
00087     ISCRUTE_id(_meshid);
00088   }
00089 
00090   va_end(params);
00091   *fret = _ret;
00092   return;
00093 }

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