MED fichier
f/test23.f
1 C* This file is part of MED.
2 C*
3 C* COPYRIGHT (C) 1999 - 2016 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 : test23.f
20 C *
21 C * - Description : ecriture de mailles MED_POLYGONE dans un maillage MED
22 C *
23 C ******************************************************************************
24  program test23
25 C
26  implicit none
27  include 'med.hf'
28 C
29  integer cret, fid,mdim,sdim
30  parameter(mdim = 2, sdim = 2)
31  character*64 maa
32  integer ni, n
33  parameter(ni=4, n=3)
34  integer index(ni)
35  character*16 nom(n)
36  integer num(n),fam(n)
37  integer con(16)
38 C ** tables des noms et des unites des coordonnees **
39 C profil : (dimension) **
40  character*16 nomcoo(2)
41  character*16 unicoo(2)
42 C
43  data con / 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 /
44  data nom / "poly1", "poly2", "poly3"/
45  data num / 1,2,3 /, fam /0,-1,-2/
46  data index /1,6,12,17/
47  data maa /"maa1"/
48  data nomcoo /"x","y"/, unicoo /"cm","cm"/
49 
50 C ** Creation du fichier test23.med **
51  call mfiope(fid,'test23.med',med_acc_rdwr, cret)
52  print *,cret
53  if (cret .ne. 0 ) then
54  print *,'Erreur creation du fichier'
55  call efexit(-1)
56  endif
57  print *,'Creation du fichier test23.med'
58 
59 C ** Creation du maillage **
60  call mmhcre(fid,maa,mdim,sdim,
61  & med_unstructured_mesh,'un maillage pour test 23',
62  & "",med_sort_dtit,med_cartesian,nomcoo,unicoo,cret)
63  print *,cret
64  if (cret .ne. 0 ) then
65  print *,'Erreur creation du maillage'
66  call efexit(-1)
67  endif
68  print *,'Creation du maillage'
69 
70 C ** Ecriture de la connectivite des mailles polygones **
71  call mmhpgw(fid,maa,med_no_dt,med_no_it,med_undef_dt,med_cell,
72  & med_nodal,ni,index,con,cret)
73  if (cret .ne. 0 ) then
74  print *,'Erreur ecriture des connectivite polygones'
75  call efexit(-1)
76  endif
77  print *,cret
78  print *,'Ecriture des connectivites des mailles de type
79  & MED_POLYGONE'
80 
81 C ** Ecriture des noms des mailles polygones **
82  call mmheaw(fid,maa,med_no_dt,med_no_it,med_cell,
83  & med_polygon,n,nom,cret)
84  print *,cret
85  if (cret .ne. 0 ) then
86  print *,'Erreur ecriture des noms polygones'
87  call efexit(-1)
88  endif
89  print *,'Ecriture des noms des polygones'
90 
91 C ** Ecriture des numeros des mailles polygones **
92  call mmhenw(fid,maa,med_no_dt,med_no_it,med_cell,
93  & med_polygon,n,num,cret)
94  if (cret .ne. 0 ) then
95  print *,'Erreur ecriture des numeros polygones'
96  call efexit(-1)
97  endif
98  print *,cret
99  print *,'Ecriture des numeros des polygones'
100 
101 C ** Ecriture des numeros des familles des mailles polygones **
102  call mmhfnw(fid,maa,med_no_dt,med_no_it,med_cell,
103  & med_polygon,n,fam,cret)
104  if (cret .ne. 0 ) then
105  print *,'Erreur ecriture des numeros de famille polygones'
106  call efexit(-1)
107  endif
108  print *,cret
109  print *,'Ecriture des numeros de familles des polygones'
110 
111 C ** Fermeture du fichier **
112  call mficlo(fid,cret)
113  print *,cret
114  if (cret .ne. 0 ) then
115  print *,'Erreur fermeture du fichier'
116  call efexit(-1)
117  endif
118  print *,'Fermeture du fichier'
119 C
120  end