MED fichier
test2.f
Aller à la documentation de ce fichier.
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 : test2.f
20 C *
21 C * - Description : exemples de creations de maillage MED
22 C *
23 C ******************************************************************************
24  program test2
25 C
26  implicit none
27  include 'med.hf'
28 C
29 C
30  integer cret,ret
31  integer fid
32  character*200 des
33  integer hdfok, medok
34  integer fexist, accok
35  character*16 nomcoo(2)
36  character*16 unicoo(2)
37  data nomcoo /"x","y"/, unicoo /"cm","cm"/
38 
39 
40 C ** verifie que le fichier test1.med existe et est accessible **
41  call mfiexi('test1.med', med_acc_rdonly, fexist, accok, cret)
42  print *,"fexistf :",fexist, " ; accok :", accok
43 
44 C ** verifie que le fichier test1.med est au bon format **
45  call mficom('test1.med',hdfok,medok,cret)
46  print *,hdfok, medok, cret
47  if (cret .ne. 0 ) then
48  print *,'Erreur à la vérification du format'
49  call efexit(-1)
50  endif
51 
52 C ** Ouverture en mode de lecture du fichier test1.med
53  call mfiope(fid,'test1.med',med_acc_rdonly, cret)
54  print *,cret
55  if (cret .ne. 0 ) then
56  print *,'Erreur ouverture du fichier en lecture'
57  call efexit(-1)
58  endif
59 
60 C ** Lecture de l'en-tete du fichier
61  call mficor(fid,des,cret)
62  print *,cret
63  if (cret .ne. 0 ) then
64  print *,'Erreur lecture en-tete du fichier'
65  call efexit(-1)
66  endif
67  print *,"DESCRIPTEUR DE FICHIER : ",des
68 
69 
70 C ** Fermeture du fichier test1.med
71  call mficlo(fid,cret)
72  print *,cret
73  if (cret .ne. 0 ) then
74  print *,'Erreur fermeture du fichier'
75  call efexit(-1)
76  endif
77 
78 
79  call mfiexi('test2.med', med_acc_rdwr, fexist, accok, cret)
80  print *,"fexistf :",fexist, " ; accok :", accok
81 
82 C ** Ouverture en mode de creation du fichier test2.med
83  call mfiope(fid,'test2.med',med_acc_rdwr, cret)
84  print *,cret
85  if (cret .ne. 0 ) then
86  print *,'Erreur creation du fichier'
87  call efexit(-1)
88  endif
89 
90 C ** Creation du maillage maa1 de type non structure
91 C ** et de dimension 2
92  call mmhcre(fid,'maa1',2,2,
93  & med_unstructured_mesh,'un premier maillage',
94  & "",med_sort_dtit,med_cartesian,nomcoo,unicoo,ret)
95  cret = cret + ret
96 C ** Creation du nom universel
97  call mmhunw(fid,'maa1',ret)
98  cret = cret + ret
99  print *,cret
100  if (cret .ne. 0 ) then
101  print *,'Erreur creation du maillage'
102  call efexit(-1)
103  endif
104 
105 C ** Creation du maillage maa2 de type non structure
106  call mmhcre(fid,'maa2',2,2,
107  & med_unstructured_mesh,'un second maillage',
108  & "",med_sort_dtit,med_cartesian,nomcoo,unicoo,ret)
109  cret = cret + ret
110  if (cret .ne. 0 ) then
111  print *,'Erreur creation du maillage'
112  call efexit(-1)
113  endif
114 
115 
116 C ** Creation du maillage maa3 de type structure
117  call mmhcre(fid,'maa3',2,2,
118  & med_structured_mesh,'un troisieme maillage',
119  & "",med_sort_dtit,med_cartesian,nomcoo,unicoo,ret)
120  cret = cret + ret
121  print *,cret
122  if (cret .ne. 0 ) then
123  print *,'Erreur creation du maillage'
124  call efexit(-1)
125  endif
126 
127 C ** Fermeture du fichier
128  call mficlo(fid,cret)
129  print *,cret
130  if (cret .ne. 0 ) then
131  print *,'Erreur fermeture du fichier'
132  call efexit(-1)
133  endif
134 C
135  end
136 
137 
138 
139 
140 
program test2
Definition: test2.f:24
subroutine mfiexi(fname, access, fexist, accok, cret)
Interroge l'existence d'un fichier de nom filename et la possibilité de l'ouvrir selon le mode d'accè...
Definition: medfile.f:234
subroutine mficlo(fid, cret)
Fermeture d'un fichier MED.
Definition: medfile.f:80
subroutine mmhcre(fid, name, sdim, mdim, mtype, desc, dtunit, stype, atype, aname, aunit, cret)
Cette routine permet de créer un maillage dans un fichier.
Definition: medmesh.f:20
subroutine mficor(fid, cmt, cret)
Lecture d'un descripteur dans un fichier MED.
Definition: medfile.f:112
subroutine mmhunw(fid, name, cret)
Cette routine permet l'écriture du nom universel d'un maillage.
Definition: medmesh.f:144
subroutine mficom(fname, hdfok, medok, cret)
Vérification de la compatibilité d'un fichier avec HDF et MED.
Definition: medfile.f:163
subroutine mfiope(fid, name, access, cret)
Ouverture d'un fichier MED.
Definition: medfile.f:41