| 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 |
|
| 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_geometry_type _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 |
|