Test_MEDstructElementConstAttWithProfileWr.c

Aller à la documentation de ce fichier.
00001 /*  This file is part of MED.
00002  *
00003  *  COPYRIGHT (C) 1999 - 2015  EDF R&D, CEA/DEN
00004  *  MED is free software: you can redistribute it and/or modify
00005  *  it under the terms of the GNU Lesser General Public License as published by
00006  *  the Free Software Foundation, either version 3 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  MED is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU Lesser General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU Lesser General Public License
00015  *  along with MED.  If not, see <http://www.gnu.org/licenses/>.
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   /*0123456789012345678901234567890123456789012345678901234567890123*/
00064   const char                _cstatrvalue1_3[2*MED_NAME_SIZE+1]={ "MED_FOO_ATR1_3_________________________________________________1" \
00065                                                                  "MED_FOO_ATR1_3_________________________________________________2" };
00066 
00067   /*TODO : Tester avec un profil sur un maillage support*/
00068 
00069 
00070   /* Ouverture en mode lecture du fichier Test_MEDstructuElement.med */
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 

Généré le Thu Oct 8 14:26:17 2015 pour MED fichier par  doxygen 1.6.1