| 1 |
/* This file is part of MED. |
| 2 |
* |
| 3 |
* COPYRIGHT (C) 1999 - 2020 EDF R&D, CEA/DEN |
| 4 |
* MED is free software: you can redistribute it and/or modify |
| 5 |
* it under the terms of the GNU Lesser General Public License as published by |
| 6 |
* the Free Software Foundation, either version 3 of the License, or |
| 7 |
* (at your option) any later version. |
| 8 |
* |
| 9 |
* MED is distributed in the hope that it will be useful, |
| 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
* GNU Lesser General Public License for more details. |
| 13 |
* |
| 14 |
* You should have received a copy of the GNU Lesser General Public License |
| 15 |
* along with MED. If not, see <http://www.gnu.org/licenses/>. |
| 16 |
*/ |
| 17 |
|
| 18 |
#include <med.h> |
| 19 |
#define MESGERR 1 |
| 20 |
#include <med_utils.h> |
| 21 |
#include <string.h> |
| 22 |
|
| 23 |
#ifdef DEF_LECT_ECR |
| 24 |
#define MODE_ACCES MED_ACC_RDWR |
| 25 |
#elif DEF_LECT_AJOUT |
| 26 |
#define MODE_ACCES MED_ACC_RDEXT |
| 27 |
#else |
| 28 |
#define MODE_ACCES MED_ACC_CREAT |
| 29 |
#endif |
| 30 |
|
| 31 |
int main (int argc, char **argv) |
| 32 |
|
| 33 |
{ |
| 34 |
med_err _ret=0; |
| 35 |
med_idt _fid=0; |
| 36 |
med_geometry_type _geotype=MED_NONE; |
| 37 |
|
| 38 |
const char _elementname1[]="MED_BILLE"; |
| 39 |
med_int _elementdim1=3; |
| 40 |
const char _supportmeshname1[]="MED_BILLE_SUPPORT"; |
| 41 |
med_entity_type _entitytype1=MED_NODE; |
| 42 |
med_int _nnode1=1; |
| 43 |
med_int _ncell1=0; |
| 44 |
med_int _geocelltype1=MED_NONE; |
| 45 |
/* med_int _nconstattribute1=0; */ |
| 46 |
/* med_int _nvariableattribute1=1; */ |
| 47 |
|
| 48 |
const char _elementname2[]="MED_PARTICULE"; |
| 49 |
med_int _elementdim2=3; |
| 50 |
const char _supportmeshname2[]=MED_NO_MESHNAME; |
| 51 |
med_entity_type _entitytype2=MED_NONE; |
| 52 |
med_int _nnode2=1; |
| 53 |
med_int _ncell2=0; |
| 54 |
med_int _geocelltype2=MED_NONE; |
| 55 |
/* med_int _nconstattribute2=0; */ |
| 56 |
/* med_int _nvariableattribute2=1; */ |
| 57 |
|
| 58 |
/* Ouverture en mode creation du fichier test2.med */ |
| 59 |
_fid = MEDfileOpen("current.med",MODE_ACCES); |
| 60 |
if (_fid < 0) { |
| 61 |
MESSAGE("Erreur a la creation du fichier current.med"); |
| 62 |
return -1; |
| 63 |
} |
| 64 |
|
| 65 |
_geotype = MEDstructElementCr(_fid, |
| 66 |
_elementname1, |
| 67 |
_elementdim1, |
| 68 |
_supportmeshname1, |
| 69 |
_entitytype1, |
| 70 |
_geocelltype1 |
| 71 |
/* _nconstattribute1, */ |
| 72 |
/* _nvariableattribute1 */ |
| 73 |
); |
| 74 |
|
| 75 |
ISCRUTE(_geotype); |
| 76 |
|
| 77 |
_geotype = MEDstructElementCr(_fid, |
| 78 |
_elementname2, |
| 79 |
_elementdim2, |
| 80 |
_supportmeshname2, |
| 81 |
_entitytype2, |
| 82 |
_geocelltype2 |
| 83 |
/* _nconstattribute2, */ |
| 84 |
/* _nvariableattribute2 */ |
| 85 |
); |
| 86 |
|
| 87 |
ISCRUTE(_geotype); |
| 88 |
|
| 89 |
|
| 90 |
if (MEDfileClose(_fid) < 0) { |
| 91 |
MESSAGE("ERROR : file closing"); |
| 92 |
return -1; |
| 93 |
} |
| 94 |
|
| 95 |
return _ret; |
| 96 |
|
| 97 |
|
| 98 |
} |
| 99 |
|