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