MED fichier
f/2.3.6/test21.f
1 C* This file is part of MED.
2 C*
3 C* COPYRIGHT (C) 1999 - 2017 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* - Nom du fichier : test21.f
20 C*
21 C* - Description : ecriture de valeurs scalaires numeriques dans un fichier MED
22 C*
23 C ******************************************************************************
24  program test21
25 C
26  implicit none
27  include 'med.hf'
28 C
29  integer cret, fid
30  character*16 edtuni,dtunit1
31  character*32 nom1, nom2
32  character*200 desc1, desc2
33  integer vali1, vali2
34  real*8 valr1,dt
35 C
36  parameter(nom1="VariableEntiere")
37  parameter(nom2="VariableFlottante")
38  data desc1 / "Une premiere description" /
39  data desc2 / "Une seconde description" /
40  parameter(vali1 = 56,vali2 = -789)
41  parameter(valr1 = 67.98d0)
42 
43  parameter(edtuni=" "
44  1 ,dtunit1="ms")
45 C
46 C
47 C Creation du fichier test21.med
48 C
49  call efouvr(fid,'test21.med',med_lecture_ecriture,cret)
50  print *,cret
51  if (cret .ne. 0 ) then
52  print *,'Erreur creation du fichier'
53  call efexit(-1)
54  endif
55  print *,'Creation du fichier test21.med'
56 C
57 C Creation d'une variable scalaire entiere
58 C
59  call efscac(fid,nom1,med_int,desc1,cret)
60  print *,cret
61  if (cret .ne. 0 ) then
62  print *,'Erreur creation variable scalaire'
63  call efexit(-1)
64  endif
65  print *,'Creation d une variable scalaire entiere'
66 C
67 C Ecriture d'une valeur sans pas de temps ni numero d'ordre
68 C
69  dt =0.0d0
70  call efscee(fid,nom1,vali1,med_nopdt,edtuni,dt,med_nonor,cret)
71  print *,cret
72  if (cret .ne. 0 ) then
73  print *,'Erreur ecriture valeur scalaire'
74  call efexit(-1)
75  endif
76  print *,'Ecriture valeur entiere sans pas de temps'
77 C
78 C Ecriture d'une valeur avec pas de temps et sans numero d'ordre
79 C
80  dt = 5.5d0
81  call efscee(fid,nom1,vali2,1,dtunit1,dt,med_nonor,cret)
82  print *,cret
83  if (cret .ne. 0 ) then
84  print *,'Erreur ecriture valeur scalaire'
85  call efexit(-1)
86  endif
87  print *,'Ecriture valeur entiere avec pas de temps'
88 C
89 C Creation d'une variable scalaire flottante
90 C
91  call efscac(fid,nom2,med_float64,desc2,cret)
92  print *,cret
93  if (cret .ne. 0 ) then
94  print *,'Erreur creation variable sclaire'
95  call efexit(-1)
96  endif
97  print *,'Creation d une variable scalaire flottante'
98 C
99 C Ecriture d'une valeur flottante avec pas de temps et numero d'ordre
100 C
101  call efscfe(fid,nom2,valr1,1,dtunit1,dt,2,cret)
102  print *,cret
103  if (cret .ne. 0 ) then
104  print *,'Erreur ecriture valeur scalaire'
105  call efexit(-1)
106  endif
107  print *,'Ecriture valeur entiere avec pas de temps'
108 C
109 C Fermeture du fichier
110 C
111  call efferm(fid,cret)
112  if (cret .ne. 0 ) then
113  print *,'Erreur fermeture du fichier'
114  call efexit(-1)
115  endif
116  print *,cret
117  print *,'Fermeture du fichier test21.med'
118 C
119  end
120 C