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