00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
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 _MEDlocalizationInfoByName30(int dummy, ...) {
00028
00029
00030 med_idt _lzid=0;
00031 med_err _ret=-1;
00032 char _path[MED_TAILLE_GAUSS+MED_NAME_SIZE+1]=MED_GAUSS;
00033
00034 char _sectiongeotypename[MED_TAILLE_NOM_ENTITE+1]="";
00035 med_int _intgeotype = -1,_nbofsectiongeotype=0, _nsectionmeshcell=0;
00036 med_geometry_type _sectiongeotype =MED_UNDEF_GEOTYPE;
00037 med_bool _chgt=MED_FALSE,_trsf=MED_FALSE;
00038
00039
00040 MED_VARGS_DECL(const, med_idt , , fid );
00041 MED_VARGS_DECL(const, char * , const , localizationname );
00042 MED_VARGS_DECL(, med_geometry_type *, const , geotype );
00043 MED_VARGS_DECL(, med_int *, const , spacedimension );
00044 MED_VARGS_DECL(, med_int *, const , nbofipoint );
00045 MED_VARGS_DECL(, char *, const , geointerpname );
00046 MED_VARGS_DECL(, char *, const , sectionmeshname );
00047 MED_VARGS_DECL(, med_int *, const , nsectionmeshcell );
00048 MED_VARGS_DECL(, med_geometry_type *, const , sectiongeotype );
00049 MED_VARGS_DECL(, med_err * ,, fret );
00050
00051 va_list params;
00052 va_start(params,dummy);
00053
00054 MED_VARGS_DEF(const, med_idt , , fid );
00055 MED_VARGS_DEF(const, char * , const , localizationname );
00056 MED_VARGS_DEF(, med_geometry_type *, const , geotype );
00057 MED_VARGS_DEF(, med_int *, const , spacedimension );
00058 MED_VARGS_DEF(, med_int *, const , nbofipoint );
00059 MED_VARGS_DEF(, char *, const , geointerpname );
00060 MED_VARGS_DEF(, char *, const , sectionmeshname );
00061 MED_VARGS_DEF(, med_int *, const , nsectionmeshcell );
00062 MED_VARGS_DEF(, med_geometry_type *, const , sectiongeotype );
00063 MED_VARGS_DEF(, med_err * ,, fret );
00064
00065
00066
00067
00068 _MEDmodeErreurVerrouiller();
00069
00070
00071
00072
00073 strcat(_path,localizationname);
00074 if ((_lzid = _MEDdatagroupOuvrir(fid,_path)) < 0) {
00075 MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_ERR_LOCALIZATION_MSG);
00076 SSCRUTE(_path);
00077 goto ERROR;
00078 }
00079
00080
00081
00082
00083 if (_MEDattrEntierLire(_lzid,MED_NOM_NBR,nbofipoint) < 0) {
00084 MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_LOCALIZATION_MSG);
00085 SSCRUTE(_path);SSCRUTE(MED_NOM_NBR);ISCRUTE(*nbofipoint);
00086 goto ERROR;
00087 }
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099 if (_MEDattrEntierLire(_lzid,MED_NOM_GEO,&_intgeotype) < 0) {
00100 MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_LOCALIZATION_MSG);
00101 SSCRUTE(localizationname);SSCRUTE(MED_NOM_GEO);ISCRUTE(_intgeotype);
00102 goto ERROR;
00103 };
00104 *geotype = (med_geometry_type) _intgeotype;
00105
00106
00107
00108
00109 if (_MEDattrEntierLire(_lzid,MED_NOM_DIM,spacedimension) < 0) {
00110 MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_LOCALIZATION_MSG);
00111 SSCRUTE(localizationname);SSCRUTE(MED_NOM_DIM);ISCRUTE(*spacedimension);
00112 goto ERROR;
00113 };
00114
00115
00116
00117
00118 if ( _MEDattrStringLire(_lzid,MED_NOM_NOM,MED_NAME_SIZE,sectionmeshname) < 0) {
00119 sectionmeshname[0]='\0';
00120 }
00121
00122 if ( strlen(sectionmeshname) &&
00123 ( _intgeotype > MED_STRUCT_GEO_INTERNAL) &&
00124 ( _intgeotype < MED_STRUCT_GEO_SUP_INTERNAL) ) {
00125
00126 if ( (_nbofsectiongeotype = MEDmeshnEntity(fid,sectionmeshname,MED_NO_DT,MED_NO_IT,
00127 MED_CELL,MED_ALL_GEOTYPE,MED_CONNECTIVITY,MED_NODAL,
00128 &_chgt,&_trsf) ) < 0) {
00129 MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDmeshnEntity");
00130 ISCRUTE(_nbofsectiongeotype);goto ERROR;
00131 }
00132
00133 if ( (_nbofsectiongeotype != 1 ) ) {
00134 MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_RANGE,""); ISCRUTE(_nbofsectiongeotype); goto ERROR;
00135 }
00136
00137 if ( MEDmeshEntityInfo( fid,sectionmeshname,MED_NO_DT,MED_NO_IT,
00138 MED_CELL, 1, _sectiongeotypename, &_sectiongeotype ) < 0 ) {
00139 MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDmeshEntityInfo");
00140 SSCRUTE(_sectiongeotypename);ISCRUTE_int(_sectiongeotype);goto ERROR;
00141 }
00142
00143 if ( (_nsectionmeshcell = MEDmeshnEntity(fid,sectionmeshname,MED_NO_DT,MED_NO_IT,
00144 MED_CELL,_sectiongeotype,MED_CONNECTIVITY,MED_NODAL,
00145 &_chgt,&_trsf) ) < 0) {
00146 MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDmeshnEntity");
00147 ISCRUTE(_nsectionmeshcell);goto ERROR;
00148 }
00149 }
00150 *sectiongeotype= _sectiongeotype;
00151 *nsectionmeshcell= _nsectionmeshcell;
00152
00153
00154
00155 if ( _MEDattrStringLire(_lzid,MED_NOM_INM,MED_NAME_SIZE,geointerpname) < 0) {
00156 MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_LOCALIZATION_MSG);
00157 SSCRUTE(localizationname);SSCRUTE(MED_NOM_INM);SSCRUTE(geointerpname);
00158 goto ERROR;
00159 }
00160
00161 _ret = 0;
00162 ERROR:
00163
00164 if ( _lzid > 0 ) if ( _MEDdatagroupFermer(_lzid) < 0) {
00165 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,MED_GAUSS);
00166 ISCRUTE_id(_lzid);
00167 }
00168
00169 va_end(params);
00170 *fret = _ret;
00171 return;
00172 }