MED fichier: Fichier source de Test_MEDstructElementCr.c

MED fichier

Test_MEDstructElementCr.c
Aller à la documentation de ce fichier.
1 /* This file is part of MED.
2 *
3 * COPYRIGHT (C) 1999 - 2023 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
med_geometry_type
int med_geometry_type
Definition: med.h:196
med_idt
hid_t med_idt
Definition: med.h:333
med_err
herr_t med_err
Definition: med.h:334
med_entity_type
med_entity_type
Definition: med.h:145
main
int main(int argc, char **argv)
Definition: Test_MEDstructElementCr.c:31
MESSAGE
#define MESSAGE(chaine)
Definition: med_utils.h:324
med_int
int med_int
Definition: med.h:344
ISCRUTE
#define ISCRUTE(entier)
Definition: med_utils.h:313
MED_NO_MESHNAME
#define MED_NO_MESHNAME
Definition: med.h:272
MED_NONE
#define MED_NONE
Definition: med.h:233
MEDfileClose
MEDC_EXPORT med_err MEDfileClose(med_idt fid)
Fermeture d'un fichier MED.
Definition: MEDfileClose.c:30
MODE_ACCES
#define MODE_ACCES
Definition: Test_MEDstructElementCr.c:28
med_utils.h
MED_NODE
Definition: med.h:145
med.h
MEDstructElementCr
MEDC_EXPORT med_geometry_type MEDstructElementCr(const med_idt fid, const char *const modelname, const med_int modeldim, const char *const supportmeshname, const med_entity_type sentitytype, const med_geometry_type sgeotype)
Cette routine permet de créer un nouveau modèle d'éléments de structure dans un fichier MED.
Definition: MEDstructElementCr.c:50
MEDfileOpen
MEDC_EXPORT med_idt MEDfileOpen(const char *const filename, const med_access_mode accessmode)
Ouverture d'un fichier MED.
Definition: MEDfileOpen.c:42