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