# Test_MEDstructElementCr.c

Aller à la documentation de ce fichier.

    00001 /*  This file is part of MED.
    00002  *
    00003  *  COPYRIGHT (C) 1999 - 2012  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 #include <med.h>
    00019 #define MESGERR 1
    00020 #include <med_utils.h>
    00021 #include <string.h>
    00022
    00023 #ifdef DEF_LECT_ECR
    00024 #define MODE_ACCES MED_ACC_RDWR
    00025 #elif DEF_LECT_AJOUT
    00026 #define MODE_ACCES MED_ACC_RDEXT
    00027 #else
    00028 #define MODE_ACCES MED_ACC_CREAT
    00029 #endif
    00030
    00031 int main (int argc, char **argv)
    00032
    00033 {
    00034   med_err           _ret=0;
    00035   med_idt           _fid=0;
    00036   med_geometry_type _geotype=MED_NONE;
    00037
    00038   const char        _elementname1[]="MED_BILLE";
    00039   med_int           _elementdim1=3;
    00040   const char        _supportmeshname1[]="MED_BILLE_SUPPORT";
    00041   med_entity_type   _entitytype1=MED_NODE;
    00042   med_int           _nnode1=1;
    00043   med_int           _ncell1=0;
    00044   med_int           _geocelltype1=MED_NONE;
    00045 /*   med_int           _nconstattribute1=0; */
    00046 /*   med_int           _nvariableattribute1=1; */
    00047
    00048   const char        _elementname2[]="MED_PARTICULE";
    00049   med_int           _elementdim2=3;
    00050   const char        _supportmeshname2[]=MED_NO_MESHNAME;
    00051   med_entity_type   _entitytype2=MED_NONE;
    00052   med_int           _nnode2=1;
    00053   med_int           _ncell2=0;
    00054   med_int           _geocelltype2=MED_NONE;
    00055 /*   med_int           _nconstattribute2=0; */
    00056 /*   med_int           _nvariableattribute2=1; */
    00057
    00058  /* Ouverture en mode creation du fichier test2.med */
    00059   _fid = MEDfileOpen("current.med",MODE_ACCES);
    00060   if (_fid < 0) {
    00061     MESSAGE("Erreur a la creation du fichier current.med");
    00062     return -1;
    00063   }
    00064
    00065   _geotype = MEDstructElementCr(_fid,
    00066                                 _elementname1,
    00067                                 _elementdim1,
    00068                                 _supportmeshname1,
    00069                                 _entitytype1,
    00070                                 _geocelltype1
    00071 /*                              _nconstattribute1, */
    00072 /*                              _nvariableattribute1 */
    00073                                 );
    00074
    00075   ISCRUTE(_geotype);
    00076
    00077   _geotype = MEDstructElementCr(_fid,
    00078                                 _elementname2,
    00079                                 _elementdim2,
    00080                                 _supportmeshname2,
    00081                                 _entitytype2,
    00082                                 _geocelltype2
    00083 /*                              _nconstattribute2, */
    00084 /*                              _nvariableattribute2 */
    00085                                 );
    00086
    00087   ISCRUTE(_geotype);
    00088
    00089
    00090   if (MEDfileClose(_fid) < 0) {
    00091     MESSAGE("ERROR : file closing");
    00092     return -1;
    00093   }
    00094
    00095   return _ret;
    00096
    00097
    00098 }
    00099