| 1 |
C* This file is part of MED. |
| 2 |
C* |
| 3 |
C* COPYRIGHT (C) 1999 - 2020 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*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) |
| 45 |
C |
| 46 |
C |
| 47 |
C 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 |
| 54 |
C |
| 55 |
C |
| 56 |
C 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 |
| 68 |
C |
| 69 |
C |
| 70 |
C Read profile(s) name and size |
| 71 |
C 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 |
| 79 |
c |
| 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 |
| 86 |
c |
| 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 |
| 99 |
c |
| 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 |
| 115 |
C |
| 116 |
C |
| 117 |
C 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 |
| 124 |
c |
| 125 |
if (psize .ne. psize1) then |
| 126 |
print *,'ERROR : size of profile' |
| 127 |
call efexit(-1) |
| 128 |
endif |
| 129 |
c |
| 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 |
| 136 |
c |
| 137 |
if (psize .ne. psize2) then |
| 138 |
print *,'ERROR : size of profile' |
| 139 |
call efexit(-1) |
| 140 |
endif |
| 141 |
C |
| 142 |
C |
| 143 |
C 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 |
| 150 |
C |
| 151 |
C |
| 152 |
C |
| 153 |
end |
| 154 |
|