Test_MEDstructElementConstAttWithProfileWr.c
Aller à la documentation de ce fichier.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <med.h>
00020 #define MESGERR 1
00021 #include <med_utils.h>
00022 #include <string.h>
00023
00024 #ifdef DEF_LECT_ECR
00025 #define MODE_ACCES MED_ACC_RDWR
00026 #elif DEF_LECT_AJOUT
00027 #define MODE_ACCES MED_ACC_RDEXT
00028 #else
00029 #define MODE_ACCES MED_ACC_CREAT
00030 #endif
00031
00032 int main (int argc, char **argv)
00033
00034 {
00035 med_err _ret=0;
00036 med_idt _fid=0;
00037 med_geometry_type _geotype=MED_NONE;
00038
00039 const char _elementname1[]="MED_BILLE";
00040 med_int _elementdim1=3;
00041 const char _supportmeshname1[]="MED_BILLE_SUPPORT";
00042 med_entity_type _entitytype1=MED_NODE;
00043 med_int _nnode1=1;
00044 med_int _ncell1=0;
00045 med_int _geocelltype1=MED_NONE;
00046
00047 const char _constattname1_1[MED_NAME_SIZE+1]="MED_FOO_ATR1_1";
00048 const med_attribute_type _constatttype1_1=MED_ATT_INT;
00049 const med_int _ncomponent1_1=2;
00050 const char _profilename1_1[MED_NAME_SIZE+1]=MED_NO_PROFILE;
00051 const med_int _cstatrvalue1_1[2]={ 20 , 21 };
00052
00053 const char _constattname1_2[MED_NAME_SIZE+1]="MED_FOO_ATR1_2";
00054 const med_attribute_type _constatttype1_2=MED_ATT_FLOAT64;
00055 const med_int _ncomponent1_2=2;
00056 const char _profilename1_2[MED_NAME_SIZE+1]=MED_NO_PROFILE;
00057 const med_float _cstatrvalue1_2[2]={ 20.1 , 21.2 };
00058
00059 const char _constattname1_3[MED_NAME_SIZE+1]="MED_FOO_ATR1_3";
00060 const med_attribute_type _constatttype1_3=MED_ATT_NAME;
00061 const med_int _ncomponent1_3=2;
00062 const char _profilename1_3[MED_NAME_SIZE+1]=MED_NO_PROFILE;
00063
00064 const char _cstatrvalue1_3[2*MED_NAME_SIZE+1]={ "MED_FOO_ATR1_3_________________________________________________1" \
00065 "MED_FOO_ATR1_3_________________________________________________2" };
00066
00067
00068
00069
00070
00071 _fid = MEDfileOpen("current.med",MODE_ACCES);
00072 if (_fid < 0) {
00073 MESSAGE("Erreur à la lecture du fichier current.med");
00074 return -1;
00075 }
00076
00077 if ( (_ret = MEDstructElementConstAttWr(_fid,
00078 _elementname1,
00079 _constattname1_1,
00080 _constatttype1_1,
00081 _ncomponent1_1,
00082 _entitytype1,
00083 _cstatrvalue1_1 )) < 0 ) {
00084 return _ret;
00085 }
00086
00087 if ( (_ret = MEDstructElementConstAttWr(_fid,
00088 _elementname1,
00089 _constattname1_2,
00090 _constatttype1_2,
00091 _ncomponent1_2,
00092 _entitytype1,
00093 _cstatrvalue1_2 )) < 0 ) {
00094 return _ret;
00095 }
00096
00097 if ( (_ret = MEDstructElementConstAttWr(_fid,
00098 _elementname1,
00099 _constattname1_3,
00100 _constatttype1_3,
00101 _ncomponent1_3,
00102 _entitytype1,
00103 _cstatrvalue1_3 )) < 0 ) {
00104 return _ret;
00105 }
00106
00107 if (MEDfileClose(_fid) < 0) {
00108 MESSAGE("ERROR : file closing");
00109 return -1;
00110 }
00111
00112 return _ret;
00113 }
00114