00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 program MEDfile
00023
00024 implicit none
00025 include 'med.hf'
00026
00027
00028 integer cret
00029 integer fid
00030 character*64 fname
00031 parameter (fname = "Unittest_MEDfile_1.med")
00032 character*200 cmt1
00033 parameter (cmt1 = "My first comment")
00034 character*200 cmt2
00035 parameter (cmt2 = "My second comment")
00036 character*200 cmtrd
00037 integer hdfok, medok
00038 character*32 version
00039 integer major, minor, rel
00040
00041
00042
00043 call mfiope(fid,fname,MED_ACC_CREAT,cret)
00044 print *,cret
00045 print *,fid
00046 if (cret .ne. 0 ) then
00047 print *,'ERROR : file creation'
00048 call efexit(-1)
00049 endif
00050
00051
00052
00053 call mficow(fid,cmt1,cret)
00054 print *,cret
00055 if (cret .ne. 0 ) then
00056 print *,'ERROR : write a comment'
00057 call efexit(-1)
00058 endif
00059
00060
00061
00062 call mficlo(fid,cret)
00063 print *,cret
00064 if (cret .ne. 0 ) then
00065 print *,'ERROR : close file'
00066 call efexit(-1)
00067 endif
00068
00069
00070
00071 call mfiope(fid,fname,MED_ACC_RDONLY,cret)
00072 print *,cret
00073 print *,fid
00074 if (cret .ne. 0 ) then
00075 print *,'ERROR : open file in READ_ONLY access mode'
00076 call efexit(-1)
00077 endif
00078
00079
00080
00081 call mfinvr(fid,major,minor,rel,cret)
00082 print *,cret
00083 print *,major,minor,rel
00084 if (cret .ne. 0 ) then
00085 print *,'ERROR : read MED (num) version in the file'
00086 call efexit(-1)
00087 endif
00088
00089 call mfisvr(fid,version,cret)
00090 print *,cret
00091 print *,version
00092 if (cret .ne. 0 ) then
00093 print *,'ERROR : read MED (str) version in the file'
00094 call efexit(-1)
00095 endif
00096
00097
00098
00099 call mficor(fid,cmtrd,cret)
00100 print *,cret
00101 print *,cmtrd
00102 if (cret .ne. 0 ) then
00103 print *,'ERROR : read a comment'
00104 call efexit(-1)
00105 endif
00106 if (cmtrd .ne. cmt1) then
00107 print *,'ERROR : file comment is not the good one'
00108 call efexit(-1)
00109 endif
00110
00111
00112
00113 call mficlo(fid,cret)
00114 print *,cret
00115 if (cret .ne. 0 ) then
00116 print *,'ERROR : close file'
00117 call efexit(-1)
00118 endif
00119
00120
00121
00122 call mfiope(fid,fname,MED_ACC_RDWR,cret)
00123 print *,cret
00124 print *,fid
00125 if (cret .ne. 0 ) then
00126 print *,'ERROR : open file in READ and WRITE access mode'
00127 call efexit(-1)
00128 endif
00129
00130
00131
00132 call mficow(fid,cmt2,cret)
00133 print *,cret
00134 if (cret .ne. 0 ) then
00135 print *,'ERROR : write a comment'
00136 call efexit(-1)
00137 endif
00138
00139
00140
00141 call mficlo(fid,cret)
00142 print *,cret
00143 if (cret .ne. 0 ) then
00144 print *,'ERROR : close file'
00145 call efexit(-1)
00146 endif
00147
00148
00149
00150 call mfiope(fid,fname,MED_ACC_RDEXT,cret)
00151 print *,cret
00152 print *,fid
00153 if (cret .ne. 0 ) then
00154 print *,'ERROR : open file in READ and WRITE access mode'
00155 call efexit(-1)
00156 endif
00157
00158
00159
00160 call mficow(fid,cmt1,cret)
00161 print *,cret
00162 if (cret .eq. 0 ) then
00163 print *,'ERROR : write a comment has to be impossible'
00164 call efexit(-1)
00165 endif
00166
00167
00168
00169 call mficlo(fid,cret)
00170 print *,cret
00171 if (cret .ne. 0 ) then
00172 print *,'ERROR : close file'
00173 call efexit(-1)
00174 endif
00175
00176
00177
00178 print *,fname
00179 call mficom(fname,hdfok,medok,cret)
00180 print *,cret
00181 print *,medok,hdfok
00182 if (cret .ne. 0 ) then
00183 print *,'ERROR : file compatibility'
00184 call efexit(-1)
00185 endif
00186 if (hdfok .ne. 1) then
00187 print *,'ERROR : the file must be in hdf5 format'
00188 call efexit(-1)
00189 endif
00190 if (medok .ne. 1) then
00191 print *,'ERROR : the file must be compatible'
00192 call efexit(-1)
00193 endif
00194 end
00195