_MEDmeshInfoByName236.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_config.h"
00020 #include <med.h>
00021 #include "med_outils.h"
00022 
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 #include "med_versioned.h"
00029 
00030 #include <string.h>
00031 
00032 void _MEDmeshInfoByName236(int dummy, ... ) {
00033 
00034   va_list params;
00035   va_start(params,dummy);
00036 
00037   med_idt                    fid         = va_arg(params,med_idt);
00038   char *             const   meshname    = va_arg(params, char *             const);
00039   med_int *          const   spacedim    = va_arg(params, med_int *          const);
00040   med_int *          const   meshdim     = va_arg(params, med_int *          const);
00041   med_mesh_type *    const   meshtype    = va_arg(params, med_mesh_type *    const);
00042   char *             const   description = va_arg(params, char *             const);
00043   char *             const   dtunit      = va_arg(params, char *             const);
00044   med_sorting_type * const   sortingtype = va_arg(params, med_sorting_type * const);
00045   med_int *          const   nstep       = va_arg(params, med_int *          const);
00046   med_axis_type *    const   axistype    = va_arg(params, med_axis_type *    const);
00047   char *             const   axisname    = va_arg(params, char *             const);
00048   char *             const   axisunit    = va_arg(params,  char *            const);
00049   med_err *                  fret        = va_arg(params,med_err *);
00050 
00051   med_err            _ret     = -1;
00052   med_err            _fret    = -1;
00053   med_int            _nmaa    = 0;
00054   med_int            _meshdim = 0;
00055   med_maillage       _type;
00056   char               _meshname[MED_TAILLE_NOM+1] ="";
00057   char               _desc    [MED_TAILLE_DESC+1]="";
00058   int                _it       =0;
00059   char *             _axisname =0;
00060   char *             _axisunit =0;
00061   med_repere         _axistype =0;
00062   med_int            _numdt=MED_NO_DT;
00063   med_int            _numit=MED_NO_IT;
00064   char               _dt[MED_SNAME_SIZE+1]="";
00065 
00066   /*
00067    * On inhibe le gestionnaire d'erreur HDF 5
00068    */
00069   _MEDmodeErreurVerrouiller();
00070 
00071   if ( strlen(meshname) > MED_TAILLE_NOM ) {
00072     MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_RANGE,MED_ERR_MESH_MSG);
00073     SSCRUTE(meshname);ISCRUTE_int(MED_TAILLE_NOM);
00074     goto ERROR;
00075   }
00076 
00077   if ( (_nmaa =MEDnMaa(fid) ) < 0 ) {
00078     MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,MED_ERR_MESH_MSG);
00079     SSCRUTE(meshname);SSCRUTE("MEDnMaa");
00080     goto ERROR;
00081   }
00082 
00083   for (_it=0; _it< _nmaa; ++_it ) {
00084 
00085 
00086     if ( MEDmaaInfo(fid, _it+1, _meshname, &_meshdim,  &_type, _desc) < 0 ) {
00087       MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,MED_ERR_MESH_MSG);
00088       SSCRUTE(_meshname);SSCRUTE("MEDmaaInfo");
00089       ISCRUTE_int(_it);ISCRUTE(_meshdim);ISCRUTE_int(_type);SSCRUTE(_desc);
00090       goto ERROR;
00091     }
00092 
00093     if ( !strcmp(_meshname,meshname) ) {
00094 /*       strcpy(meshname,_meshname); */
00095       *meshdim=_meshdim;
00096       *meshtype = (med_mesh_type) _type;
00097       strcpy(description,_desc);
00098       *sortingtype = MED_SORT_UNDEF;
00099       if ( ( (*spacedim) = MEDdimEspaceLire(fid, _meshname) ) < 0 ) (*spacedim)=_meshdim;
00100       _axisname = malloc(MED_TAILLE_PNOM*sizeof(char)* (*spacedim) + 1);
00101       _axisunit = malloc(MED_TAILLE_PNOM*sizeof(char)* (*spacedim) + 1);
00102       (*_axisname) = '\0';
00103       (*_axisunit) = '\0';
00104 
00105       if ( MED23v30axesInfo( fid, _meshname,
00106                              (med_repere * ) &_axistype, _axisname, _axisunit) < 0 )  {
00107         (*axistype) = MED_UNDEF_AXIS_TYPE;
00108         (*axisname) = '\0';
00109         (*axisunit) = '\0';
00110       } else {
00111         _MED23v30stringConvert(axisname,MED_SNAME_SIZE,_axisname,MED_TAILLE_PNOM,*spacedim);
00112         _MED23v30stringConvert(axisunit,MED_SNAME_SIZE,_axisunit,MED_TAILLE_PNOM,*spacedim);
00113         (*axistype) = (med_axis_type) _axistype;
00114       }
00115 
00116       _MEDmeshComputationStepInfo236(dummy,fid, meshname, 1,&_numdt,&_numit,_dt, MED_FALSE,&_fret);
00117 
00118       if (_fret >= 0) *nstep=1; else *nstep=0;
00119       *dtunit='\0';
00120 
00121       break;
00122     }
00123 
00124   }
00125   _ret = 0;
00126 
00127  ERROR:
00128 
00129   if (_axisname) free (_axisname);
00130   if (_axisunit) free (_axisunit);
00131 
00132   va_end(params);
00133   *fret = _ret;
00134   return;
00135 }

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