Unittest_MEDparameter_3.f

Aller à la documentation de ce fichier.
00001 C*  This file is part of MED.
00002 C*
00003 C*  COPYRIGHT (C) 1999 - 2015  EDF R&D, CEA/DEN
00004 C*  MED is free software: you can redistribute it and/or modify
00005 C*  it under the terms of the GNU Lesser General Public License as published by
00006 C*  the Free Software Foundation, either version 3 of the License, or
00007 C*  (at your option) any later version.
00008 C*
00009 C*  MED is distributed in the hope that it will be useful,
00010 C*  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 C*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 C*  GNU Lesser General Public License for more details.
00013 C*
00014 C*  You should have received a copy of the GNU Lesser General Public License
00015 C*  along with MED.  If not, see <http://www.gnu.org/licenses/>.
00016 C*
00017 
00018 C******************************************************************************
00019 C * Tests for parameter module
00020 C *
00021 C *****************************************************************************
00022       program MEDparameter3
00023 C     
00024       implicit none
00025       include 'med.hf'
00026 C
00027 C     
00028       integer cret
00029       integer fid
00030       character*64 fname
00031       parameter (fname = "Unittest_MEDparameter_1.med")
00032       character*64 pname1,pname2,pname
00033       parameter (pname1="first parameter name") 
00034       parameter (pname2="second parameter name") 
00035       integer type1,type2,type
00036       parameter (type1=MED_FLOAT64, type2=MED_INT)
00037       character*200 desc1,desc2,desc
00038       parameter (desc1="First parameter description")
00039       parameter (desc2="Second parameter description")
00040       character*16 dtunit1,dtunit2,dtunit
00041       parameter (dtunit1="unit1")
00042       parameter (dtunit2="unit2")
00043       real*8 p1v1, p1v2,rv
00044       parameter (p1v1=1.0,p1v2=2.0)
00045       integer p1numdt1,p1numdt2,p2numdt1,p2numdt2,numdt
00046       parameter (p1numdt1=MED_NO_DT,p1numdt2=1)
00047       parameter (p2numdt1=2, p2numdt2=3)
00048       real*8 dt1, dt2,dt
00049       parameter (dt1=MED_UNDEF_DT,dt2=5.5)
00050       integer p2v1,p2v2,iv
00051       parameter (p2v1=3,p2v2=4)
00052       integer p1numit1, p1numit2, p2numit1, p2numit2
00053       integer numit
00054       parameter (p1numit1=MED_NO_IT, p1numit2=1)
00055       parameter (p2numit1=2, p2numit2=3)
00056       integer nstep1,nstep2,nstep,sit
00057       parameter (nstep1=2,nstep2=2)
00058       integer np,np1,it
00059       parameter (np1=2)
00060 C 
00061 C
00062 C     open file
00063       call mfiope(fid,fname,MED_ACC_RDONLY,cret)
00064       print *,'Open file',cret
00065       if (cret .ne. 0 ) then
00066          print *,'ERROR : open file'
00067          call efexit(-1)
00068       endif 
00069 C
00070 C
00071 C     number of parameter
00072       call mprnpr(fid,np,cret)
00073       print *,'Number of parameter',cret
00074       if ((cret .ne. 0) .or.
00075      &    (np .ne. np1)) then
00076          print *,'ERROR : number of parameter'
00077          call efexit(-1)
00078       endif 
00079 C
00080 C
00081 C     read parameters
00082       do it=1,np
00083 c
00084          call mprpri(fid,it,pname,type,desc, 
00085      &               dtunit,nstep,cret)
00086          print *,'interpolation information',cret
00087          if (cret .ne. 0 ) then
00088             print *,'ERROR : interpolation information'
00089             call efexit(-1)
00090          endif 
00091 c     
00092 c         if (it .eq. 1) then
00093 c            if ((pname .ne. pname1) .or.
00094 c     &          (type .ne. type1) .or.
00095 c     &          (desc .ne. desc1) .or.
00096 c     &          (dtunit .ne. dtunit1) .or.
00097 c     &          (nstep .ne. nstep1)) then
00098 c               print *,'ERROR : interpolation information'
00099 c               call efexit(-1)
00100 c            endif
00101 c         endif
00102 c
00103 c         if (it .eq. 2) then
00104 c            if ((pname .ne. pname2) .or.
00105 c     &          (type .ne. type2) .or.
00106 c     &          (desc .ne. desc2) .or.
00107 c     &          (dtunit .ne. dtunit2) .or.
00108 c     &          (nstep .ne. nstep2)) then
00109 c               print *,'ERROR : interpolation information'
00110 c               call efexit(-1)
00111 c            endif
00112 c         endif
00113 c
00114          do sit=1,nstep
00115 c
00116             call mprcsi(fid,pname,sit,numdt,numit,
00117      &                  dt,cret)
00118             print *,'computation step information',cret
00119             if (cret .ne. 0 ) then
00120                print *,'ERROR : computation step information'
00121                call efexit(-1)
00122             endif 
00123 c
00124 c            if ((pname .eq. pname1) .and.
00125 c     &          (sit .eq. 1)) then
00126 c               if ((numdt .ne. p1numdt1) .or.
00127 c     &              (numit .ne. p1numit1) .or.
00128 c     &              (dt .ne. dt1)) then
00129 c                  print *,'ERROR : read value'
00130 c                  call efexit(-1)
00131 c               endif
00132 c            endif 
00133 c
00134 c            if ((pname .eq. pname1) .and.
00135 c     &          (sit .eq. 2)) then
00136 c               if ((numdt .ne. p1numdt2) .or.
00137 c     &              (numit .ne. p1numit2) .or.
00138 c     &              (dt .ne. dt2)) then
00139 c                  print *,'ERROR : read value'
00140 c                  call efexit(-1)
00141 c               endif
00142 c            endif 
00143 c
00144 c            if ((pname .eq. pname2) .and.
00145 c     &          (sit .eq. 1)) then
00146 c               if ((numdt .ne. p2numdt1) .or.
00147 c     &             (numit .ne. p2numit1) .or.
00148 c     &             (dt .ne. dt1)) then
00149 c                  print *,'ERROR : read value'
00150 c                  call efexit(-1)
00151 c               endif
00152 c            endif 
00153 c
00154 c            if ((pname .eq. pname2) .and.
00155 c     &          (sit .eq. 2)) then
00156 c              if ((numdt .ne. p2numdt2) .or.
00157 c     &             (numit .ne. p2numit2) .or.
00158 c     &             (dt .ne. dt2)) then
00159 c                  print *,'ERROR : read value'
00160 c                  call efexit(-1)
00161 c               endif
00162 c            endif 
00163 c
00164 c            if (type .eq. MED_INT) then
00165 c               call mprivr(fid,pname,numdt,numit,iv,cret)
00166 c               print *,'read value',cret
00167 c               if (cret .ne. 0 ) then
00168 c                  print *,'ERROR : read value'
00169 c                  call efexit(-1)
00170 c               endif 
00171 c
00172 c               if ((sit .eq. 1) .and.
00173 c     &              (iv .ne. p2v1)) then
00174 c                  print *,'ERROR : read value'
00175 c                  call efexit(-1)
00176 c               endif
00177 c
00178 c               if ((sit .eq. 2) .and.
00179 c     &              (iv .ne. p2v2)) then
00180 c                  print *,'ERROR : read value'
00181 c                  call efexit(-1)
00182 c               endif
00183 c            else
00184 c               call mprrvr(fid,pname,numdt,numit,rv,cret)
00185 c               print *,'read value',cret
00186 c               if (cret .ne. 0 ) then
00187 c                  print *,'ERROR : read value'
00188 c                  call efexit(-1)
00189 c               endif 
00190 c
00191 c               if ((sit .eq. 1) .and.
00192 c     &              (rv .ne. p1v1)) then
00193 c                  print *,'ERROR : read value'
00194 c                  call efexit(-1)
00195 c               endif
00196 c
00197 c               if ((sit .eq. 2) .and.
00198 c     &             (rv .ne. p1v2)) then
00199 c                  print *,'ERROR : read value'
00200 c                  call efexit(-1)
00201 c               endif
00202 c            endif
00203          enddo
00204 c
00205       enddo
00206 C
00207 C
00208 C     close file
00209       call mficlo(fid,cret)
00210       print *,'Close file',cret
00211       if (cret .ne. 0 ) then
00212          print *,'ERROR :  close file'
00213          call efexit(-1)
00214       endif  
00215 C
00216 C
00217 C
00218       end
00219 

Généré le Thu Oct 8 14:26:17 2015 pour MED fichier par  doxygen 1.6.1