MED fichier
Unittest_MEDparameter_1.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 paramter module
20 C *
21 C *****************************************************************************
22  program medparameter1
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
33  parameter(pname1="first parameter name")
34  parameter(pname2="second parameter name")
35  integer type1,type2
36  parameter(type1=med_float64, type2=med_int)
37  character*200 desc1,desc2
38  parameter(desc1="First parameter description")
39  parameter(desc2="Second parameter description")
40  character*16 dtunit1,dtunit2
41  parameter(dtunit1="unit1")
42  parameter(dtunit2="unit2")
43  real*8 p1v1, p1v2
44  parameter(p1v1=1.0,p1v2=2.0)
45  integer p1numdt1,p1numdt2,p2numdt1,p2numdt2
46  parameter(p1numdt1=med_no_dt,p1numdt2=1)
47  parameter(p2numdt1=2, p2numdt2=3)
48  real*8 dt1, dt2
49  parameter(dt1=med_undef_dt,dt2=5.5)
50  integer p2v1,p2v2
51  parameter(p2v1=3,p2v2=4)
52  integer p1numit1, p1numit2, p2numit1, p2numit2
53  parameter(p1numit1=med_no_it, p1numit2=1)
54  parameter(p2numit1=2, p2numit2=3)
55 C
56 C
57 C file creation
58  call mfiope(fid,fname,med_acc_creat,cret)
59  print *,'Open file',cret
60  if (cret .ne. 0 ) then
61  print *,'ERROR : file creation'
62  call efexit(-1)
63  endif
64 C
65 C
66 C first parameter creation
67  call mprcre(fid,pname1,type1,desc1,dtunit1,cret)
68  print *,'parameter creation',cret
69  if (cret .ne. 0 ) then
70  print *,'ERROR : parameter creation'
71  call efexit(-1)
72  endif
73 C
74 C
75 C write values
76  call mprrvw(fid,pname1,p1numdt1,p1numit1,dt1,p1v1,cret)
77  print *,'write value',cret
78  if (cret .ne. 0 ) then
79  print *,'ERROR : write value'
80  call efexit(-1)
81  endif
82 c
83  call mprrvw(fid,pname1,p1numdt2,p1numit2,dt2,p1v2,cret)
84  print *,'write value',cret
85  if (cret .ne. 0 ) then
86  print *,'ERROR : write value'
87  call efexit(-1)
88  endif
89 C
90 C
91 C second parameter creation
92  call mprcre(fid,pname2,type2,desc2,dtunit2,cret)
93  print *,'parameter creation',cret
94  if (cret .ne. 0 ) then
95  print *,'ERROR : parameter creation'
96  call efexit(-1)
97  endif
98 C
99 C
100 C write values
101  call mprivw(fid,pname2,p2numdt1,p2numit1,dt1,p2v1,cret)
102  print *,'write value',cret
103  if (cret .ne. 0 ) then
104  print *,'ERROR : write value'
105  call efexit(-1)
106  endif
107 c
108  call mprivw(fid,pname2,p2numdt2,p2numit2,dt2,p2v2,cret)
109  print *,'write value',cret
110  if (cret .ne. 0 ) then
111  print *,'ERROR : write value'
112  call efexit(-1)
113  endif
114 C
115 C
116 C close file
117  call mficlo(fid,cret)
118  print *,'Close file',cret
119  if (cret .ne. 0 ) then
120  print *,'ERROR : close file'
121  call efexit(-1)
122  endif
123 C
124 C
125 C
126  end
127 
double med_float64
Definition: med.h:330
subroutine mprrvw(fid, name, numdt, numit, dt, val, cret)
Cette routine permet l'écriture de la valeur d'un paramètre numérique scalaire.
Definition: medparameter.f:37
program medparameter1
subroutine mprcre(fid, name, type, des, dtunit, cret)
Cette routine permet la création d'un paramètre numérique scalaire.
Definition: medparameter.f:19
subroutine mficlo(fid, cret)
Fermeture d'un fichier MED.
Definition: medfile.f:80
subroutine mprivw(fid, name, numdt, numit, dt, val, cret)
Cette routine permet l'écriture de la valeur d'un paramètre numérique scalaire.
Definition: medparameter.f:54
int med_int
Definition: med.h:335
subroutine mfiope(fid, name, access, cret)
Ouverture d'un fichier MED.
Definition: medfile.f:41