Test_MEDstructElementVarAttCr.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                _varattname1_1[MED_NAME_SIZE+1]="MED_VFOO_ATR1_1";
00048   const med_attribute_type  _varatttype1_1=MED_ATT_INT;
00049   const med_int             _ncomponent1_1=1;
00050 
00051   const char                _varattname1_2[MED_NAME_SIZE+1]="MED_VFOO_ATR1_2";
00052   const med_attribute_type  _varatttype1_2=MED_ATT_FLOAT64;
00053   const med_int             _ncomponent1_2=2;
00054 
00055   const char                _varattname1_3[MED_NAME_SIZE+1]="MED_VFOO_ATR1_3";
00056   const med_attribute_type  _varatttype1_3=MED_ATT_NAME;
00057   const med_int             _ncomponent1_3=1;
00058 
00059 
00060   /* Ouverture en mode lecture du fichier Test_MEDstructuElement.med */
00061   _fid = MEDfileOpen("current.med",MODE_ACCES);
00062   if (_fid < 0) {
00063     MESSAGE("Erreur à la lecture du fichier current.med");
00064     return -1;
00065   }
00066 
00067   if ( (_ret = MEDstructElementVarAttCr(_fid,
00068                                         _elementname1,
00069                                         _varattname1_1,
00070                                         _varatttype1_1,
00071                                         _ncomponent1_1)) < 0 ) {
00072     return _ret;
00073   }
00074 
00075   if ( (_ret = MEDstructElementVarAttCr(_fid,
00076                                         _elementname1,
00077                                         _varattname1_2,
00078                                         _varatttype1_2,
00079                                         _ncomponent1_2)) < 0 ) {
00080     return _ret;
00081   }
00082 
00083   if ( (_ret = MEDstructElementVarAttCr(_fid,
00084                                         _elementname1,
00085                                         _varattname1_3,
00086                                         _varatttype1_3,
00087                                         _ncomponent1_3)) < 0 ) {
00088     return _ret;
00089   }
00090 
00091   if (MEDfileClose(_fid) < 0) {
00092     MESSAGE("ERROR : file closing");
00093     return -1;
00094   }
00095 
00096   return _ret;
00097 
00098 }
00099 

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