MED fichier
Unittest_MEDparameter_3.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 parameter module
20 C *
21 C *****************************************************************************
22  program medparameter3
23 C
24  implicit none
25  include 'med.hf'
26 C
27 C
28  integer cret
29  integer fid
30  character*64 fname
31  parameter(fname = "Unittest_MEDparameter_1.med")
32  character*64 pname1,pname2,pname
33  parameter(pname1="first parameter name")
34  parameter(pname2="second parameter name")
35  integer type1,type2,type
36  parameter(type1=med_float64, type2=med_int)
37  character*200 desc1,desc2,desc
38  parameter(desc1="First parameter description")
39  parameter(desc2="Second parameter description")
40  character*16 dtunit1,dtunit2,dtunit
41  parameter(dtunit1="unit1")
42  parameter(dtunit2="unit2")
43  real*8 p1v1, p1v2,rv
44  parameter(p1v1=1.0,p1v2=2.0)
45  integer p1numdt1,p1numdt2,p2numdt1,p2numdt2,numdt
46  parameter(p1numdt1=med_no_dt,p1numdt2=1)
47  parameter(p2numdt1=2, p2numdt2=3)
48  real*8 dt1, dt2,dt
49  parameter(dt1=med_undef_dt,dt2=5.5)
50  integer p2v1,p2v2,iv
51  parameter(p2v1=3,p2v2=4)
52  integer p1numit1, p1numit2, p2numit1, p2numit2
53  integer numit
54  parameter(p1numit1=med_no_it, p1numit2=1)
55  parameter(p2numit1=2, p2numit2=3)
56  integer nstep1,nstep2,nstep,sit
57  parameter(nstep1=2,nstep2=2)
58  integer np,np1,it
59  parameter(np1=2)
60 C
61 C
62 C open file
63  call mfiope(fid,fname,med_acc_rdonly,cret)
64  print *,'Open file',cret
65  if (cret .ne. 0 ) then
66  print *,'ERROR : open file'
67  call efexit(-1)
68  endif
69 C
70 C
71 C number of parameter
72  call mprnpr(fid,np,cret)
73  print *,'Number of parameter',cret
74  if ((cret .ne. 0) .or.
75  & (np .ne. np1)) then
76  print *,'ERROR : number of parameter'
77  call efexit(-1)
78  endif
79 C
80 C
81 C read parameters
82  do it=1,np
83 c
84  call mprpri(fid,it,pname,type,desc,
85  & dtunit,nstep,cret)
86  print *,'interpolation information',cret
87  if (cret .ne. 0 ) then
88  print *,'ERROR : interpolation information'
89  call efexit(-1)
90  endif
91 c
92 c if (it .eq. 1) then
93 c if ((pname .ne. pname1) .or.
94 c & (type .ne. type1) .or.
95 c & (desc .ne. desc1) .or.
96 c & (dtunit .ne. dtunit1) .or.
97 c & (nstep .ne. nstep1)) then
98 c print *,'ERROR : interpolation information'
99 c call efexit(-1)
100 c endif
101 c endif
102 c
103 c if (it .eq. 2) then
104 c if ((pname .ne. pname2) .or.
105 c & (type .ne. type2) .or.
106 c & (desc .ne. desc2) .or.
107 c & (dtunit .ne. dtunit2) .or.
108 c & (nstep .ne. nstep2)) then
109 c print *,'ERROR : interpolation information'
110 c call efexit(-1)
111 c endif
112 c endif
113 c
114  do sit=1,nstep
115 c
116  call mprcsi(fid,pname,sit,numdt,numit,
117  & dt,cret)
118  print *,'computation step information',cret
119  if (cret .ne. 0 ) then
120  print *,'ERROR : computation step information'
121  call efexit(-1)
122  endif
123 c
124 c if ((pname .eq. pname1) .and.
125 c & (sit .eq. 1)) then
126 c if ((numdt .ne. p1numdt1) .or.
127 c & (numit .ne. p1numit1) .or.
128 c & (dt .ne. dt1)) then
129 c print *,'ERROR : read value'
130 c call efexit(-1)
131 c endif
132 c endif
133 c
134 c if ((pname .eq. pname1) .and.
135 c & (sit .eq. 2)) then
136 c if ((numdt .ne. p1numdt2) .or.
137 c & (numit .ne. p1numit2) .or.
138 c & (dt .ne. dt2)) then
139 c print *,'ERROR : read value'
140 c call efexit(-1)
141 c endif
142 c endif
143 c
144 c if ((pname .eq. pname2) .and.
145 c & (sit .eq. 1)) then
146 c if ((numdt .ne. p2numdt1) .or.
147 c & (numit .ne. p2numit1) .or.
148 c & (dt .ne. dt1)) then
149 c print *,'ERROR : read value'
150 c call efexit(-1)
151 c endif
152 c endif
153 c
154 c if ((pname .eq. pname2) .and.
155 c & (sit .eq. 2)) then
156 c if ((numdt .ne. p2numdt2) .or.
157 c & (numit .ne. p2numit2) .or.
158 c & (dt .ne. dt2)) then
159 c print *,'ERROR : read value'
160 c call efexit(-1)
161 c endif
162 c endif
163 c
164 c if (type .eq. MED_INT) then
165 c call mprivr(fid,pname,numdt,numit,iv,cret)
166 c print *,'read value',cret
167 c if (cret .ne. 0 ) then
168 c print *,'ERROR : read value'
169 c call efexit(-1)
170 c endif
171 c
172 c if ((sit .eq. 1) .and.
173 c & (iv .ne. p2v1)) then
174 c print *,'ERROR : read value'
175 c call efexit(-1)
176 c endif
177 c
178 c if ((sit .eq. 2) .and.
179 c & (iv .ne. p2v2)) then
180 c print *,'ERROR : read value'
181 c call efexit(-1)
182 c endif
183 c else
184 c call mprrvr(fid,pname,numdt,numit,rv,cret)
185 c print *,'read value',cret
186 c if (cret .ne. 0 ) then
187 c print *,'ERROR : read value'
188 c call efexit(-1)
189 c endif
190 c
191 c if ((sit .eq. 1) .and.
192 c & (rv .ne. p1v1)) then
193 c print *,'ERROR : read value'
194 c call efexit(-1)
195 c endif
196 c
197 c if ((sit .eq. 2) .and.
198 c & (rv .ne. p1v2)) then
199 c print *,'ERROR : read value'
200 c call efexit(-1)
201 c endif
202 c endif
203  enddo
204 c
205  enddo
206 C
207 C
208 C close file
209  call mficlo(fid,cret)
210  print *,'Close file',cret
211  if (cret .ne. 0 ) then
212  print *,'ERROR : close file'
213  call efexit(-1)
214  endif
215 C
216 C
217 C
218  end
219 
double med_float64
Definition: med.h:330
subroutine mprpri(fid, it, name, type, desc, dtunit, nstep, cret)
Cette routine permet la lecture des informations relatives à un paramètre scalaire via un itérateur...
Definition: medparameter.f:128
subroutine mficlo(fid, cret)
Fermeture d'un fichier MED.
Definition: medfile.f:80
subroutine mprnpr(fid, n, cret)
Cette routine permet la lecture du nombre de paramètre numérique scalaire dans un fichier...
Definition: medparameter.f:106
int med_int
Definition: med.h:335
subroutine mprcsi(fid, name, it, numdt, numit, dt, cret)
Cette routine permet la lecture des informations relatives à une séquence de calcul du paramètre numé...
Definition: medparameter.f:166
program medparameter3
subroutine mfiope(fid, name, access, cret)
Ouverture d'un fichier MED.
Definition: medfile.f:41