MED fichier
f/2.3.6/test8.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 : test8.f
20 C *
21 C * - Description : exemple d'ecriture des familles d'un maillage MED
22 C *
23 C *****************************************************************************
24  program test8
25 C
26  implicit none
27  include 'med.hf'
28 C
29  integer cret, fid
30 
31  character*32 maa
32  integer mdim
33  character*32 nomfam
34  integer numfam
35  character*200 attdes
36  integer natt, attide, attval
37  integer ngro
38  character*80 gro
39  integer nfamn
40  character*16 str
41 
42  parameter( mdim = 2, nfamn = 2 )
43  data maa /"maa1"/
44 
45 C ** Creation du fichier test8.med **
46  call efouvr(fid,'test8.med',med_lecture_ecriture, cret)
47  print *,cret
48  if (cret .ne. 0 ) then
49  print *,'Erreur creation du fichier'
50  call efexit(-1)
51  endif
52 
53 C ** Creation du maillage maa de dimension 2 **
54  call efmaac(fid,maa,mdim,med_non_structure,
55  & 'un maillage pour test8',cret)
56  print *,cret
57  if (cret .ne. 0 ) then
58  print *,'Erreur creation du maillage'
59  call efexit(-1)
60  endif
61 
62 C ** Ecriture des familles **
63 C * Conventions :
64 C - Toujours creer une famille de numero 0 ne comportant aucun attribut
65 C ni groupe (famille de reference pour les noeuds ou les elements
66 C qui ne sont rattaches a aucun groupe ni attribut)
67 C - Les numeros de familles de noeuds sont > 0
68 C - Les numeros de familles des elements sont < 0
69 C - Rien d'imposer sur les noms de familles
70 C ** **
71 
72 C * Creation de la famille 0 **
73  numfam = 0
74  nomfam="FAMILLE_0"
75  call effamc(fid,maa,nomfam,numfam,attide,attval,attdes,
76  & 0,gro,0,cret)
77  print *,cret
78  if (cret .ne. 0 ) then
79  print *,'Erreur creation de la famille 0'
80  call efexit(-1)
81  endif
82 
83 C * Creation pour correspondre aux cas tests precedents, 3 familles *
84 C * d'elements (-1,-2,-3) et deux familles de noeuds (1,2) *
85  do numfam=-1,-3,-1
86  write(str,'(I1.0)') (-numfam)
87  nomfam = "FAMILLE_ELEMENT_"//str
88  attide = 1
89  attval = numfam*100
90  natt = 1
91  attdes="description attribut"
92  gro="groupe1"
93  ngro = 1
94  print *, nomfam," - ",numfam," - ",attide," - ",
95  & attval," - ",ngro
96 
97  call effamc(fid,maa,nomfam,numfam,attide,attval,attdes,
98  & natt,gro,ngro,cret)
99  print *,cret
100  if (cret .ne. 0 ) then
101  print *,'Erreur creation de famille'
102  call efexit(-1)
103  endif
104  end do
105 
106  do numfam=1,nfamn
107  write(str,'(I1.0)') numfam
108  nomfam = "FAMILLE_NOEUD_"//str
109  attide = 1
110  attval = numfam*100
111  natt = 1
112  attdes="description attribut"
113  gro="groupe1"
114  ngro = 1
115  print *, nomfam," - ",numfam," - ",attide," - ",
116  & attval," - ",ngro
117  call effamc(fid,maa,nomfam,numfam,attide,attval,attdes,
118  & natt,gro,ngro,cret)
119  print *,cret
120  if (cret .ne. 0 ) then
121  print *,'Erreur creation de famille'
122  call efexit(-1)
123  endif
124  end do
125 
126 
127 C * Fermeture du fichier *
128  call efferm (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 
141