f/test21.f

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* - Nom du fichier : test21.f
00020 C*
00021 C* - Description : ecriture de valeurs scalaires numeriques dans un fichier MED
00022 C*
00023 C ******************************************************************************
00024       program test21
00025 C     
00026       implicit none
00027       include 'med.hf'
00028 C
00029       integer cret, fid
00030       character*16 edtuni,dtunit1
00031       character*64 nom1, nom2
00032       character*200 desc1, desc2
00033       integer vali1, vali2
00034       real*8 valr1,dt
00035 C
00036       parameter (nom1="VariableEntiere")
00037       parameter (nom2="VariableFlottante")
00038       data desc1 / "Une premiere description" /
00039       data desc2 / "Une seconde description" /
00040       parameter (vali1 = 56,vali2 = -789)
00041       parameter (valr1 = 67.98D0)
00042     
00043       parameter (edtuni="                "
00044      1         ,dtunit1="ms")
00045 C
00046 C     
00047 C     Creation du fichier test21.med
00048 C
00049       call mfiope(fid,'test21.med',MED_ACC_RDWR, cret)
00050       print *,cret
00051       if (cret .ne. 0 ) then
00052          print *,'Erreur creation du fichier'
00053          call efexit(-1)
00054       endif      
00055       print *,'Creation du fichier test21.med'
00056 C
00057 C     Creation d'une variable scalaire entiere 
00058 C
00059       call mprcre(fid,nom1,MED_INT,desc1,dtunit1,
00060      &            cret)
00061       print *,cret
00062       if (cret .ne. 0 ) then
00063          print *,'Erreur creation variable scalaire'
00064          call efexit(-1)
00065       endif      
00066       print *,'Creation d une variable scalaire entiere'
00067 C
00068 C     Ecriture d'une valeur sans pas de temps ni numero d'ordre
00069 C
00070       call mprivw(fid,nom1,MED_NO_DT,MED_NO_IT,MED_UNDEF_DT,
00071      &            vali1,cret)
00072       print *,cret
00073       if (cret .ne. 0 ) then
00074          print *,'Erreur ecriture valeur scalaire'
00075          call efexit(-1)
00076       endif      
00077       print *,'Ecriture valeur entiere sans pas de temps'
00078 C
00079 C     Ecriture d'une valeur avec pas de temps et sans numero d'ordre
00080 C
00081       dt = 5.5D0
00082       call mprivw(fid,nom1,1,MED_NO_IT,dt,vali2,cret)
00083       print *,cret
00084       if (cret .ne. 0 ) then
00085          print *,'Erreur ecriture valeur scalaire'
00086          call efexit(-1)
00087       endif      
00088       print *,'Ecriture valeur entiere avec pas de temps'
00089 C
00090 C     Creation d'une variable scalaire flottante
00091 C
00092       call mprcre(fid,nom2,MED_FLOAT64,desc2,dtunit1,
00093      &            cret)
00094       print *,cret
00095       if (cret .ne. 0 ) then
00096          print *,'Erreur creation variable sclaire'
00097          call efexit(-1)
00098       endif      
00099       print *,'Creation d une variable scalaire flottante'
00100 C
00101 C     Ecriture d'une valeur flottante avec pas de temps et numero d'ordre
00102 C
00103       call mprrvw(fid,nom2,1,2,dt,valr1,cret)
00104       print *,cret
00105       if (cret .ne. 0 ) then
00106          print *,'Erreur ecriture valeur scalaire'
00107          call efexit(-1)
00108       endif      
00109       print *,'Ecriture valeur entiere avec pas de temps'
00110 C
00111 C     Fermeture du fichier      
00112 C
00113       call mficlo(fid,cret)
00114       if (cret .ne. 0 ) then
00115          print *,'Erreur fermeture du fichier'
00116          call efexit(-1)
00117       endif      
00118       print *,cret
00119       print *,'Fermeture du fichier test21.med'
00120 C
00121       end
00122 C

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