MED fichier: Fichier source de Test_MEDstructElementConstAttWithProfileWr.c

MED fichier

- Documentation MED
- Guides d'utilisation
- Guides de référence

Test_MEDstructElementConstAttWithProfileWr.c
Aller à la documentation de ce fichier.
1 /* This file is part of MED.
2 *
3 * COPYRIGHT (C) 1999 - 2017 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 _constattname1_1[MED_NAME_SIZE+1]="MED_FOO_ATR1_1";
48 const med_attribute_type _constatttype1_1=MED_ATT_INT;
49 const med_int _ncomponent1_1=2;
50 const char _profilename1_1[MED_NAME_SIZE+1]=MED_NO_PROFILE;
51 const med_int _cstatrvalue1_1[2]={ 20 , 21 };
52
53 const char _constattname1_2[MED_NAME_SIZE+1]="MED_FOO_ATR1_2";
54 const med_attribute_type _constatttype1_2=MED_ATT_FLOAT64;
55 const med_int _ncomponent1_2=2;
56 const char _profilename1_2[MED_NAME_SIZE+1]=MED_NO_PROFILE;
57 const med_float _cstatrvalue1_2[2]={ 20.1 , 21.2 };
58
59 const char _constattname1_3[MED_NAME_SIZE+1]="MED_FOO_ATR1_3";
60 const med_attribute_type _constatttype1_3=MED_ATT_NAME;
61 const med_int _ncomponent1_3=2;
62 const char _profilename1_3[MED_NAME_SIZE+1]=MED_NO_PROFILE;
63 /*0123456789012345678901234567890123456789012345678901234567890123*/
64 const char _cstatrvalue1_3[2*MED_NAME_SIZE+1]={ "MED_FOO_ATR1_3_________________________________________________1" \
65 "MED_FOO_ATR1_3_________________________________________________2" };
66
67 /*TODO : Tester avec un profil sur un maillage support*/
68
69
70 /* Ouverture en mode lecture du fichier Test_MEDstructuElement.med */
71 _fid = MEDfileOpen("current.med",MODE_ACCES);
72 if (_fid < 0) {
73 MESSAGE("Erreur à la lecture du fichier current.med");
74 return -1;
75 }
76
77 if ( (_ret = MEDstructElementConstAttWr(_fid,
78 _elementname1,
79 _constattname1_1,
80 _constatttype1_1,
81 _ncomponent1_1,
82 _entitytype1,
83 _cstatrvalue1_1 )) < 0 ) {
84 return _ret;
85 }
86
87 if ( (_ret = MEDstructElementConstAttWr(_fid,
88 _elementname1,
89 _constattname1_2,
90 _constatttype1_2,
91 _ncomponent1_2,
92 _entitytype1,
93 _cstatrvalue1_2 )) < 0 ) {
94 return _ret;
95 }
96
97 if ( (_ret = MEDstructElementConstAttWr(_fid,
98 _elementname1,
99 _constattname1_3,
100 _constatttype1_3,
101 _ncomponent1_3,
102 _entitytype1,
103 _cstatrvalue1_3 )) < 0 ) {
104 return _ret;
105 }
106
107 if (MEDfileClose(_fid) < 0) {
108 MESSAGE("ERROR : file closing");
109 return -1;
110 }
111
112 return _ret;
113 }
114
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_MEDstructElementConstAttWithProfileWr.c:29
med_err
herr_t med_err
Definition: med.h:325
MED_NODE
Definition: med.h:139
MESSAGE
#define MESSAGE(chaine)
Definition: med_utils.h:316
MED_ATT_INT
Definition: med.h:169
med_float
double med_float
Definition: med.h:329
med.h
med_entity_type
med_entity_type
Definition: med.h:139
MED_NONE
#define MED_NONE
Definition: med.h:226
med_int
int med_int
Definition: med.h:335
MED_ATT_FLOAT64
Definition: med.h:168
MED_ATT_NAME
Definition: med.h:170
MED_NO_PROFILE
#define MED_NO_PROFILE
Definition: med.h:276
MEDstructElementConstAttWr
MEDC_EXPORT med_err MEDstructElementConstAttWr(const med_idt fid, const char *const modelname, const char *const constattname, const med_attribute_type constatttype, const med_int ncomponent, const med_entity_type sentitytype, const void *const value)
Cette routine définit un attribut caractéristique constant d'un modèle d'éléments de structure...
Definition: MEDstructElementConstAttWr.c:43
MEDfileOpen
MEDC_EXPORT med_idt MEDfileOpen(const char *const filename, const med_access_mode accessmode)
Ouverture d'un fichier MED.
Definition: MEDfileOpen.c:41
med_idt
hid_t med_idt
Definition: med.h:324
main
int main(int argc, char **argv)
Definition: Test_MEDstructElementConstAttWithProfileWr.c:32
MED_NAME_SIZE
#define MED_NAME_SIZE
Definition: med.h:77
med_utils.h
med_geometry_type
int med_geometry_type
Definition: med.h:189
med_attribute_type
med_attribute_type
Definition: med.h:168