MED fichier

UsesCase_MEDmesh_13.f
Aller à la documentation de ce fichier.
1 C* This file is part of MED.
2 C*
3 C* COPYRIGHT (C) 1999 - 2021 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*
20 C* Use case 13 : a 2D unstructured mesh with 10 nodes and 2 polygons
21 C*
22 C* poly1 : 1,4,7,9,6,3
23 C* poly2 : 2,5,8,10,7,4
24 C
25 C* 9 10
26 C*
27 C* 6 7 8
28 C*
29 C* 3 4 5
30 C*
31 C* 1 2
32 C*
33 C *****************************************************************************
34 program usescase_medmesh_13
35 C
36 implicit none
37 include 'med.hf77'
38 C
39 C
40 integer cret
41 integer*8 fid
42
43 C space dim, mesh dim
44 integer sdim, mdim
45 C axis name, unit name
46 character*16 axname(2), unname(2)
47 C mesh name, file name
48 character*64 mname, finame
49 character*64 dtunit
50 C coordinates
51 real*8 coords(2*10)
52 integer nnodes
53 integer isize
54 integer index(3)
55 integer conity(12)
56 C comment 1, mesh description
57 character*200 cmt1, mdesc
58 C
59 parameter(sdim = 2, mdim = 2)
60 parameter(mname = "2D unstructured mesh")
61 parameter(dtunit = "")
62 parameter(finame = "UsesCase_MEDmesh_13.med")
63 C Dix noeuds dont deux communs aux deux polygones */
64 parameter(nnodes = 10)
65 parameter(isize = 3)
66 parameter(cmt1 ="A 2D unstructured mesh : 10 nodes, 2 polygons")
67 parameter(mdesc = "A 2D mesh with 2 polygons")
68 C
69 data axname /"x ","y "/
70 data unname /"cm ","cm "/
71 data coords / 0.5, 0.,
72 & 1.5, 0.,
73 & 0., 0.5,
74 & 1., 0.5,
75 & 2., 0.5,
76 & 0., 1.,
77 & 1., 1.,
78 & 2., 1.,
79 & 0.5, 2.,
80 & 1.5, 2. /
81 data index / 1, 7, 13 /
82 data conity / 1,4,7,9,6,3,
83 & 2,5,8,10,7,4 /
84 C
85 C
86 C file creation
87 call mfiope(fid,finame,med_acc_creat,cret)
88 if (cret .ne. 0 ) then
89 print *,'ERROR : file creation'
90 call efexit(-1)
91 endif
92 C
93 C
94 C write a comment in the file
95 call mficow(fid,cmt1,cret)
96 if (cret .ne. 0 ) then
97 print *,'ERROR : write file description'
98 call efexit(-1)
99 endif
100 C
101 C
102 C mesh creation : a 2D unstructured mesh
103 call mmhcre(fid, mname, sdim, mdim, med_unstructured_mesh, mdesc,
104 & dtunit, med_sort_dtit, med_cartesian,
105 & axname, unname, cret)
106 if (cret .ne. 0 ) then
107 print *,'ERROR : mesh creation'
108 call efexit(-1)
109 endif
110 C
111 C
112 C nodes coordinates in a cartesian axis in full interlace mode
113 C (X1,Y1, X2,Y2, X3,Y3, ...) with no iteration and computation step
114 call mmhcow(fid,mname,med_no_dt,med_no_it, med_undef_dt,
115 & med_full_interlace,nnodes,coords,cret)
116 if (cret .ne. 0 ) then
117 print *,'ERROR : write nodes coordinates description'
118 call efexit(-1)
119 endif
120 C
121 C
122 C cells connectiviy is defined in nodal mode
123 C 2 polygons
124 call mmhpgw(fid, mname, med_no_dt, med_no_it, med_undef_dt,
125 & med_cell, med_nodal, isize, index, conity, cret)
126 if (cret .ne. 0 ) then
127 print *,'ERROR : polygon connectivity ...'
128 call efexit(-1)
129 endif
130 C
131 C
132 C create family 0 : by default, all mesh entities family number is 0
133 call mfacre(fid,mname,med_no_name,0,0,med_no_group,cret)
134 if (cret .ne. 0 ) then
135 print *,'ERROR : create family 0'
136 call efexit(-1)
137 endif
138 C
139 C
140 C close file
141 call mficlo(fid,cret)
142 if (cret .ne. 0 ) then
143 print *,'ERROR : close file'
144 call efexit(-1)
145 endif
146 C
147 C
148 C
149 end
150 C
mficlo
subroutine mficlo(fid, cret)
Fermeture d'un fichier MED.
Definition: medfile.f:82
mmhcow
subroutine mmhcow(fid, name, numdt, numit, dt, swm, n, coo, cret)
Cette routine permet d'écrire dans un maillage le tableau des coordonnées des noeuds,...
Definition: medmesh.f:299
mmhpgw
subroutine mmhpgw(fid, name, numdt, numit, dt, entype, cmode, isize, index, con, cret)
Cette routine permet l'écriture des connectivités de polygones.
Definition: medmesh.f:890
usescase_medmesh_13
program usescase_medmesh_13
Definition: UsesCase_MEDmesh_13.f:34
mmhcre
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
mfiope
subroutine mfiope(fid, name, access, cret)
Ouverture d'un fichier MED.
Definition: medfile.f:42
mfacre
subroutine mfacre(fid, name, fname, fnum, ngro, gname, cret)
Cette routine permet la création d'une famille portant sur les entités d'un maillage.
Definition: medfamily.f:19
mficow
subroutine mficow(fid, cmt, cret)
Ecriture d'un descripteur dans un fichier MED.
Definition: medfile.f:99