# Unittest_MEDparameter_1.f

Aller à la documentation de ce fichier.

    00001 C*  This file is part of MED.
    00002 C*
    00003 C*  COPYRIGHT (C) 1999 - 2012  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 paramter module
    00020 C *
    00021 C *****************************************************************************
    00022       program MEDparameter1
    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
    00033       parameter (pname1="first parameter name")
    00034       parameter (pname2="second parameter name")
    00035       integer type1,type2
    00036       parameter (type1=MED_FLOAT64, type2=MED_INT)
    00037       character*200 desc1,desc2
    00038       parameter (desc1="First parameter description")
    00039       parameter (desc2="Second parameter description")
    00040       character*16 dtunit1,dtunit2
    00041       parameter (dtunit1="unit1")
    00042       parameter (dtunit2="unit2")
    00043       real*8 p1v1, p1v2
    00044       parameter (p1v1=1.0,p1v2=2.0)
    00045       integer p1numdt1,p1numdt2,p2numdt1,p2numdt2
    00046       parameter (p1numdt1=MED_NO_DT,p1numdt2=1)
    00047       parameter (p2numdt1=2, p2numdt2=3)
    00048       real*8 dt1, dt2
    00049       parameter (dt1=MED_UNDEF_DT,dt2=5.5)
    00050       integer p2v1,p2v2
    00051       parameter (p2v1=3,p2v2=4)
    00052       integer p1numit1, p1numit2, p2numit1, p2numit2
    00053       parameter (p1numit1=MED_NO_IT, p1numit2=1)
    00054       parameter (p2numit1=2, p2numit2=3)
    00055 C
    00056 C
    00057 C     file creation
    00058       call mfiope(fid,fname,MED_ACC_CREAT,cret)
    00059       print *,'Open file',cret
    00060       if (cret .ne. 0 ) then
    00061          print *,'ERROR : file creation'
    00062          call efexit(-1)
    00063       endif
    00064 C
    00065 C
    00066 C     first parameter creation
    00067       call mprcre(fid,pname1,type1,desc1,dtunit1,cret)
    00068       print *,'parameter creation',cret
    00069       if (cret .ne. 0 ) then
    00070          print *,'ERROR : parameter creation'
    00071          call efexit(-1)
    00072       endif
    00073 C
    00074 C
    00075 C     write values
    00076       call mprrvw(fid,pname1,p1numdt1,p1numit1,dt1,p1v1,cret)
    00077       print *,'write value',cret
    00078       if (cret .ne. 0 ) then
    00079          print *,'ERROR : write value'
    00080          call efexit(-1)
    00081       endif
    00082 c
    00083       call mprrvw(fid,pname1,p1numdt2,p1numit2,dt2,p1v2,cret)
    00084       print *,'write value',cret
    00085       if (cret .ne. 0 ) then
    00086          print *,'ERROR : write value'
    00087          call efexit(-1)
    00088       endif
    00089 C
    00090 C
    00091 C     second parameter creation
    00092       call mprcre(fid,pname2,type2,desc2,dtunit2,cret)
    00093       print *,'parameter creation',cret
    00094       if (cret .ne. 0 ) then
    00095          print *,'ERROR : parameter creation'
    00096          call efexit(-1)
    00097       endif
    00098 C
    00099 C
    00100 C     write values
    00101       call mprivw(fid,pname2,p2numdt1,p2numit1,dt1,p2v1,cret)
    00102       print *,'write value',cret
    00103       if (cret .ne. 0 ) then
    00104          print *,'ERROR : write value'
    00105          call efexit(-1)
    00106       endif
    00107 c
    00108       call mprivw(fid,pname2,p2numdt2,p2numit2,dt2,p2v2,cret)
    00109       print *,'write value',cret
    00110       if (cret .ne. 0 ) then
    00111          print *,'ERROR : write value'
    00112          call efexit(-1)
    00113       endif
    00114 C
    00115 C
    00116 C     close file
    00117       call mficlo(fid,cret)
    00118       print *,'Close file',cret
    00119       if (cret .ne. 0 ) then
    00120          print *,'ERROR :  close file'
    00121          call efexit(-1)
    00122       endif
    00123 C
    00124 C
    00125 C
    00126       end
    00127