MED fichier: Fichier source de Test_MEDstructElementInfoByName.c

MED fichier

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

Test_MEDstructElementInfoByName.c
Aller à la documentation de ce fichier.
1 /* This file is part of MED.
2 *
3 * COPYRIGHT (C) 1999 - 2019 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 char _elementname1[MED_NAME_SIZE+1]="MED_PARTICULE";
40 med_int _elementdim1=3;
41 char _supportmeshname1[MED_NAME_SIZE+1]="";
42 med_entity_type _entitytype1=MED_UNDEF_ENTITY_TYPE;
43 med_int _nnode1=0;
44 med_int _ncell1=0;
45 med_int _geocelltype1=MED_NONE;
46 med_int _nconstantatribute1=0;
47 med_bool _anyprofile1=0;
48 med_int _nvariableattribute1=0;
49
50
51 /* Ouverture en mode lecture du fichier Test_MEDstructuElement.med */
52 _fid = MEDfileOpen("current.med",MED_ACC_RDONLY);
53 if (_fid < 0) {
54 MESSAGE("Erreur à la lecture du fichier current.med");
55 return -1;
56 }
57
58 if (
59 MEDstructElementInfoByName(_fid,
60 _elementname1,
61 &_geotype,
62 &_elementdim1,
63 _supportmeshname1,
64 &_entitytype1,
65 &_nnode1,
66 &_ncell1,
67 &_geocelltype1,
68 &_nconstantatribute1,
69 &_anyprofile1,
70 &_nvariableattribute1
71 )
72 ) return -1;
73
74 fprintf(stdout,"Elément de structure |%s| de type géométrique n° %d et de dimension %d\n",_elementname1,_geotype,_elementdim1);
75 if ( strlen(_supportmeshname1) ) {
76 fprintf(stdout,"\t Maillage support de nom |%s|",_supportmeshname1);
77 if (_ncell1)
78 fprintf(stdout," avec %d mailles de type %d et ",_ncell1,_geocelltype1);
79 if (_nnode1)
80 fprintf(stdout," avec %d noeuds\n",_nnode1);
81 else {
82 fprintf(stderr,"\n Erreur : les noeuds doivent être définis s'il existe un maillage support\n");
83 }
84 } else
85 fprintf(stdout," avec support implicite sur noeud\n");
86
87
88
89 if (MEDfileClose(_fid) < 0) {
90 MESSAGE("ERROR : file closing");
91 return -1;
92 }
93
94 return _ret;
95
96
97 }
98
med_err
herr_t med_err
Definition: med.h:327
med_utils.h
MEDfileOpen
MEDC_EXPORT med_idt MEDfileOpen(const char *const filename, const med_access_mode accessmode)
Ouverture d'un fichier MED.
Definition: MEDfileOpen.c:41
MESSAGE
#define MESSAGE(chaine)
Definition: med_utils.h:316
MEDfileClose
MEDC_EXPORT med_err MEDfileClose(med_idt fid)
Fermeture d'un fichier MED.
Definition: MEDfileClose.c:30
med_entity_type
med_entity_type
Definition: med.h:141
MED_NONE
#define MED_NONE
Definition: med.h:228
med_int
int med_int
Definition: med.h:337
MED_UNDEF_ENTITY_TYPE
Definition: med.h:143
main
int main(int argc, char **argv)
Definition: Test_MEDstructElementInfoByName.c:32
MEDstructElementInfoByName
MEDC_EXPORT med_err MEDstructElementInfoByName(const med_idt fid, const char *const modelname, med_geometry_type *const mgeotype, med_int *const modeldim, char *const supportmeshname, med_entity_type *const sentitytype, med_int *const snnode, med_int *const sncell, med_geometry_type *const sgeotype, med_int *const nconstantatribute, med_bool *const anyprofile, med_int *const nvariableattribute)
Cette routine décrit les caractéristiques d'un modèle d'élément de structure à partir de son nom...
Definition: MEDstructElementInfoByName.c:49
med_idt
hid_t med_idt
Definition: med.h:326
MED_NAME_SIZE
#define MED_NAME_SIZE
Definition: med.h:79
med.h
med_bool
med_bool
Definition: med.h:257
med_geometry_type
int med_geometry_type
Definition: med.h:191
MED_ACC_RDONLY
Definition: med.h:118