MED fichier
Unittest_MEDparameter_1.f
Aller à la documentation de ce fichier.
1C* This file is part of MED.
2C*
3C* COPYRIGHT (C) 1999 - 2020 EDF R&D, CEA/DEN
4C* MED is free software: you can redistribute it and/or modify
5C* it under the terms of the GNU Lesser General Public License as published by
6C* the Free Software Foundation, either version 3 of the License, or
7C* (at your option) any later version.
8C*
9C* MED is distributed in the hope that it will be useful,
10C* but WITHOUT ANY WARRANTY; without even the implied warranty of
11C* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12C* GNU Lesser General Public License for more details.
13C*
14C* You should have received a copy of the GNU Lesser General Public License
15C* along with MED. If not, see <http://www.gnu.org/licenses/>.
16C*
17
18C******************************************************************************
19C * Tests for paramter module
20C *
21C *****************************************************************************
23C
24 implicit none
25 include 'med.hf'
26C
27C
28 integer cret
29 integer*8 fid
30
31 character*64 fname
32 parameter(fname = "Unittest_MEDparameter_1.med")
33 character*64 pname1,pname2
34 parameter(pname1="first parameter name")
35 parameter(pname2="second parameter name")
36 integer type1,type2
37 parameter(type1=med_float64, type2=med_int)
38 character*200 desc1,desc2
39 parameter(desc1="First parameter description")
40 parameter(desc2="Second parameter description")
41 character*16 dtunit1,dtunit2
42 parameter(dtunit1="unit1")
43 parameter(dtunit2="unit2")
44 real*8 p1v1, p1v2
45 parameter(p1v1=1.0,p1v2=2.0)
46 integer p1numdt1,p1numdt2,p2numdt1,p2numdt2
47 parameter(p1numdt1=med_no_dt,p1numdt2=1)
48 parameter(p2numdt1=2, p2numdt2=3)
49 real*8 dt1, dt2
50 parameter(dt1=med_undef_dt,dt2=5.5)
51 integer p2v1,p2v2
52 parameter(p2v1=3,p2v2=4)
53 integer p1numit1, p1numit2, p2numit1, p2numit2
54 parameter(p1numit1=med_no_it, p1numit2=1)
55 parameter(p2numit1=2, p2numit2=3)
56C
57C
58C file creation
59 call mfiope(fid,fname,med_acc_creat,cret)
60 print *,'Open file',cret
61 if (cret .ne. 0 ) then
62 print *,'ERROR : file creation'
63 call efexit(-1)
64 endif
65C
66C
67C first parameter creation
68 call mprcre(fid,pname1,type1,desc1,dtunit1,cret)
69 print *,'parameter creation',cret
70 if (cret .ne. 0 ) then
71 print *,'ERROR : parameter creation'
72 call efexit(-1)
73 endif
74C
75C
76C write values
77 call mprrvw(fid,pname1,p1numdt1,p1numit1,dt1,p1v1,cret)
78 print *,'write value',cret
79 if (cret .ne. 0 ) then
80 print *,'ERROR : write value'
81 call efexit(-1)
82 endif
83c
84 call mprrvw(fid,pname1,p1numdt2,p1numit2,dt2,p1v2,cret)
85 print *,'write value',cret
86 if (cret .ne. 0 ) then
87 print *,'ERROR : write value'
88 call efexit(-1)
89 endif
90C
91C
92C second parameter creation
93 call mprcre(fid,pname2,type2,desc2,dtunit2,cret)
94 print *,'parameter creation',cret
95 if (cret .ne. 0 ) then
96 print *,'ERROR : parameter creation'
97 call efexit(-1)
98 endif
99C
100C
101C write values
102 call mprivw(fid,pname2,p2numdt1,p2numit1,dt1,p2v1,cret)
103 print *,'write value',cret
104 if (cret .ne. 0 ) then
105 print *,'ERROR : write value'
106 call efexit(-1)
107 endif
108c
109 call mprivw(fid,pname2,p2numdt2,p2numit2,dt2,p2v2,cret)
110 print *,'write value',cret
111 if (cret .ne. 0 ) then
112 print *,'ERROR : write value'
113 call efexit(-1)
114 endif
115C
116C
117C close file
118 call mficlo(fid,cret)
119 print *,'Close file',cret
120 if (cret .ne. 0 ) then
121 print *,'ERROR : close file'
122 call efexit(-1)
123 endif
124C
125C
126C
127 end
128
program medparameter1
subroutine mfiope(fid, name, access, cret)
Ouverture d'un fichier MED.
Definition medfile.f:42
subroutine mficlo(fid, cret)
Fermeture d'un fichier MED.
Definition medfile.f:82
subroutine mprrvw(fid, name, numdt, numit, dt, val, cret)
Cette routine permet l'écriture de la valeur d'un paramètre numérique scalaire.
subroutine mprcre(fid, name, type, des, dtunit, cret)
Cette routine permet la création d'un paramètre numérique scalaire.
subroutine mprivw(fid, name, numdt, numit, dt, val, cret)
Cette routine permet l'écriture de la valeur d'un paramètre numérique scalaire.
double med_float64
Definition med.h:328
int med_int
Definition med.h:333