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 #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 _MEDfieldInfoByName236(int dummy, ...) {
00030
00031
00032 med_err _ret=-1,_err=-1;
00033 med_idt _fieldgid=0,_meshgid=0,_linkgid=0;
00034 char _fieldpath[MED_TAILLE_CHA+MED_TAILLE_NOM+1]=MED_CHA;
00035 char _meshpath [MED_TAILLE_MAA+MED_TAILLE_NOM+1]=MED_MAA;
00036 char _linkpath [MED_TAILLE_LIENS+MED_TAILLE_NOM+1]=MED_LIENS;
00037 med_size _nbofcstp=0;
00038 med_int _n=0;
00039 med_int _intfieldtype=0;
00040 char _meshrefpath236[(2*MED_TAILLE_NOM_ENTITE+1)+1+ (2*MED_MAX_PARA)+1]="";
00041
00042
00043 MED_VARGS_DECL(const, med_idt , , fid );
00044 MED_VARGS_DECL(const, char * , const , fieldname );
00045 MED_VARGS_DECL(, char *, const , meshname );
00046 MED_VARGS_DECL(, med_bool *, const , localmesh );
00047 MED_VARGS_DECL(, med_field_type *, const , fieldtype );
00048 MED_VARGS_DECL(, char *, const , componentname );
00049 MED_VARGS_DECL(, char *, const , componentunit );
00050 MED_VARGS_DECL(, char *, const , dtunit );
00051 MED_VARGS_DECL(, med_int *, const , nbofcstp );
00052 MED_VARGS_DECL(, med_err * ,, fret );
00053
00054 va_list params;
00055 va_start(params,dummy);
00056
00057 MED_VARGS_DEF(const, med_idt , , fid );
00058 MED_VARGS_DEF(const, char * , const , fieldname );
00059 MED_VARGS_DEF(, char *, const , meshname );
00060 MED_VARGS_DEF(, med_bool *, const , localmesh );
00061 MED_VARGS_DEF(, med_field_type *, const , fieldtype );
00062 MED_VARGS_DEF(, char *, const , componentname );
00063 MED_VARGS_DEF(, char *, const , componentunit );
00064 MED_VARGS_DEF(, char *, const , dtunit );
00065 MED_VARGS_DEF(, med_int *, const , nbofcstp );
00066 MED_VARGS_DEF(, med_err * ,, fret );
00067
00068
00069
00070
00071 _MEDmodeErreurVerrouiller();
00072
00073 strcat(_fieldpath,fieldname);
00074
00075 if ((_fieldgid = _MEDdatagroupOuvrir(fid,_fieldpath)) < 0) {
00076 MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_fieldpath);
00077 goto ERROR;
00078 }
00079
00080
00081 if ( _MEDattrEntierLire(_fieldgid,MED_NOM_NCO,&_n) < 0) {
00082 MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_NOM_NCO);
00083 SSCRUTE(_fieldpath);goto ERROR;
00084 }
00085
00086
00087 if ( _MEDattrEntierLire(_fieldgid,MED_NOM_TYP,&_intfieldtype) < 0) {
00088 MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
00089 SSCRUTE(fieldname);SSCRUTE(MED_NOM_TYP);
00090 goto ERROR;
00091 }
00092 *fieldtype = (med_field_type) (_intfieldtype);
00093
00094
00095
00096
00097
00098 if (_MEDattrStringLire(_fieldgid,MED_NOM_NOM,_n*MED_TAILLE_PNOM,
00099 componentname) < 0) {
00100 MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
00101 SSCRUTE(fieldname);SSCRUTE(_fieldpath);SSCRUTE(MED_NOM_NOM);
00102 SSCRUTE(componentname);goto ERROR;
00103 }
00104
00105 if (_MEDattrStringLire(_fieldgid,MED_NOM_UNI,_n*MED_TAILLE_PNOM,
00106 componentunit) < 0) {
00107 MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
00108 SSCRUTE(fieldname);SSCRUTE(_fieldpath);SSCRUTE(MED_NOM_UNI);
00109 SSCRUTE(componentunit);goto ERROR;
00110 }
00111
00112
00113
00114
00115
00116 if ( _MEDobjectGetName(_fieldgid, "." , 0, _meshrefpath236) < 0 ) {
00117 MED_ERR_(_ret,MED_ERR_ACCESS,MED_ERR_DATAGROUP,".");
00118 SSCRUTE(_meshrefpath236); goto ERROR;
00119 }
00120
00121
00122
00123
00124
00125
00126 if ( (_err=_MEDnObjects(_fieldgid,_meshrefpath236,&_nbofcstp)) <0)
00127 if ( _err == (MED_ERR_COUNT + MED_ERR_DATAGROUP) ) {
00128 MED_ERR_(_ret,MED_ERR_COUNT,MED_ERR_DATAGROUP,_fieldpath);
00129 goto ERROR;
00130 }
00131 *nbofcstp = (med_int) _nbofcstp;
00132
00133
00134
00135
00136
00137
00138 strcat(_meshrefpath236,"/");
00139 if ( _MEDobjectGetName(_fieldgid, _meshrefpath236 , 0, &_meshrefpath236[strlen(_meshrefpath236)]) < 0 ) {
00140 MED_ERR_(_ret,MED_ERR_ACCESS,MED_ERR_DATAGROUP,_meshrefpath236);
00141 goto ERROR;
00142 }
00143
00144
00145
00146 if ( _MEDattributeStringRdByName(_fieldgid,_meshrefpath236,MED_NOM_UNI,MED_TAILLE_PNOM,dtunit) < 0) {
00147 MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
00148 SSCRUTE(fieldname);SSCRUTE(_meshrefpath236);SSCRUTE(MED_NOM_UNI);
00149 SSCRUTE(dtunit);goto ERROR;
00150 }
00151
00152
00153 if ( _MEDattributeStringRdByName(_fieldgid,_meshrefpath236,MED_NOM_MAI,MED_NAME_SIZE,meshname) < 0) {
00154 MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
00155 SSCRUTE(fieldname);SSCRUTE(_meshrefpath236);SSCRUTE(MED_NOM_MAI);SSCRUTE(meshname);
00156 goto ERROR;
00157 }
00158
00159
00160 strcat(_meshpath,meshname);
00161
00162
00163 if ( (_meshgid = _MEDdatagroupOuvrir(fid,_meshpath)) < 0) {
00164
00165
00166 strcat(_linkpath,meshname);
00167 if ((_linkgid = _MEDdatagroupOuvrir(fid,_linkpath)) < 0) {
00168
00169
00170
00171 *localmesh = MED_FALSE;
00172 }
00173 *localmesh = MED_FALSE;
00174 } else
00175 *localmesh = MED_TRUE;
00176
00177
00178 _ret = 0;
00179
00180 ERROR:
00181
00182
00183 if (_fieldgid>0) if (_MEDdatagroupFermer(_fieldgid) < 0) {
00184 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_fieldpath);
00185 ISCRUTE_id(_fieldgid);
00186 }
00187
00188 if (_meshgid>0) if (_MEDdatagroupFermer(_meshgid) < 0) {
00189 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_meshpath);
00190 ISCRUTE_id(_meshgid);
00191 }
00192
00193 if (_linkgid>0) if (_MEDdatagroupFermer(_linkgid) < 0) {
00194 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_linkpath);
00195 ISCRUTE_id(_linkgid);
00196 }
00197
00198 va_end(params);
00199 *fret = _ret;
00200 return;
00201 }