MED fichier

Test_MEDstructElementVarAttCr.c
Aller à la documentation de ce fichier.
1 /* This file is part of MED.
2 *
3 * COPYRIGHT (C) 1999 - 2021 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
19 #include <med.h>
20 #define MESGERR 1
21 #include <med_utils.h>
22 #include <string.h>
23
24 #ifdef DEF_LECT_ECR
25 #define MODE_ACCES MED_ACC_RDWR
26 #elif DEF_LECT_AJOUT
27 #define MODE_ACCES MED_ACC_RDEXT
28 #else
29 #define MODE_ACCES MED_ACC_CREAT
30 #endif
31
32 int main (int argc, char **argv)
33
34 {
35 med_err _ret=0;
36 med_idt _fid=0;
37 med_geometry_type _geotype=MED_NONE;
38
39 const char _elementname1[]="MED_BILLE";
40 med_int _elementdim1=3;
41 const char _supportmeshname1[]="MED_BILLE_SUPPORT";
42 med_entity_type _entitytype1=MED_NODE;
43 med_int _nnode1=1;
44 med_int _ncell1=0;
45 med_int _geocelltype1=MED_NONE;
46
47 const char _varattname1_1[MED_NAME_SIZE+1]="MED_VFOO_ATR1_1";
48 const med_attribute_type _varatttype1_1=MED_ATT_INT;
49 const med_int _ncomponent1_1=1;
50
51 const char _varattname1_2[MED_NAME_SIZE+1]="MED_VFOO_ATR1_2";
52 const med_attribute_type _varatttype1_2=MED_ATT_FLOAT64;
53 const med_int _ncomponent1_2=2;
54
55 const char _varattname1_3[MED_NAME_SIZE+1]="MED_VFOO_ATR1_3";
56 const med_attribute_type _varatttype1_3=MED_ATT_NAME;
57 const med_int _ncomponent1_3=1;
58
59
60 /* Ouverture en mode lecture du fichier Test_MEDstructuElement.med */
61 _fid = MEDfileOpen("current.med",MODE_ACCES);
62 if (_fid < 0) {
63 MESSAGE("Erreur à la lecture du fichier current.med");
64 return -1;
65 }
66
67 if ( (_ret = MEDstructElementVarAttCr(_fid,
68 _elementname1,
69 _varattname1_1,
70 _varatttype1_1,
71 _ncomponent1_1)) < 0 ) {
72 return _ret;
73 }
74
75 if ( (_ret = MEDstructElementVarAttCr(_fid,
76 _elementname1,
77 _varattname1_2,
78 _varatttype1_2,
79 _ncomponent1_2)) < 0 ) {
80 return _ret;
81 }
82
83 if ( (_ret = MEDstructElementVarAttCr(_fid,
84 _elementname1,
85 _varattname1_3,
86 _varatttype1_3,
87 _ncomponent1_3)) < 0 ) {
88 return _ret;
89 }
90
91 if (MEDfileClose(_fid) < 0) {
92 MESSAGE("ERROR : file closing");
93 return -1;
94 }
95
96 return _ret;
97
98 }
99
MEDfileOpen
MEDC_EXPORT med_idt MEDfileOpen(const char *const filename, const med_access_mode accessmode)
Ouverture d'un fichier MED.
Definition: MEDfileOpen.c:42
med_geometry_type
int med_geometry_type
Definition: med.h:194
med_idt
hid_t med_idt
Definition: med.h:331
med_err
herr_t med_err
Definition: med.h:332
med_entity_type
med_entity_type
Definition: med.h:143
MESSAGE
#define MESSAGE(chaine)
Definition: med_utils.h:324
MED_ATT_FLOAT64
Definition: med.h:173
med_int
int med_int
Definition: med.h:342
med_attribute_type
med_attribute_type
Definition: med.h:173
med.h
main
int main(int argc, char **argv)
Definition: Test_MEDstructElementVarAttCr.c:32
MED_NONE
#define MED_NONE
Definition: med.h:231
MODE_ACCES
#define MODE_ACCES
Definition: Test_MEDstructElementVarAttCr.c:29
MED_NODE
Definition: med.h:143
MED_ATT_NAME
Definition: med.h:175
MED_ATT_INT
Definition: med.h:174
MED_NAME_SIZE
#define MED_NAME_SIZE
Definition: med.h:81
MEDfileClose
MEDC_EXPORT med_err MEDfileClose(med_idt fid)
Fermeture d'un fichier MED.
Definition: MEDfileClose.c:30
MEDstructElementVarAttCr
MEDC_EXPORT med_err MEDstructElementVarAttCr(const med_idt fid, const char *const modelname, const char *const varattname, const med_attribute_type varatttype, const med_int ncomponent)
Cette routine déclare la présence d'un attribut caractéristique variable attaché aux éléments de type...
Definition: MEDstructElementVarAttCr.c:42
med_utils.h