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 #include <stdlib.h>
00024
00025
00026 void _MEDfieldValueAdvancedWr30(int dummy,...) {
00027
00028 med_access_mode _MED_ACCESS_MODE;
00029 med_err _ret=-1;
00030 med_idt _gid=0,_locgid=0,_datagroup1=0,_datagroup2=0,_datagroup3=0;
00031 med_int _nbofconstituentpervalue=0, _profilearraysize=0;
00032 med_bool _defaultprofileexist=MED_FALSE,_defaultlocalizationexist=MED_FALSE;
00033 med_bool _attexist=MED_FALSE;
00034
00035 med_bool _profilehaschanged=MED_FALSE,_filterparameterexist=MED_FALSE;
00036 med_int _nbofvaluesperentity=0,_nbofsectiongeotype=0,_nbofsectioncell=1;
00037 med_field_type _fieldtype=0;
00038 med_int _intfieldtype=0;
00039 med_geometry_type _locgeotype=0,_sectiongeotype=0;
00040 med_int _intlocgeotype=0;
00041 char _gidname [MED_TAILLE_CHA+MED_NAME_SIZE+1]="";
00042 char _datagroupname1 [2*MED_MAX_PARA+1]="";
00043 char _datagroupname2 [2*MED_TAILLE_NOM_ENTITE+2]="";
00044 char _profilename [MED_NAME_SIZE+1]="";
00045 char _locgidname [MED_TAILLE_GAUSS+MED_NAME_SIZE+1]=MED_GAUSS;
00046 char _sectionmeshname [MED_NAME_SIZE+1]="";
00047 char _sectiongeotypename [MED_NAME_SIZE+1]="";
00048 char _geotypename [MED_TAILLE_NOM_ENTITE+1]="";
00049 char _defaultprofilename[MED_NAME_SIZE+1]=MED_NO_PROFILE;
00050 char _defaultlocalizationname[MED_NAME_SIZE+1]=MED_NO_LOCALIZATION;
00051 med_filter * _filter = NULL;
00052 med_filter _tmpfilter = MED_FILTER_INIT;
00053 med_filter _paramfilter = MED_FILTER_INIT;
00054 med_int _MED_NO_DT = MED_NO_DT;
00055 med_int _MED_NO_IT = MED_NO_IT;
00056 med_bool _chgt=MED_FALSE,_trsf=MED_FALSE;
00057
00058
00059 MED_VARGS_DECL(const, med_idt , , fid );
00060 MED_VARGS_DECL(const, char * , const , fieldname );
00061 MED_VARGS_DECL(const, med_int , , numdt );
00062 MED_VARGS_DECL(const, med_int , , numit );
00063 MED_VARGS_DECL(const, med_float , , dt );
00064 MED_VARGS_DECL(const, med_entity_type , , entitytype );
00065 MED_VARGS_DECL(const, med_geometry_type , , geotype );
00066 MED_VARGS_DECL(const, med_storage_mode , , storagemode );
00067 MED_VARGS_DECL(const, char * , const , profilename );
00068 MED_VARGS_DECL(const, char * , const , localizationname );
00069 MED_VARGS_DECL(const, med_switch_mode , , switchmode );
00070 MED_VARGS_DECL(const, med_int , , componentselect );
00071 MED_VARGS_DECL(const, med_filter* , const , filter );
00072 MED_VARGS_DECL(const, med_int , , nbofentity );
00073 MED_VARGS_DECL(const, unsigned char*, const , value );
00074 MED_VARGS_DECL(, med_err * ,, fret );
00075
00076 va_list params;
00077 va_start(params,dummy);
00078
00079 MED_VARGS_DEF(const, med_idt , , fid );
00080 MED_VARGS_DEF(const, char * , const , fieldname );
00081 MED_VARGS_DEF(const, med_int , , numdt );
00082 MED_VARGS_DEF(const, med_int , , numit );
00083 MED_VARGS_DEF(const, med_float , , dt );
00084 MED_VARGS_DEF(const, med_entity_type , , entitytype );
00085 MED_VARGS_DEF(const, med_geometry_type , , geotype );
00086 MED_VARGS_DEF(const, med_storage_mode , , storagemode );
00087 MED_VARGS_DEF(const, char * , const , profilename );
00088 MED_VARGS_DEF(const, char * , const , localizationname );
00089 MED_VARGS_DEF(const, med_switch_mode , , switchmode );
00090 MED_VARGS_DEF(const, med_int , , componentselect );
00091 MED_VARGS_DEF(const, med_filter* , const , filter );
00092 MED_VARGS_DEF(const, med_int , , nbofentity );
00093 MED_VARGS_DEF(const, unsigned char*, const , value );
00094 MED_VARGS_DEF(, med_err * ,, fret );
00095
00096
00097
00098 if (_MEDcheckVersion30(fid) < 0) goto ERROR;
00099
00100 if (filter) {
00101 _filter=(med_filter*)(filter); _filterparameterexist=MED_TRUE;
00102 }
00103 else {
00104 _filter=&_tmpfilter;
00105 (*_filter).nbofentity = nbofentity;
00106
00107
00108 (*_filter).constituentselect = componentselect;
00109 (*_filter).switchmode = switchmode;
00110 (*_filter).storagemode = storagemode;
00111 strcpy((*_filter).profilename,profilename);
00112
00113 }
00114
00115
00116
00117
00118 _MEDmodeErreurVerrouiller();
00119
00120 if ( (_MED_ACCESS_MODE = _MEDmodeAcces(fid) ) == MED_ACC_UNDEF ) {
00121 MED_ERR_(_ret,MED_ERR_UNRECOGNIZED,MED_ERR_ACCESSMODE,MED_ERR_FILE_MSG);
00122 goto ERROR;
00123 }
00124
00125 if ( _MED_ACCESS_MODE == MED_ACC_RDONLY) {
00126 MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ACCESSMODE,MED_ERR_FILE_MSG);
00127 ISCRUTE_int(_MED_ACCESS_MODE);
00128 goto ERROR;
00129 }
00130
00131
00132
00133
00134 NOFINALBLANK(fieldname,ERROR);
00135
00136 strcpy(_gidname,MED_CHA);
00137 strcat(_gidname,fieldname);
00138 if ((_gid = _MEDdatagroupOuvrir(fid,_gidname)) < 0) {
00139 MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,MED_ERR_FIELD_MSG);
00140 SSCRUTE(fieldname);SSCRUTE(_gidname); goto ERROR;
00141 }
00142
00143
00144
00145
00146 if (_MEDattrEntierLire(_gid,MED_NOM_NCO,&_nbofconstituentpervalue) < 0) {
00147 MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
00148 SSCRUTE(fieldname);SSCRUTE(MED_NOM_NCO);goto ERROR;
00149 }
00150
00151 if (_filterparameterexist) {
00152 if ((*_filter).nbofconstituentpervalue != _nbofconstituentpervalue ) {
00153 MED_ERR_(_ret,MED_ERR_NOTEQUAL,MED_ERR_ATTRIBUTE,MED_ERR_VALUE_MSG);
00154 ISCRUTE((*_filter).nbofconstituentpervalue); ISCRUTE(_nbofconstituentpervalue );
00155 goto ERROR;
00156 }
00157 } else {
00158 (*_filter).nbofconstituentpervalue = _nbofconstituentpervalue;
00159 }
00160
00161
00162
00163
00164 if ( _MEDattrEntierLire(_gid,MED_NOM_TYP,&_intfieldtype) < 0) {
00165 MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
00166 SSCRUTE(fieldname);SSCRUTE(MED_NOM_TYP);
00167 goto ERROR;
00168 }
00169 _fieldtype = (med_field_type) (_intfieldtype);
00170
00171
00172
00173
00174
00175
00176 _MEDgetComputationStepName(MED_SORT_DTIT,numdt,numit,_datagroupname1);
00177
00178 _datagroup1 = 0;
00179 if ( (_datagroup1 = _MEDdatagroupOuvrir(_gid,_datagroupname1)) < 0 )
00180 if ((_datagroup1 = _MEDdatagroupCreer(_gid,_datagroupname1)) < 0 ) {
00181 MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_DATAGROUP,MED_ERR_FIELD_MSG);
00182 SSCRUTE(fieldname);SSCRUTE(_datagroupname1);goto ERROR;
00183 }
00184
00185
00186 if ( _MEDattributeIntWr(_datagroup1,MED_NOM_NDT,&numdt) < 0) {
00187 MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
00188 SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(MED_NOM_NDT);
00189 ISCRUTE(numdt);goto ERROR;
00190 }
00191
00192
00193 if ( _MEDattrFloatEcrire(_datagroup1,MED_NOM_PDT,&dt) < 0) {
00194 MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
00195 SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(MED_NOM_PDT);
00196 RSCRUTE(dt);goto ERROR;
00197 }
00198
00199
00200 if ( _MEDattributeIntWr(_datagroup1,MED_NOM_NOR,&numit) < 0) {
00201 MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
00202 SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(MED_NOM_NOR);
00203 ISCRUTE(numit); goto ERROR;
00204 }
00205
00206
00207 _MEDattributeExist(_datagroup1,".",MED_NOM_RDT,&_attexist);
00208 if (!_attexist )
00209 if ( _MEDattributeIntWr(_datagroup1,MED_NOM_RDT,&_MED_NO_DT) < 0) {
00210 MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
00211 SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(MED_NOM_RDT);
00212 ISCRUTE_int(MED_NO_DT);goto ERROR;
00213 }
00214
00215
00216 _MEDattributeExist(_datagroup1,".",MED_NOM_ROR,&_attexist);
00217 if (!_attexist )
00218 if ( _MEDattributeIntWr(_datagroup1,MED_NOM_ROR,&_MED_NO_IT) < 0) {
00219 MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
00220 SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(MED_NOM_ROR);
00221 ISCRUTE_int(MED_NO_IT);goto ERROR;
00222 }
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243 if (_MEDgetEntityTypeName(_datagroupname2,entitytype) < 0) {
00244 MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ENTITY,MED_ERR_VALUE_MSG);
00245 ISCRUTE_int(entitytype);SSCRUTE(fieldname);goto ERROR;
00246 }
00247
00248
00249 if ( entitytype != MED_NODE ) {
00250
00251 if ( entitytype == MED_STRUCT_ELEMENT ) {
00252 if ( MEDstructElementName(fid, geotype,_geotypename) < 0 ) {
00253 MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDstructElementName");
00254 ISCRUTE_int(geotype);goto ERROR;
00255 }
00256 } else {
00257 if ( _MEDgetInternalGeometryTypeName(_geotypename,geotype) < 0) {
00258 MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_GEOMETRIC,MED_ERR_VALUE_MSG);
00259 ISCRUTE_int(geotype);SSCRUTE(fieldname);goto ERROR;
00260 }
00261 }
00262 strcat(_datagroupname2,".");
00263 strcat(_datagroupname2,_geotypename);
00264 }
00265
00266 _datagroup2 = 0;
00267 if ( (_datagroup2 = _MEDdatagroupOuvrir(_datagroup1,_datagroupname2)) < 0)
00268 if ((_datagroup2 = _MEDdatagroupCreer(_datagroup1,_datagroupname2)) < 0) {
00269 MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_DATAGROUP,_datagroupname2);
00270 SSCRUTE(fieldname);goto ERROR;
00271 }
00272
00273
00274
00275
00276
00277 if ( _MEDattrStringLire(_datagroup2,MED_NOM_PFL,MED_NAME_SIZE,_defaultprofilename) < 0 ) {
00278 strncpy(_defaultprofilename,MED_NO_PROFILE,MED_NAME_SIZE+1);
00279 _defaultprofileexist = MED_FALSE;
00280 } else
00281 _defaultprofileexist = MED_TRUE;
00282
00283 NOFINALBLANK(profilename,ERROR);
00284
00285 if ( strlen((*_filter).profilename) == 0 ) {
00286
00287 strncpy(_profilename,MED_NO_PROFILE_INTERNAL,MED_NAME_SIZE+1);
00288
00289
00290 _profilearraysize = MED_UNDEF_SIZE;
00291 } else {
00292 strncpy(_profilename,(*_filter).profilename,MED_NAME_SIZE+1);
00293 _profilename[MED_NAME_SIZE]='\0';
00294
00295 if ( ( _profilearraysize = MEDprofileSizeByName( fid,_profilename) ) < 0 ) {
00296 MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,MED_ERR_FIELD_MSG);
00297 SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(_datagroupname2);
00298 SSCRUTE(_profilename);SSCRUTE("MEDprofileSizeByName");goto ERROR;
00299 }
00300 }
00301
00302
00303 if (!_filterparameterexist) (*_filter).profilearraysize = _profilearraysize;
00304
00305
00306
00307
00308 if ( _MEDattrStringLire(_datagroup2,MED_NOM_GAU,MED_NAME_SIZE,_defaultlocalizationname) < 0 ) {
00309 strncpy(_defaultlocalizationname,MED_NO_LOCALIZATION,MED_NAME_SIZE+1);
00310 _defaultlocalizationexist = MED_FALSE;
00311 } else {
00312 _defaultlocalizationexist = MED_TRUE;
00313 }
00314 NOFINALBLANK(localizationname,ERROR);
00315
00316
00317
00318
00319
00320
00321 _datagroup3 = 0;
00322 if (((_datagroup3 = _MEDdatagroupOuvrir(_datagroup2,_profilename)) > 0)
00323 && ( _MED_ACCESS_MODE == MED_ACC_RDEXT )) {
00324 MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_ACCESSMODE,MED_ERR_DATAGROUP_MSG);
00325 SSCRUTE(_profilename);
00326 ISCRUTE_int(_MED_ACCESS_MODE);
00327 goto ERROR;
00328 } else
00329 if ( _datagroup3 < 0)
00330 if ((_datagroup3 = _MEDdatagroupCreer(_datagroup2,_profilename)) < 0) {
00331 MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_DATAGROUP,_profilename);
00332 SSCRUTE(fieldname);SSCRUTE(_profilename);goto ERROR;
00333 }
00334
00335
00336
00337
00338
00339
00340 if ( !_defaultprofileexist )
00341 if ( _MEDattributeStringWr(_datagroup2,MED_NOM_PFL,MED_NAME_SIZE,_profilename) < 0) {
00342 MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
00343 SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(_datagroupname2);
00344 SSCRUTE(MED_NOM_PFL);SSCRUTE(_profilename);goto ERROR;
00345 }
00346
00347 if ( !_defaultlocalizationexist ) {
00348 if ( _MEDattributeStringWr(_datagroup2,MED_NOM_GAU,MED_NAME_SIZE,localizationname) < 0) {
00349 MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
00350 SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(_datagroupname2);
00351 SSCRUTE(MED_NOM_GAU);SSCRUTE(localizationname);goto ERROR;
00352 }
00353 }
00354
00355 if ( _MEDattributeIntWr(_datagroup3,MED_NOM_NBR,&((*_filter).nbofentity)) < 0) {
00356 MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
00357 SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(_datagroupname2);SSCRUTE(_profilename);
00358 SSCRUTE(MED_NOM_NBR);ISCRUTE((*_filter).nbofentity);goto ERROR;
00359 }
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373 if (entitytype == MED_NODE_ELEMENT ) {
00374 if ( strlen(localizationname) != 0) {
00375 MED_ERR_(_ret,MED_ERR_NOTNULL,MED_ERR_PARAMETER,localizationname);
00376 ISCRUTE_int(entitytype);goto ERROR;
00377 }
00378 _nbofvaluesperentity = geotype % 100;
00379 } else if (! strcmp(localizationname,MED_GAUSS_ELNO)) {
00380
00381
00382
00383 _nbofvaluesperentity = geotype % 100;
00384
00385 } else if (strlen(localizationname)) {
00386 strcat(_locgidname,localizationname);
00387
00388 if ((_locgid = _MEDdatagroupOuvrir(fid,_locgidname)) < 0) {
00389 MED_ERR_(_ret,MED_ERR_OPEN,MED_ERR_DATAGROUP,_locgidname);
00390 goto ERROR;
00391 }
00392
00393 if (_MEDattrEntierLire(_locgid,MED_NOM_NBR,&_nbofvaluesperentity) < 0) {
00394 MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_LOCALIZATION_MSG);
00395 SSCRUTE(localizationname);SSCRUTE(MED_NOM_NBR);ISCRUTE(_nbofvaluesperentity);goto ERROR;
00396 }
00397
00398
00399 if ( entitytype == MED_STRUCT_ELEMENT ) {
00400
00401
00402
00403
00404 if ( _MEDattrStringLire(_locgid,MED_NOM_NOM,MED_NAME_SIZE,_sectionmeshname) < 0) {
00405 MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,_locgidname);
00406 SSCRUTE(MED_NOM_NOM);SSCRUTE(_sectionmeshname);
00407 goto ERROR;
00408 }
00409
00410 if (strlen(_sectionmeshname) ) {
00411
00412 if ( (_nbofsectiongeotype = MEDmeshnEntity(fid,_sectionmeshname,MED_NO_DT,MED_NO_IT,
00413 MED_CELL,MED_ALL_GEOTYPE,MED_CONNECTIVITY,MED_NODAL,
00414 &_chgt,&_trsf) ) < 0) {
00415 MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDmeshnEntity");
00416 ISCRUTE(_nbofsectiongeotype);goto ERROR;
00417 }
00418
00419 if ( (_nbofsectiongeotype != 1 ) ) {
00420 MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_RANGE,""); ISCRUTE(_nbofsectiongeotype); goto ERROR;
00421 }
00422
00423
00424 if ( MEDmeshEntityInfo( fid,_sectionmeshname,MED_NO_DT,MED_NO_IT,
00425 MED_CELL, 1, _sectiongeotypename,
00426 &_sectiongeotype ) < 0 ) {
00427 MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDmeshEntityInfo");
00428 SSCRUTE(_sectiongeotypename);ISCRUTE_int(_sectiongeotype);goto ERROR;
00429 }
00430
00431 if ( (_nbofsectioncell = MEDmeshnEntity(fid,_sectionmeshname,MED_NO_DT,MED_NO_IT,
00432 MED_CELL,_sectiongeotype,MED_CONNECTIVITY,MED_NODAL,
00433 &_chgt,&_trsf) ) < 0) {
00434 MED_ERR_(_ret,MED_ERR_CALL,MED_ERR_API,"MEDmeshnEntity");
00435 ISCRUTE(_nbofsectioncell);goto ERROR;
00436 }
00437 }
00438 }
00439
00440 _nbofvaluesperentity*=_nbofsectioncell;
00441
00442 if (_MEDattrEntierLire(_locgid,MED_NOM_GEO,&_intlocgeotype) < 0) {
00443 MED_ERR_(_ret,MED_ERR_READ,MED_ERR_ATTRIBUTE,MED_ERR_LOCALIZATION_MSG);
00444 SSCRUTE(localizationname);SSCRUTE(MED_NOM_GEO);ISCRUTE_int(_locgeotype);goto ERROR;
00445 }
00446 _locgeotype = (med_geometry_type) _intlocgeotype;
00447
00448 if ( _locgeotype != geotype ) {
00449 MED_ERR_(_ret,MED_ERR_NOTEQUAL,MED_ERR_ATTRIBUTE,MED_ERR_LOCALIZATION_MSG);
00450 SSCRUTE(localizationname);SSCRUTE(MED_NOM_GEO);ISCRUTE_int(_locgeotype);
00451 ISCRUTE_int(geotype);goto ERROR;
00452 }
00453 } else {
00454 _nbofvaluesperentity = MED_NO_IPOINT_INTERNAL ;
00455 }
00456
00457
00458 if (!_filterparameterexist) (*_filter).nbofvaluesperentity=_nbofvaluesperentity;
00459
00460
00461
00462
00463
00464 if ( _MEDattributeStringWr(_datagroup3,MED_NOM_GAU,MED_NAME_SIZE,localizationname) < 0) {
00465 MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
00466 SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(_datagroupname2);SSCRUTE(_profilename);
00467 SSCRUTE(MED_NOM_GAU);SSCRUTE(localizationname);goto ERROR;
00468 }
00469
00470
00471
00472 if ( _MEDattributeIntWr(_datagroup3,MED_NOM_NGA,&_nbofvaluesperentity) < 0) {
00473 MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
00474 SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(_datagroupname2);SSCRUTE(_profilename);
00475 SSCRUTE(MED_NOM_NGA);ISCRUTE(_nbofvaluesperentity);goto ERROR;
00476 }
00477
00478
00479
00480
00481 if ( _defaultprofileexist && !strcmp((*_filter).profilename,_defaultprofilename) ) {
00482 if ( _MEDattributeStringWr(_datagroup2,MED_NOM_GAU,MED_NAME_SIZE,localizationname) < 0) {
00483 MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_ATTRIBUTE,MED_ERR_FIELD_MSG);
00484 SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(_datagroupname2);SSCRUTE(_profilename);
00485 SSCRUTE(MED_NOM_GAU);SSCRUTE(localizationname);goto ERROR;
00486 }
00487 }
00488
00489 if (!_filterparameterexist) {
00490
00491 #ifdef _DEBUG_
00492 ISCRUTE((*_filter).nbofentity );
00493 ISCRUTE((*_filter).nbofvaluesperentity );
00494 ISCRUTE((*_filter).nbofconstituentpervalue );
00495 ISCRUTE((*_filter).constituentselect );
00496 ISCRUTE_int((*_filter).switchmode );
00497 ISCRUTE((*_filter).filterarraysize );
00498 ISCRUTE((*_filter).profilearraysize );
00499 ISCRUTE_int((*_filter).storagemode );
00500 SSCRUTE((*_filter).profilename );
00501 #endif
00502
00503 if ( MEDfilterEntityCr(fid, (*_filter).nbofentity, (*_filter).nbofvaluesperentity,
00504 (*_filter).nbofconstituentpervalue, (*_filter).constituentselect,
00505 (*_filter).switchmode, (*_filter).storagemode,
00506 (*_filter).profilename, MED_UNDEF_SIZE, NULL, &_paramfilter) < 0 ) {
00507 MED_ERR_(_ret,MED_ERR_CREATE,MED_ERR_FILTER,MED_ERR_INTERNAL_MSG);
00508 goto ERROR;
00509 }
00510 _filter = &_paramfilter;
00511 }
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525 switch(_fieldtype)
00526 {
00527 case MED_FLOAT64 :
00528 if ( _MEDdatasetWr(_datagroup3,MED_NOM_CO,MED_FLOAT64,_filter,value) < 0) {
00529 MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_DATASET,MED_NOM_CO);
00530 SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(_datagroupname2);SSCRUTE(_profilename);
00531 goto ERROR;
00532 }
00533 break;
00534
00535 case MED_INT32 :
00536 #if defined(HAVE_F77INT64)
00537 if ( _MEDdatasetWr(_datagroup3,MED_NOM_CO,MED_INT64,_filter,value) < 0) {
00538 MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_DATASET,MED_NOM_CO);
00539 SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(_datagroupname2);SSCRUTE(_profilename);
00540 goto ERROR;
00541 }
00542 #else
00543 if ( _MEDdatasetWr(_datagroup3,MED_NOM_CO,MED_INT32,_filter,value) < 0){
00544 MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_DATASET,MED_NOM_CO);
00545 SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(_datagroupname2);SSCRUTE(_profilename);
00546 goto ERROR;
00547 }
00548 #endif
00549 break;
00550
00551 case MED_INT64 :
00552 #if defined(HAVE_F77INT64)
00553 if ( _MEDdatasetWr(_datagroup3,MED_NOM_CO,MED_INT64,_filter,value) < 0){
00554 MED_ERR_(_ret,MED_ERR_WRITE,MED_ERR_DATASET,MED_NOM_CO);
00555 SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(_datagroupname2);SSCRUTE(_profilename);
00556 goto ERROR;
00557 }
00558 #else
00559 MESSAGE("Impossible d'ecrire le dataset de type MED_INT64 sur une plateforme dépourvue de int64 !");
00560 goto ERROR;
00561 #endif
00562 break;
00563
00564 default :
00565 MED_ERR_(_ret,MED_ERR_INVALID,MED_ERR_RANGE,MED_ERR_FIELD_MSG);
00566 SSCRUTE(fieldname);ISCRUTE_int(_fieldtype);
00567 goto ERROR;
00568 }
00569
00570
00571
00572
00573
00574
00575 _ret = 0;
00576
00577 ERROR:
00578
00579
00580
00581 if (!_filterparameterexist) {
00582 if ( MEDfilterClose(_filter) < 0 ) {
00583 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_FILTER,MED_ERR_FIELD_MSG);
00584 SSCRUTE(fieldname);SSCRUTE(_datagroupname1);SSCRUTE(_datagroupname2);SSCRUTE(_profilename);
00585 goto ERROR;
00586 }
00587 }
00588
00589 if (_datagroup3>0) if (_MEDdatagroupFermer(_datagroup3) < 0) {
00590 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_profilename);
00591 ISCRUTE_id(_datagroup3);
00592 }
00593
00594 if (_datagroup2>0) if (_MEDdatagroupFermer(_datagroup2) < 0) {
00595 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_datagroupname2);
00596 ISCRUTE_id(_datagroup2);
00597 }
00598
00599 if (_datagroup1>0) if (_MEDdatagroupFermer(_datagroup1) < 0) {
00600 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_datagroupname1);
00601 ISCRUTE_id(_datagroup1);
00602 }
00603
00604 if (_gid>0) if (_MEDdatagroupFermer(_gid) < 0) {
00605 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_gidname);
00606 ISCRUTE_id(_gid);
00607 }
00608
00609 if (_locgid>0) if (_MEDdatagroupFermer(_locgid) < 0) {
00610 MED_ERR_(_ret,MED_ERR_CLOSE,MED_ERR_DATAGROUP,_locgidname);
00611 ISCRUTE_id(_locgid);
00612 }
00613
00614 va_end(params);
00615 *fret = _ret;
00616 return;
00617 }
00618