MED fichier
test9.f90
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 ! * - Nom du fichier : test9.f90
20 ! *
21 ! * - Description : lecture des familles d'un maillage MED
22 ! *
23 ! ******************************************************************************
24 program test9
25 
26  implicit none
27  include 'med.hf90'
28 !
29  integer ret,cret,fid
30  character*64 maa
31  integer mdim,sdim
32  integer nfam
33  integer i,j
34  integer ngro,natt
35  character*80, allocatable, dimension (:) :: gro
36  integer, allocatable, dimension (:) :: attid
37  integer, allocatable, dimension (:) :: attval
38  character*200, allocatable, dimension (:) :: attdes
39  character*200 desc
40  character*64 nomfam
41  integer numfam
42  integer type
43  character(16) :: dtunit
44  integer nstep, stype, atype
45  character*16 nomcoo(2)
46  character*16 unicoo(2)
47 
48 
49 ! ** Ouverture du fichier test8.med en lecture seule **
50  call mfiope(fid,'test8.med',med_acc_rdonly, cret)
51  print *,cret
52 
53 ! ** Lecture des infos sur le 1er maillage **
54  if (cret.eq.0) then
55  call mmhmii(fid,1,maa,sdim,mdim,type,desc,dtunit,stype,nstep,atype,nomcoo,unicoo,cret)
56  print *,"Maillage de nom : ",maa," et de dimension : ", mdim
57  endif
58  print *,cret
59 
60 ! ** Lecture du nombre de famille **
61  if (cret .eq. 0) then
62  call mfanfa(fid,maa,nfam,cret)
63  print *,' Nombre de familles a lire : ',nfam
64  endif
65  print *,cret
66 
67 ! ** Lecture de chaque famille **
68  if (cret .eq. 0) then
69  do i=1,nfam
70 
71 ! ** Lecture du nombre de groupe **
72  if (cret .eq. 0) then
73  call mfanfg(fid,maa,i,ngro,cret)
74  endif
75  print *,cret
76 
77 ! ** Lecture du nombre d'attributs pour les
78 ! fichiers 2.3 **
79  if (cret .eq. 0) then
80  call mfaona(fid,maa,i,natt,cret)
81  endif
82  print *,cret
83 
84  print *,"Famille ",i," a ",ngro," groupes et ", natt, " attributs"
85 
86 ! ** Lecture de : nom,numero,attributs,groupes **
87  if (cret .eq. 0) then
88  allocate(gro(ngro), attid(natt), attval(natt), attdes(natt),stat=ret)
89  print *,ret
90 
91  call mfaofi(fid,maa,i,nomfam,attid,attval,attdes,numfam,gro,cret)
92  print *,cret
93  print *,"Famille de nom ",nomfam," et de numero ",numfam
94  do j=1,natt
95  print *,"attid = ", attid(j)
96  print *,"attval = ", attval(j)
97  print *,"attdes =", attdes(j)
98  enddo
99  do j=1,ngro
100  print *,"gro = ",gro(j)
101  enddo
102 
103  deallocate(gro, attval, attid, attdes)
104  endif
105  enddo
106  endif
107 
108 
109 ! ** Fermeture du fichier **
110  call mficlo(fid,cret)
111  print *,cret
112 
113 ! ** Code retour
114  call efexit(cret)
115 
116  end program test9
117 
118 
subroutine mficlo(fid, cret)
Definition: medfile.f:80
subroutine mfaofi(fid, maa, it, fam, attnum, attval, attdes, num, gro, cret)
Definition: medfamily.f:126
subroutine mfaona(fid, maa, it, n, cret)
Definition: medfamily.f:102
subroutine mfanfg(fid, maa, it, n, cret)
Definition: medfamily.f:61
program test9
Definition: test9.f90:24
subroutine mmhmii(fid, it, name, sdim, mdim, mtype, desc, dtunit, stype, nstep, atype, aname, aunit, cret)
Definition: medmesh.f:110
subroutine mfanfa(fid, maa, n, cret)
Definition: medfamily.f:38
subroutine mfiope(fid, name, access, cret)
Definition: medfile.f:41