00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
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
00035 med_err _ret = -1;
00036 med_err _fret = -1;
00037 med_int _nmaa = 0;
00038 med_int _meshdim = 0;
00039 med_maillage _type;
00040 char _meshname[MED_TAILLE_NOM+1] ="";
00041 char _desc [MED_TAILLE_DESC+1]="";
00042 int _it =0;
00043 char * _axisname =0;
00044 char * _axisunit =0;
00045 med_repere _axistype =0;
00046 med_int _numdt=MED_NO_DT;
00047 med_int _numit=MED_NO_IT;
00048 char _dt[MED_SNAME_SIZE+1]="";
00049
00050
00051 MED_VARGS_DECL(, med_idt ,, fid );
00052 MED_VARGS_DECL(, char * , const , meshname );
00053 MED_VARGS_DECL(, med_int * , const , spacedim );
00054 MED_VARGS_DECL(, med_int * , const , meshdim );
00055 MED_VARGS_DECL(, med_mesh_type * , const , meshtype );
00056 MED_VARGS_DECL(, char * , const , description );
00057 MED_VARGS_DECL(, char * , const , dtunit );
00058 MED_VARGS_DECL(, med_sorting_type *, const , sortingtype );
00059 MED_VARGS_DECL(, med_int * , const , nstep );
00060 MED_VARGS_DECL(, med_axis_type * , const , axistype );
00061 MED_VARGS_DECL(, char * , const , axisname );
00062 MED_VARGS_DECL(, char * , const , axisunit );
00063 MED_VARGS_DECL(, med_err * ,, fret );
00064
00065 va_list params;
00066 va_start(params,dummy);
00067
00068 MED_VARGS_DEF(, med_idt ,, fid );
00069 MED_VARGS_DEF(, char * , const , meshname );
00070 MED_VARGS_DEF(, med_int * , const , spacedim );
00071 MED_VARGS_DEF(, med_int * , const , meshdim );
00072 MED_VARGS_DEF(, med_mesh_type * , const , meshtype );
00073 MED_VARGS_DEF(, char * , const , description );
00074 MED_VARGS_DEF(, char * , const , dtunit );
00075 MED_VARGS_DEF(, med_sorting_type *, const , sortingtype );
00076 MED_VARGS_DEF(, med_int * , const , nstep );
00077 MED_VARGS_DEF(, med_axis_type * , const , axistype );
00078 MED_VARGS_DEF(, char * , const , axisname );
00079 MED_VARGS_DEF(, char * , const , axisunit );
00080 MED_VARGS_DEF(, med_err * ,, fret );
00081
00082
00083
00084
00085 _MEDmodeErreurVerrouiller();
00086
00087 if ( strlen(meshname) > MED_TAILLE_NOM ) {
00088 MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_RANGE,MED_ERR_MESH_MSG);
00089 SSCRUTE(meshname);ISCRUTE_int(MED_TAILLE_NOM);
00090 goto ERROR;
00091 }
00092
00093 if ( (_nmaa =MEDnMaa(fid) ) < 0 ) {
00094 MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,MED_ERR_MESH_MSG);
00095 SSCRUTE(meshname);SSCRUTE("MEDnMaa");
00096 goto ERROR;
00097 }
00098
00099 for (_it=0; _it< _nmaa; ++_it ) {
00100
00101
00102 if ( MEDmaaInfo(fid, _it+1, _meshname, &_meshdim, &_type, _desc) < 0 ) {
00103 MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,MED_ERR_MESH_MSG);
00104 SSCRUTE(_meshname);SSCRUTE("MEDmaaInfo");
00105 ISCRUTE_int(_it);ISCRUTE(_meshdim);ISCRUTE_int(_type);SSCRUTE(_desc);
00106 goto ERROR;
00107 }
00108
00109 if ( !strcmp(_meshname,meshname) ) {
00110
00111 *meshdim=_meshdim;
00112 *meshtype = (med_mesh_type) _type;
00113 strcpy(description,_desc);
00114 *sortingtype = MED_SORT_UNDEF;
00115 if ( ( (*spacedim) = MEDdimEspaceLire(fid, _meshname) ) < 0 ) (*spacedim)=_meshdim;
00116 _axisname = malloc(MED_TAILLE_PNOM*sizeof(char)* (*spacedim) + 1);
00117 _axisunit = malloc(MED_TAILLE_PNOM*sizeof(char)* (*spacedim) + 1);
00118 (*_axisname) = '\0';
00119 (*_axisunit) = '\0';
00120
00121 if ( MED23v30axesInfo( fid, _meshname,
00122 (med_repere * ) &_axistype, _axisname, _axisunit) < 0 ) {
00123 (*axistype) = MED_UNDEF_AXIS_TYPE;
00124 (*axisname) = '\0';
00125 (*axisunit) = '\0';
00126 } else {
00127 _MED23v30stringConvert(axisname,MED_SNAME_SIZE,_axisname,MED_TAILLE_PNOM,*spacedim);
00128 _MED23v30stringConvert(axisunit,MED_SNAME_SIZE,_axisunit,MED_TAILLE_PNOM,*spacedim);
00129 (*axistype) = (med_axis_type) _axistype;
00130 }
00131
00132 _MEDmeshComputationStepInfo236(dummy,fid, meshname, 1,&_numdt,&_numit,_dt, MED_FALSE,&_fret);
00133
00134 if (_fret >= 0) *nstep=1; else *nstep=0;
00135 *dtunit='\0';
00136
00137 break;
00138 }
00139
00140 }
00141 _ret = 0;
00142
00143 ERROR:
00144
00145 if (_axisname) free (_axisname);
00146 if (_axisunit) free (_axisunit);
00147
00148 va_end(params);
00149 *fret = _ret;
00150 return;
00151 }