MED fichier
f/2.3.6/test3.f
1 C* This file is part of MED.
2 C*
3 C* COPYRIGHT (C) 1999 - 2017 EDF R&D, CEA/DEN
4 C* MED is free software: you can redistribute it and/or modify
5 C* it under the terms of the GNU Lesser General Public License as published by
6 C* the Free Software Foundation, either version 3 of the License, or
7 C* (at your option) any later version.
8 C*
9 C* MED is distributed in the hope that it will be useful,
10 C* but WITHOUT ANY WARRANTY; without even the implied warranty of
11 C* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 C* GNU Lesser General Public License for more details.
13 C*
14 C* You should have received a copy of the GNU Lesser General Public License
15 C* along with MED. If not, see <http://www.gnu.org/licenses/>.
16 C*
17 
18 C ******************************************************************************
19 C * - Nom du fichier : test3.f
20 C *
21 C * - Description : lecture des informations sur les maillages dans un fichier
22 C* MED.
23 C *
24 C ******************************************************************************
25  program test3
26 C
27  implicit none
28  include 'med.hf'
29 C
30 C
31  integer cret,fid,cres,type,cnu
32  character*32 maa
33  character*80 nomu
34  character*200 desc
35  integer nmaa,i,mdim,edim
36 
37 C ** Ouverture du fichier en lecture seule
38  call efouvr(fid,'test2.med',med_lecture, cret)
39  print *,cret
40  if (cret .ne. 0 ) then
41  print *,'Erreur ouverture du fichier en lecture'
42  call efexit(-1)
43  endif
44 
45 C ** lecture du nombre de maillage **
46  call efnmaa(fid,nmaa,cret)
47  print *,cret
48  if (cret .ne. 0 ) then
49  print *,'Erreur lecture du nombre de maillage'
50  call efexit(-1)
51  endif
52  print *,'Nombre de maillages = ',nmaa
53 
54 C ** lecture des infos sur les maillages : **
55 C ** - nom, dimension, type,description
56 C ** - options : nom universel, dimension de l'espace
57  do i=1,nmaa
58  call efmaai(fid,i,maa,mdim,type,desc,cret)
59  edim = -1
60  call efespl(fid,maa,edim,cres)
61  call efunvl(fid,maa,nomu,cnu)
62  print *,cret
63  if (cret .ne. 0 ) then
64  print *,'Erreur acces au maillage'
65  call efexit(-1)
66  endif
67  print '(A,I1,A,A4,A,I1,A,A65,A65)','maillage '
68  & ,i,' de nom ',maa,' et de dimension ',mdim,
69  & ' de description ',desc
70  if (type.eq.med_non_structure) then
71  print *,'Maillage non structure'
72  else
73  print *,'Maillage structure'
74  endif
75  if (cres.eq.0) then
76  print *,'Dimension espace ', edim
77  else
78  print *,'Dimension espace ', mdim
79  endif
80  if (cnu.eq.0) then
81  print *,'Nom universel : ',nomu
82  else
83  print *,'Pas de nom universel'
84  endif
85  enddo
86 
87 C ** fermeture du fichier
88  call efferm (fid,cret)
89  print *,cret
90  if (cret .ne. 0 ) then
91  print *,'Erreur fermeture du fichier'
92  call efexit(-1)
93  endif
94 C
95  end
96