MED fichier
Unittest_MEDprofile_2.f
Aller à la documentation de ce fichier.
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 * Tests for profile module
20 C *
21 C *****************************************************************************
22  program medprofile2
23 C
24  implicit none
25  include 'med.hf'
26 C
27 C
28  integer cret
29  integer fid
30  character*64 fname, pname1, pname2
31  parameter(fname="Unittest_MEDprofile_1.med")
32  parameter(pname1="Profile name1")
33  parameter(pname2="Profile name 2")
34  integer psize1,psize2
35  parameter(psize1=4, psize2=2)
36  integer profile1(4), profile2(2)
37  data profile1 /1,2, 3,4/
38  data profile2 /5,6/
39  integer npro,n
40  parameter(npro=2)
41  integer it,psize
42  character*64 pname
43  integer profile(4)
44 C
45 C
46 C open file
47  call mfiope(fid,fname,med_acc_rdonly,cret)
48  print *,cret
49  if (cret .ne. 0 ) then
50  print *,'ERROR : open file'
51  call efexit(-1)
52  endif
53 C
54 C
55 C how many profile
56  call mpfnpf(fid,n,cret)
57  print *,cret
58  print *,n
59  if (cret .ne. 0 ) then
60  print *,'ERROR : number of profile'
61  call efexit(-1)
62  endif
63  if (n .ne. npro) then
64  print *,'ERROR : number of profile'
65  call efexit(-1)
66  endif
67 C
68 C
69 C Read profile(s) name and size
70 C Then read profile array
71  do it=1,n
72  call mpfpfi(fid,it,pname,psize,cret)
73  print *,cret
74  if (cret .ne. 0 ) then
75  print *,'ERROR : name and size of profile'
76  call efexit(-1)
77  endif
78 c
79  call mpfprr(fid,pname,profile,cret)
80  print *,cret
81  if (cret .ne. 0 ) then
82  print *,'ERROR : read profile'
83  call efexit(-1)
84  endif
85 c
86  if (it .eq. 1) then
87  if ((pname .ne. pname2) .or.
88  & (psize .ne. psize2)) then
89  print *,'ERROR : name and size of profile'
90  call efexit(-1)
91  endif
92  if ((profile(1) .ne. profile2(1)) .or.
93  & (profile(2) .ne. profile2(2))) then
94  print *,'ERROR : profile array'
95  call efexit(-1)
96  endif
97  endif
98 c
99  if (it .eq. 2) then
100  if ((pname .ne. pname1) .or.
101  & (psize .ne. psize1)) then
102  print *,'ERROR : name and size of profile'
103  call efexit(-1)
104  endif
105  if ((profile(1) .ne. profile1(1)) .or.
106  & (profile(2) .ne. profile1(2)) .or.
107  & (profile(3) .ne. profile1(3)) .or.
108  & (profile(4) .ne. profile1(4)) )then
109  print *,'ERROR : profile array'
110  call efexit(-1)
111  endif
112  endif
113  enddo
114 C
115 C
116 C read profile size by the name
117  call mpfpsn(fid,pname1,psize,cret)
118  print *,cret
119  if (cret .ne. 0 ) then
120  print *,'ERROR : size of profile'
121  call efexit(-1)
122  endif
123 c
124  if (psize .ne. psize1) then
125  print *,'ERROR : size of profile'
126  call efexit(-1)
127  endif
128 c
129  call mpfpsn(fid,pname2,psize,cret)
130  print *,cret
131  if (cret .ne. 0 ) then
132  print *,'ERROR : size of profile'
133  call efexit(-1)
134  endif
135 c
136  if (psize .ne. psize2) then
137  print *,'ERROR : size of profile'
138  call efexit(-1)
139  endif
140 C
141 C
142 C close file
143  call mficlo(fid,cret)
144  print *,cret
145  if (cret .ne. 0 ) then
146  print *,'ERROR : close file'
147  call efexit(-1)
148  endif
149 C
150 C
151 C
152  end
153 
program medprofile2
subroutine mficlo(fid, cret)
Fermeture d'un fichier MED.
Definition: medfile.f:80
subroutine mpfpfi(fid, it, pname, psize, cret)
Cette routine permet de lire les informations sur un profil dans un fichier MED.
Definition: medprofile.f:59
subroutine mpfpsn(fid, pname, psize, cret)
Cette routine permet de lire la taille d'un profil dont on connait le nom.
Definition: medprofile.f:76
subroutine mpfprr(fid, pname, profil, cret)
Cette routine permet de lire un profil dans un fichier MED.
Definition: medprofile.f:93
subroutine mpfnpf(fid, n, cret)
Cette routine permet de lire le nombre de profil dans un fichier MED.
Definition: medprofile.f:38
subroutine mfiope(fid, name, access, cret)
Ouverture d'un fichier MED.
Definition: medfile.f:41