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